Skip to content

Instantly share code, notes, and snippets.

View o0's full-sized avatar
🎯
Focusing

Igor Alexeenko o0

🎯
Focusing
View GitHub Profile
// get All forms
const filtersForms = document.querySelectorAll(`.filter-form`);
// Create all filters
const filterByType = (type, arr) => arr.filter((car) => car.characteristics.type === type || type === `car-type-any`);
const filterByPower = (power, arr) => arr.filter((car) => car.characteristics.power >= +power || power === `power-all`);
const filterByFuel = (fuel, arr) => arr.filter((car) => car.characteristics.engine === fuel || fuel === `fuel-all`);
const filterByPrice = (price, arr) => arr.filter((car) => car.minPrice >= price);
const filterByClass = (carClass, arr) => arr.filter((car) => car.class === carClass);
const addState = (initialState, newState) => {
return initialState | newState;
};
const removeState = (initialState, stateToRemove) => {
return ~initialState & stateToRemove;
};
const hasState = (initialState, stateToCheck) => {
return Boolean(initialState & stateToCheck);
@o0
o0 / 08-accordion-styles.css
Created May 5, 2020 14:36
Стили для аккордеона
.Accordion-trigger {
border: 0;
background: 0;
font: inherit;
}
.Accordion-trigger:focus {
box-shadow: 0 0 10px rgba(255, 128, 0, 0.5);
outline: 0;
}
@o0
o0 / 07-accordion-based-markdown.html
Last active May 30, 2020 10:46
Разметка страницы, адаптированная под стандартный компонент аккордеона
<html lang="ru" class="page">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./main.css">
<link rel="stylesheet" href="./accordion.css">
<meta property="og:type" content="website">
<meta property="og:title" content="OneBootcamp">
<meta property="og:site_name" content="Онлайн-буткемп по веб-разработке">
<meta property="og:site_url" content="https://onebootcamp.typeform.com/to/KqN0Ak">
@o0
o0 / 06-scroll-background.js
Last active May 5, 2020 14:24
Скрипт, который обновляет положение бэкграунда блока при прокрутке страницы
let sectionToAnimate = document.querySelector('.section_special');
window.addEventListener('scroll', function() {
sectionToAnimate.style.backgroundPosition = `-${document.body.scrollTop}px 0`;
});
@o0
o0 / 05-main-styles.css
Last active May 5, 2020 14:19
Стили основного контента страницы
/* Main content */
.section {
padding: 10px 30px;
}
.section_special {
background: repeating-linear-gradient(
-55deg,
#fff,
#fff 20px,
@o0
o0 / 1.5-page-classes.html
Last active May 5, 2020 14:05
Разметка страницы с классами для стилизации
<html lang="ru" class="page">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./main.css">
<meta property="og:type" content="website">
<meta property="og:title" content="OneBootcamp">
<meta property="og:site_name" content="Онлайн-буткемп по веб-разработке">
<meta property="og:site_url" content="https://onebootcamp.typeform.com/to/KqN0Ak">
<title>OneBootcamp</title>
@o0
o0 / 04-footer-styles.css
Created May 5, 2020 13:33
Стили для подвала страницы
@o0
o0 / 03-header-styles.css
Created May 5, 2020 13:29
Стили для заголовка страницы
/* Header */
.header {
border-bottom: solid 1px #eee;
padding: 30px;
}
.logo {
display: grid;
grid-template-columns: min-content 1fr;
}
@o0
o0 / 02-page-styles.css
Last active May 5, 2020 13:28
Стили для контейнера страницы
.page {
font: 18px sans-serif;
}
.page__body {
background: #fff;
box-shadow: 0 0 20px rgba(0, 128, 99, 0.5);
box-sizing: border-box;
margin: 0 auto;
max-width: 600px;