Skip to content

Commit

Permalink
add task solution
Browse files Browse the repository at this point in the history
  • Loading branch information
1luki9901 committed Dec 16, 2024
1 parent b392358 commit 3b782d4
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/scripts/main.js
Original file line number Diff line number Diff line change
@@ -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);
});

0 comments on commit 3b782d4

Please sign in to comment.