Загрузка данных


<!DOCTYPE html>
<html lang="ru">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>SkillHub — выбор курсов</title>
  <link rel="stylesheet" href="style.css">
</head>
<body>

  <div class="container">
    <header class="header">
      <h1>SkillHub</h1>
      <p>Выбери курсы для обучения и собери свою программу</p>
    </header>

    <section class="controls">
      <input id="search" type="search" placeholder="Поиск курса...">

      <select id="category">
        <option value="all">Все категории</option>
        <option value="code">Программирование</option>
        <option value="design">Дизайн</option>
        <option value="marketing">Маркетинг</option>
      </select>
    </section>

    <section id="courses" class="grid"></section>

    <div class="total">
      Выбрано: <span id="count">0</span> |
      Сумма: <span id="sum">0 ₽</span>
    </div>

    <section class="features">
      <div class="feature">
        <h3>🎓 Практика</h3>
        <p>Реальные проекты и задания после каждого модуля.</p>
      </div>

      <div class="feature">
        <h3>👨‍🏫 Поддержка</h3>
        <p>Наставники помогают разбираться с вопросами.</p>
      </div>

      <div class="feature">
        <h3>📜 Сертификат</h3>
        <p>После курса ты получишь сертификат об обучении.</p>
      </div>
    </section>
  </div>

  <footer class="footer">
    <div class="footer-container">

      <div class="footer-brand">
        <h2>SkillHub</h2>
        <p>
          Онлайн-платформа для обучения программированию,
          дизайну и маркетингу. Выбирай курсы и развивайся
          в удобном темпе.
        </p>
      </div>

      <div class="footer-links">
        <h3>Навигация</h3>
        <a href="#">Главная</a>
        <a href="#">Каталог курсов</a>
        <a href="#">О платформе</a>
        <a href="#">Контакты</a>
      </div>

      <div class="footer-links">
        <h3>Категории</h3>
        <a href="#">Программирование</a>
        <a href="#">Дизайн</a>
        <a href="#">Маркетинг</a>
        <a href="#">Аналитика</a>
      </div>

      <div class="footer-contacts">
        <h3>Контакты</h3>
        <p>📧 info@skillhub.ru</p>
        <p>📞 +7 (900) 000-00-00</p>
        <p>📍 Калининград, Россия</p>

        <div class="socials">
          <a href="#">VK</a>
          <a href="#">TG</a>
          <a href="#">YT</a>
        </div>
      </div>

    </div>

    <div class="footer-bottom">
      <p>© 2026 SkillHub. Все права защищены.</p>
      <p>Сделано с ♥ для студентов</p>
    </div>
  </footer>

  <script src="script.js"></script>
</body>
</html>





* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

body {
  background: #f4f6fb;
  color: #222;
  padding: 30px 15px;
}

.container {
  max-width: 1000px;
  margin: auto;
}

.header {
  text-align: center;
  margin-bottom: 30px;
}

.header h1 {
  font-size: 40px;
  color: #4f46e5;
  margin-bottom: 8px;
}

.header p {
  color: #666;
}

.controls {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
  margin-bottom: 25px;
}

input,
select {
  width: 100%;
  padding: 13px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 16px;
  background: #fff;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
}

.card {
  background: #fff;
  padding: 18px;
  border-radius: 14px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.07);
}

.card h3 {
  margin-bottom: 8px;
}

.card p {
  color: #666;
  font-size: 14px;
  margin-bottom: 12px;
}

button {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: #4f46e5;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s;
}

button:hover {
  background: #4338ca;
}

button.active {
  background: #16a34a;
}

.total {
  margin-top: 25px;
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  background: #fff;
  padding: 15px;
  border-radius: 12px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.07);
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 15px;
  margin-top: 40px;
}

.feature {
  background: #fff;
  padding: 20px;
  border-radius: 14px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.07);
  text-align: center;
}

