Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
VitalyChy authored Feb 6, 2024
0 parents commit be706f6
Show file tree
Hide file tree
Showing 22 changed files with 217 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Tests

on:
push:
branches:
- '**'
tags:
- '**'


jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Set up GitHub Actions
uses: actions/checkout@v3
- name: Use Node.js 14.x
uses: actions/setup-node@v3
with:
node-version: 14.x
- name: Check if the repository is private
run: exit 1
if: ${{github.event.repository.private}}
- name: Get testing lib
run: set -eu && git clone --branch main --single-branch --depth 1 https://github.com/Yandex-Practicum/tests-selfmade-project-6-public.git
- name: Run the tests
run: bash tests-selfmade-project-6-public/run.sh
- name: Upload layout-compare
uses: actions/upload-artifact@v3
with:
name: layout-compare
path: tests-selfmade-project-6-public/outputs/
- name: Show test results
run: bash tests-selfmade-project-6-public/result.sh
Binary file added fonts/IBMPlexMono-Bold.woff
Binary file not shown.
Binary file added fonts/IBMPlexMono-Regular.woff
Binary file not shown.
13 changes: 13 additions & 0 deletions fonts/fonts.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@font-face {
font-family: 'IBM Plex mono';
src: url(./IBMPlexMono-Regular.woff) format('woff');
font-weight: normal;
font-display: swap;
}

@font-face {
font-family: 'IBM Plex mono';
src: url(./IBMPlexMono-Bold.woff) format('woff');
font-weight: bold;
font-display: swap;
}
Binary file added images/books.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/cover-image-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/cover-image-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/cover-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/favicon.ico
Binary file not shown.
7 changes: 7 additions & 0 deletions images/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/ice-cream.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/mobile-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/street.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/sunset.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/tape.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Сложно сосредоточиться</title>
</head>
<body class="page">
<header class="header decorated-zone">
<nav class="header__theme-menu">
<ul class="header__theme-menu-list">
<li class="header__theme-menu-item">
<button
class="header__theme-menu-button header__theme-menu-button_type_light"
>
День
</button>
</li>
<li class="header__theme-menu-item">
<button
class="header__theme-menu-button header__theme-menu-button_active header__theme-menu-button_type_auto"
disabled
>
Авто
</button>
</li>
<li class="header__theme-menu-item">
<button
class="header__theme-menu-button header__theme-menu-button_type_dark"
>
Неон
</button>
</li>
</ul>
</nav>
</header>
<script src="./scripts/script.js"></script>
</body>
</html>
48 changes: 48 additions & 0 deletions scripts/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
const themeButtons = document.querySelectorAll('.header__theme-menu-button');

themeButtons.forEach((button) => {
button.addEventListener('click', () => {
themeButtons.forEach((btn) => {
btn.classList.remove('header__theme-menu-button_active');
btn.removeAttribute('disabled');
});
if (
[...button.classList].includes('header__theme-menu-button_type_light')
) {
changeTheme('light');
} else if (
[...button.classList].includes('header__theme-menu-button_type_dark')
) {
changeTheme('dark');
} else {
changeTheme('auto');
}
button.classList.add('header__theme-menu-button_active');
button.setAttribute('disabled', true);
});
});

function changeTheme(theme) {
document.body.className = 'page';
document.body.classList.add(`theme_${theme}`);
localStorage.setItem('theme', theme);
}

function initTheme() {
const theme = localStorage.getItem('theme');
if (theme) {
changeTheme(theme);
themeButtons.forEach((btn) => {
btn.classList.remove('header__theme-menu-button_active');
btn.removeAttribute('disabled');
});
document
.querySelector(`.header__theme-menu-button_type_${theme}`)
.classList.add('header__theme-menu-button_active');
document
.querySelector(`.header__theme-menu-button_type_${theme}`)
.setAttribute('disabled', true);
}
}

initTheme();
12 changes: 12 additions & 0 deletions styles/dark.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
Специально для тёмной темы при наличии класса,
здесь окажутся стили, которые нужно переопределить принудительно,
переключая тему
*/

.page.theme_dark {
/* сохраните этот селектор в приведённом виде.
Так стили написанные ниже будут иметь больший вес,
чем стили в медиазапросе предпочтений пользователя
*/
}
42 changes: 42 additions & 0 deletions styles/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* Глобальные стили для проекта, их можно дополнять и менять по желанию */

*,
*::before,
*::after {
box-sizing: border-box;
}

body {
min-inline-size: 375px;
max-inline-size: 1440px;
margin: 0 auto;
}

h1,
h2,
h3,
h4,
h5,
h6,
p {
margin: 0;
}

ul {
margin: 0;
padding: 0;
list-style: none;
}

picture {
margin: 0;
padding: 0;
}

button,
a {
color: currentColor;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
12 changes: 12 additions & 0 deletions styles/light.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
Специально для светлой темы при наличии класса.
Здесь окажутся стили, которые нужно переопределить принудительно,
переключая тему
*/

.page.theme_light {
/* сохраните этот селектор в приведённом виде.
Так стили написанные ниже будут иметь больший вес,
чем стили в медиазапросе предпочтений пользователя
*/
}
5 changes: 5 additions & 0 deletions styles/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* Основные стили проекта. Это стили для темы, которую вы верстаете первой. */

.page {
/* сохраните в разметке и стилях класс page. На его основе работает скрипт. */
}
4 changes: 4 additions & 0 deletions styles/variables.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/*
Переменные для вашего проекта
и их переопределение под различные устройства
*/

0 comments on commit be706f6

Please sign in to comment.