Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Добавляет статью про стилизацию чекбокса #5413

Merged
merged 25 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
9df805c
Добавляет статью про стилизацию чекбокса
loonlylokly Jun 30, 2024
03902b9
Исправляет очепятки
loonlylokly Jun 30, 2024
8dea476
Добавляет предложенные изменения и меняет раздел
loonlylokly Jul 5, 2024
2b1a98c
Добавляет радиокнопку в статью и исправляет дэмки
loonlylokly Jul 6, 2024
6bd3820
Чистит текст "На практике"
loonlylokly Jul 6, 2024
0c19f01
Дописывает про focus-visible и подгоняет высоту iframe-ов
loonlylokly Jul 6, 2024
54c0f02
Добавляет fieldset и legend, уточняет про доступность, выпендривается…
loonlylokly Jul 8, 2024
51788a1
Добавил про aria-disabled и добавил в дэмках aria-hidden, переименова…
loonlylokly Jul 9, 2024
4c00213
Причёсывает демки
skorobaeus Jul 9, 2024
79daef0
Редачит текст
skorobaeus Jul 9, 2024
c6a96b3
Merge branch 'doka-guide:main' into checkbox-style
loonlylokly Jul 9, 2024
158164a
Переименовывает демки
loonlylokly Jul 9, 2024
4b88b56
Синхронизует тайтлы
skorobaeus Jul 10, 2024
9cf70ec
Правит демки, исправляет цвет, добавляет про понятный дизайн
loonlylokly Jul 10, 2024
e5fc633
Вычитывает, форматирует и редачит
TatianaFokina Jul 16, 2024
ca53cad
Улучшает демку с accent-color
TatianaFokina Jul 16, 2024
c8cc9ea
Улучшает демку с гав
TatianaFokina Jul 16, 2024
40f0416
Улучшает демку с псевдо
TatianaFokina Jul 16, 2024
c972aae
Форматирует инлайновые SVG в примерах
TatianaFokina Jul 16, 2024
5d17f2c
Исправляет работоспособность кода из статьи и исправляет цвет бордера
loonlylokly Jul 16, 2024
3be255e
Добавляет рецепт в индекс раздела
solarrust Jul 19, 2024
eea1d86
Чуть-чуть правит демки
solarrust Jul 19, 2024
1df98e7
Меняет альт аватарки
loonlylokly Jul 19, 2024
6dd2865
Форматирует пример
TatianaFokina Jul 22, 2024
aaf084d
Сдаётся
TatianaFokina Jul 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions css/checkbox-style/demos/checkbox1/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<title>Стилизация чекбокса</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Roboto&display=swap"
/>
<style>
*,
*:after,
*:befor {
box-sizing: border-box;
}

body {
display: flex;
justify-content: center;
color: white;
padding-top: 10px;
background: #18191c;
font-family: Roboto, system-ui;
}

input[type="checkbox"] {
accent-color: #f498ad;
width: 20px;
height: 20px;
}
</style>
</head>
<body>
<form>
<div>
<input type="checkbox" id="checkbox1" />
<label for="checkbox1">Чекбокс 1</label>
</div>
<div>
<input type="checkbox" id="checkbox1-d-c" disabled checked />
<label for="checkbox1-d-c">Чекбокс 1 Дизейбл Отмечен</label>
</div>
<div>
<input type="checkbox" id="checkbox1-d-u" disabled />
<label for="checkbox1-d-u">Чекбокс 1 Дизейбл</label>
</div>
</form>
</body>
</html>
108 changes: 108 additions & 0 deletions css/checkbox-style/demos/checkbox2/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<title>Стилизация чекбокса</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Roboto&display=swap"
/>
<style>
*,
*:after,
*:befor {
box-sizing: border-box;
}

body {
padding-top: 10px;
display: flex;
justify-content: center;
color: white;
background: #18191c;
font-family: Roboto, system-ui;
}

.checkbox {
margin-left: 20px;
width: fit-content;
display: flex;
justify-content: center;
align-items: center;
}

.checkbox-label {
padding-left: 5px;
}

.checkbox-input {
appearance: none;
position: relative;
width: 30px;
height: 30px;
background: #f498ad;
box-shadow: inset 0 0 5px rgb(0, 0, 0, 0.2);
border-radius: 10px;
border: 1px solid white;
transition: 500ms;
}

.checkbox-input:after {
content: "";
position: absolute;
width: 0px;
height: 0px;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='30px' viewBox='0 -960 960 960' width='30px' stroke='%232E9AFF' stroke-width='30' fill='%232E9AFF'%3E%3Cpath d='M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z'/%3E%3C/svg%3E");
background-repeat: no-repeat;
transition: 500ms;
}