.feature h3 {
  margin-bottom: 8px;
}

.feature p {
  color: #666;
  font-size: 14px;
}

/* Footer */
.footer {
  margin-top: 50px;
  background: #101828;
  color: #d0d5dd;
  border-radius: 20px;
  padding: 40px 25px 20px;
}

.footer-container {
  max-width: 1000px;
  margin: auto;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
  gap: 30px;
}

.footer-brand h2 {
  color: #fff;
  margin-bottom: 10px;
}

.footer-brand p {
  font-size: 14px;
  line-height: 1.6;
}

.footer h3 {
  color: #fff;
  font-size: 16px;
  margin-bottom: 12px;
}

.footer-links {
  display: grid;
  gap: 8px;
}

.footer a {
  color: #d0d5dd;
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}

.footer a:hover {
  color: #818cf8;
}

.footer-contacts p {
  font-size: 14px;
  margin-bottom: 6px;
}

.socials {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.socials a {
  background: #1f2937;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: bold;
}

.socials a:hover {
  background: #4f46e5;
  color: #fff;
}

.footer-bottom {
  max-width: 1000px;
  margin: 30px auto 0;
  padding-top: 18px;
  border-top: 1px solid #2c3444;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
}

@media (max-width: 800px) {
  .controls {
    grid-template-columns: 1fr;
  }

  .footer-container {
    grid-template-columns: 1fr;
  }

  .footer-bottom {
    justify-content: center;
    text-align: center;
  }
}




const courses = [
  {
    id: 1,
    title: "Python с нуля",
    category: "code",
    price: 9900
  },
  {
    id: 2,
    title: "Веб-разработка",
    category: "code",
    price: 14900
  },
  {
    id: 3,
    title: "UI/UX дизайн",
    category: "design",
    price: 12900
  },
  {
    id: 4,
    title: "Графический дизайн",
    category: "design",
    price: 8900
  },
  {
    id: 5,
    title: "SMM и реклама",
    category: "marketing",
    price: 7900
  },
  {
    id: 6,
    title: "SEO-продвижение",
    category: "marketing",
    price: 11900
  }
];

const selected = new Set();

const coursesEl = document.getElementById("courses");
const searchEl = document.getElementById("search");
const categoryEl = document.getElementById("category");
const countEl = document.getElementById("count");
const sumEl = document.getElementById("sum");

function render() {
  const search = searchEl.value.toLowerCase();
  const category = categoryEl.value;

  coursesEl.innerHTML = "";

  const filteredCourses = courses.filter(course => {
    const matchesSearch = course.title
      .toLowerCase()
      .includes(search);

    const matchesCategory =
      category === "all" || course.category === category;

    return matchesSearch && matchesCategory;
  });

  filteredCourses.forEach(course => {
    const card = document.createElement("div");
    card.className = "card";

    const isSelected = selected.has(course.id);

    card.innerHTML = `
      <h3>${course.title}</h3>
      <p>${course.price.toLocaleString("ru-RU")} ₽</p>
      <button class="${isSelected ? "active" : ""}">
        ${isSelected ? "Выбрано ✓" : "Выбрать"}
      </button>
    `;

    card.querySelector("button").addEventListener("click", () => {
      if (selected.has(course.id)) {
        selected.delete(course.id);
      } else {
        selected.add(course.id);
      }

      render();
      updateTotal();
    });

    coursesEl.appendChild(card);
  });

  if (filteredCourses.length === 0) {
    coursesEl.innerHTML = "<p>Курсы не найдены.</p>";
  }
}

function updateTotal() {
  let total = 0;

  courses.forEach(course => {
    if (selected.has(course.id)) {
      total += course.price;
    }
  });

  countEl.textContent = selected.size;
  sumEl.textContent = total.toLocaleString("ru-RU") + " ₽";
}

searchEl.addEventListener("input", render);
categoryEl.addEventListener("change", render);

render();
updateTotal();