From 3b782d4896d3ef830a0e62f413f5e6b9e1ea3709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz?= <1luki9901@gmail.com> Date: Mon, 16 Dec 2024 23:34:18 +0100 Subject: [PATCH] add task solution --- src/scripts/main.js | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/scripts/main.js b/src/scripts/main.js index ad9a93a7c..55ddd9c7e 100644 --- a/src/scripts/main.js +++ b/src/scripts/main.js @@ -1 +1,44 @@ +import '../styles/main.scss'; + 'use strict'; +document.addEventListener('DOMContentLoaded', () => { + const header = document.createElement('header'); + header.className = 'header'; + + const nav = document.createElement('nav'); + nav.className = 'header__nav'; + + const logo = document.createElement('div'); + logo.className = 'header__logo'; + logo.textContent = 'Creative Bakery'; + + const menu = document.createElement('ul'); + menu.className = 'header__menu'; + + const menuItems = ['Home', 'About', 'Products', 'Contact']; + menuItems.forEach(item => { + const menuItem = document.createElement('li'); + menuItem.className = 'header__menu-item'; + menuItem.textContent = item; + menu.appendChild(menuItem); + }); + + nav.appendChild(logo); + nav.appendChild(menu); + header.appendChild(nav); + document.body.appendChild(header); + + const main = document.createElement('main'); + main.className = 'main-content'; + + const heroSection = document.createElement('section'); + heroSection.className = 'hero'; + + const heroText = document.createElement('div'); + heroText.className = 'hero__text'; + heroText.textContent = 'Welcome to Creative Bakery'; + + heroSection.appendChild(heroText); + main.appendChild(heroSection); + document.body.appendChild(main); +});