-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2aa382a
commit 398dad4
Showing
2 changed files
with
111 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,52 @@ | ||
<!DOCTYPE html> | ||
<!-- Страница с кнопкой переключения --> | ||
<html lang="ru"> | ||
<head> | ||
<link rel="stylesheet" href="../../assets/css/main.css"> | ||
<link rel="stylesheet" href="./toggler.css"> | ||
</head> | ||
<body> | ||
|
||
</body> | ||
</html> | ||
|
||
<head> | ||
<link rel="stylesheet" href="../../assets/css/main.css"> | ||
<link rel="stylesheet" href="./toggler.css"> | ||
|
||
<title>Toggler</title> | ||
|
||
<script src="https://unpkg.com/feather-icons"></script> | ||
</head> | ||
|
||
<body> | ||
<div class="container"> | ||
<label class="toggler"> | ||
<input class="toggler__input" type="checkbox"> | ||
<div class="toggler__state"> | ||
<div class="toggler__control"> | ||
<i class="toggler__icon" data-feather="circle"></i> | ||
</div> | ||
<div class="toggler__label">Off</div> | ||
</div> | ||
</label> | ||
|
||
<label class="toggler"> | ||
<input class="toggler__input" type="checkbox" checked> | ||
<div class="toggler__state"> | ||
<div class="toggler__control"> | ||
<i class="toggler__icon" data-feather="circle"></i> | ||
</div> | ||
<div class="toggler__label">On</div> | ||
</div> | ||
</label> | ||
|
||
<label class="toggler"> | ||
<input class="toggler__input" type="checkbox" disabled> | ||
<div class="toggler__state"> | ||
<div class="toggler__control"> | ||
<i class="toggler__icon" data-feather="circle"></i> | ||
</div> | ||
<div class="toggler__label">Disabled</div> | ||
</div> | ||
</label> | ||
</div> | ||
|
||
<script> | ||
feather.replace(); | ||
</script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
.toggler { | ||
display: flex; | ||
flex-direction: column; | ||
position: relative; | ||
} | ||
|
||
.toggler__input { | ||
position: absolute; | ||
left: -100vh; | ||
} | ||
|
||
.toggler__state { | ||
display: flex; | ||
gap: 12px; | ||
align-items: center; | ||
} | ||
|
||
.toggler__control { | ||
display: flex; | ||
align-items: center; | ||
width: 52px; | ||
height: 28px; | ||
border: 1px solid var(--grey-2, #DDE2E5); | ||
border-radius: 16px; | ||
} | ||
|
||
.toggler__icon { | ||
color: var(--grey-2, #DDE2E5); | ||
} | ||
|
||
.toggler__label { | ||
color: var(--grey-4, #495057); | ||
font-family: Inter; | ||
font-size: 16px; | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: 1.5; | ||
} | ||
|
||
.toggler__input:checked ~ .toggler__state .toggler__control { | ||
border-color: var(--blue, #374FC7); | ||
background-color: var(--blue, #374FC7); | ||
justify-content: flex-end; | ||
} | ||
|
||
.toggler__input:checked ~ .toggler__state .toggler__icon { | ||
color: var(--white, #ffffff); | ||
justify-content: right; | ||
} | ||
|
||
.toggler__input:focus ~ .toggler__state .toggler__label { | ||
text-decoration: underline; | ||
} | ||
|
||
.toggler__input:disabled ~ .toggler__state .toggler__control { | ||
border-color: var(--grey-2, #DDE2E5); | ||
background-color: var(--grey-2, #DDE2E5); | ||
} | ||
|
||
.toggler__input:disabled ~ .toggler__state .toggler__icon { | ||
color: var(--grey-3, #ACB5BD); | ||
} |