Skip to content

Commit

Permalink
Merge pull request #20 from JulieSagan/radio
Browse files Browse the repository at this point in the history
Created radio buttons
  • Loading branch information
jsru-1 authored Jan 7, 2025
2 parents 3259cde + a21afe7 commit acc7148
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 8 deletions.
61 changes: 53 additions & 8 deletions 07-lection5/02-radio/index.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,56 @@
<!DOCTYPE html>
<!-- Страница радио -->
<html lang="ru">
<head>
<link rel="stylesheet" href="../../assets/css/main.css">
<link rel="stylesheet" href="./radio.css">
</head>
<body>

</body>
</html>

<head>
<link rel="stylesheet" href="../../assets/css/main.css">
<link rel="stylesheet" href="./radio.css">

<title>Radio</title>

<script src="https://unpkg.com/feather-icons"></script>
</head>

<body>
<div class="container">

<label class="radio">
<input class="radio__input" type="radio" name="radio" value="1">

<div class="radio__state">
<div class="radio__circle">
<i class="radio__icon" data-feather="circle"></i>
</div>
<p class="radio__title">Default</p>
</div>
</label>

<label class="radio">
<input class="radio__input" type="radio" name="radio" value="2" checked>

<div class="radio__state">
<div class="radio__circle">
<i class="radio__icon" data-feather="circle"></i>
</div>
<p class="radio__title">Selected</p>
</div>
</label>

<label class="radio">
<input class="radio__input" type="radio" name="radio" value="3" disabled>

<div class="radio__state">
<div class="radio__circle">
<i class="radio__icon" data-feather="circle"></i>
</div>
<p class="radio__title">Disabled</p>
</div>
</label>
</div>

<script>
feather.replace();
</script>
</body>

</html>
61 changes: 61 additions & 0 deletions 07-lection5/02-radio/radio.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
.radio {
display: inline-flex;
vertical-align: middle;
}

.radio__state {
display: flex;
align-items: center;
gap: 12px;
}

.radio__circle {
display: flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
border-radius: 50%;
border: 1px solid var(--grey-2, #DDE2E5);
}

.radio__icon {
display: none;
width: 18px;
height: 18px;
}

.radio__title {
color: var(--grey-4, #495057);
font-family: Inter, sans-serif;
font-size: 16px;
font-style: normal;
font-weight: 400;
line-height: 1.5;
}

.radio__input {
position: absolute;
left: -100vh;
}

.radio__input:checked ~ .radio__state .radio__circle {
border-color: var(--blue, #374FC7);
}

.radio__input:checked ~ .radio__state .radio__icon {
display: block;
color: var(--blue, #374FC7);
}

.radio__input:focus ~ .radio__state .radio__title {
text-decoration: underline;
}

.radio__input:disabled ~ .radio__state .radio__title {
color: var(--grey-2, #DDE2E5);
}

.radio__input:disabled ~ .radio__state .radio__circle {
background-color: var(--grey-2, #DDE2E5);
}

0 comments on commit acc7148

Please sign in to comment.