.checkbox-input:checked:after {
width: 30px;
height: 30px;
transition: 500ms;
}

.checkbox-input:disabled {
background: #ccc;
border-color: #ccc;
}

.checkbox-input:disabled:after {
filter: grayscale(100%);
}
</style>
</head>
<body>
<form>
<div class="checkbox">
<input class="checkbox-input" type="checkbox" id="checkbox2" />
<label class="checkbox-label" for="checkbox2">Чекбокс 2</label>
</div>
<div class="checkbox">
<input
class="checkbox-input"
type="checkbox"
id="checkbox2-d"
disabled
checked
/>
<label class="checkbox-label" for="checkbox2-d"
>Чекбокс Дизейбл Отмечен</label
>
</div>
<div class="checkbox">
<input
class="checkbox-input"
type="checkbox"
id="checkbox2-d"
disabled
/>
<label class="checkbox-label" for="checkbox2-d">Чекбокс Дизейбл</label>
</div>
</form>
</body>
</html>
169 changes: 169 additions & 0 deletions css/checkbox-style/demos/checkbox3/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<title>Стилизация чекбокса</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Roboto&display=swap"
/>
<style>
*,
*:after,
*:befor {
box-sizing: border-box;
}

body {
padding-top: 10px;
display: flex;
justify-content: center;
color: #ffffff;
background: #18191c;
font-family: Roboto, system-ui;
}

form {
display: grid;
gap: 20px;
}

.checkbox {
position: relative;
margin-left: 20px;
width: fit-content;
display: flex;
justify-content: center;
align-items: center;
}

.checkbox-input {
appearance: none;
position: relative;
width: 90px;
height: 40px;
border-radius: 20px;
border: 1px solid black;
}

.checkbox-label {
padding-left: 10px;
}

.checkbox-new {
position: absolute;
top: 0px;
left: 0px;
display: flex;
width: 90px;
height: 40px;
padding: 3px;
justify-content: center;
align-items: center;
border: 1px solid transparent;
border-radius: 20px;
user-select: none;
}

.checkbox-new_checked,
.checkbox-input:checked + .checkbox-new > .checkbox-new_unchecked {
display: none;
}

.checkbox-input:checked + .checkbox-new > .checkbox-new_checked,
.checkbox-input:not(:checked) + .checkbox-new > .checkbox-new_unchecked {
display: initial;
}

.checkbox-input:checked {
background: #f498ad;
}

.checkbox-input:checked + .checkbox-new {
color: #ffffff;
}

.checkbox-input:checked + .checkbox-new {
color: #000000;
}

.checkbox-input:disabled {
background: gray;
}
</style>
</head>
<body>
<form>
<label class="checkbox">
<input class="checkbox-input" type="checkbox" id="myCheckbox" />
<div class="checkbox-new">
<div class="checkbox-new_checked">
U
<span class="eye">•</span>
<span class="nose">ᴥ</span>
<span class="eye">•</span>U
</div>
<div class="checkbox-new_unchecked">
U
<span class="eye">ˇ</span>
<span class="nose">ᴥ</span>
<span class="eye">ˇ</span>U
</div>
</div>
<span class="checkbox-label">Гав!</span>
</label>

<label class="checkbox">
<input
class="checkbox-input"
type="checkbox"
id="myCheckbox"
disabled
/>
<div class="checkbox-new">
<div class="checkbox-new_checked">
U
<span class="eye">•</span>
<span class="nose">ᴥ</span>
<span class="eye">•</span>U
</div>
<div class="checkbox-new_unchecked">
U
<span class="eye">ˇ</span>
<span class="nose">ᴥ</span>
<span class="eye">ˇ</span>U
</div>
</div>
<span class="checkbox-label">Гав!</span>
</label>

<label class="checkbox">
<input
class="checkbox-input"
type="checkbox"
id="myCheckbox"
disabled
checked
/>
<div class="checkbox-new">
<div class="checkbox-new_checked">
U
<span class="eye">•</span>
<span class="nose">ᴥ</span>
<span class="eye">•</span>U
</div>
<div class="checkbox-new_unchecked">
U
<span class="eye">ˇ</span>
<span class="nose">ᴥ</span>
<span class="eye">ˇ</span>U
</div>
</div>
<span class="checkbox-label">Гав!</span>
</label>
</form>
</body>
</html>
3 changes: 3 additions & 0 deletions css/checkbox-style/images/check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading