Skip to content

Commit df3659c

Browse files
kantakshayDun-sin
andauthored
feat: better styling for thumb/track radius (#501)
Co-authored-by: Dunsin <[email protected]>
1 parent 3131204 commit df3659c

File tree

2 files changed

+109
-36
lines changed

2 files changed

+109
-36
lines changed

index.html

Lines changed: 48 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,46 +1193,58 @@ <h1>Input Range</h1>
11931193
</div>
11941194

11951195
<!-- Border Radius for Tracks and Thumbs -->
1196+
11961197
<div class="radius">
11971198
<label for="input-range-thumb-radius">
1198-
<input
1199-
type="checkbox"
1200-
id="input-range-thumb-radius"
1201-
name="check"
1202-
class="input-range-inputs"
1203-
/>
1204-
<span> Include Thumb Radius </span>
1205-
<label id="radius-input-label" for="input-range-thumb-input">
1206-
<input
1207-
type="number"
1208-
id="input-range-thumb-input"
1209-
name="desired-radius"
1210-
class="toggle-radius input-range-inputs"
1211-
placeholder="Enter a number e.g. 50"
1212-
autofocus
1213-
required
1214-
/>
1215-
</label>
1199+
<div class="input-range-container">
1200+
<div class="checkbox-title">
1201+
<input
1202+
type="checkbox"
1203+
id="input-range-thumb-radius"
1204+
name="check"
1205+
class="input-range-inputs circular-checkbox"
1206+
/>
1207+
1208+
<span> Include Thumb Radius </span>
1209+
</div>
1210+
1211+
<label id="radius-input-label" for="input-range-thumb-input">
1212+
<input
1213+
type="number"
1214+
id="input-range-thumb-input"
1215+
name="desired-radius"
1216+
class="toggle-radius input-range-inputs"
1217+
placeholder="Enter a number e.g. 50"
1218+
autofocus
1219+
required
1220+
/>
1221+
</label>
1222+
</div>
12161223
</label>
12171224
<label for="input-range-track-radius">
1218-
<input
1219-
type="checkbox"
1220-
id="input-range-track-radius"
1221-
name="check"
1222-
class="input-range-inputs"
1223-
/>
1224-
<span> Include Track Radius </span>
1225-
<label id="radius-input-label" for="input-range-track-input">
1226-
<input
1227-
type="number"
1228-
id="input-range-track-input"
1229-
name="desired-radius"
1230-
class="toggle-radius input-range-inputs"
1231-
placeholder="Enter a number e.g. 50"
1232-
autofocus
1233-
required
1234-
/>
1235-
</label>
1225+
<div class="input-range-container">
1226+
<div class="checkbox-title">
1227+
<input
1228+
type="checkbox"
1229+
id="input-range-track-radius"
1230+
name="check"
1231+
class="input-range-inputs circular-checkbox"
1232+
/>
1233+
1234+
<span> Include Track Radius </span>
1235+
</div>
1236+
<label id="radius-input-label" for="input-range-track-input">
1237+
<input
1238+
type="number"
1239+
id="input-range-track-input"
1240+
name="desired-radius"
1241+
class="toggle-radius input-range-inputs"
1242+
placeholder="Enter a number e.g. 50"
1243+
autofocus
1244+
required
1245+
/>
1246+
</label>
1247+
</div>
12361248
</label>
12371249
</div>
12381250

src/style.css

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,49 @@ input::placeholder {
525525
display: none;
526526
min-width: 0;
527527
}
528+
.track-input,
529+
.thumb-input {
530+
width: 80%;
531+
padding: 5px;
532+
}
533+
.input-range-container {
534+
display: flex;
535+
align-items: center;
536+
justify-content: space-between;
537+
padding: 5px;
538+
}
539+
.checkbox-title {
540+
display: flex;
541+
align-items: center;
542+
gap: 5px;
543+
}
544+
.circular-checkbox {
545+
width: 20px;
546+
height: 20px;
547+
border-radius: 50%;
548+
border: 2px solid #fff;
549+
appearance: none;
550+
outline: none;
551+
cursor: pointer;
552+
position: relative;
553+
}
554+
555+
/* Style for checked circular checkbox */
556+
.circular-checkbox:checked {
557+
background-color: var(--tertiary-color);
558+
}
559+
.circular-checkbox:checked::before {
560+
content: '\2713'; /* Unicode checkmark character */
561+
display: block;
562+
width: 100%;
563+
height: 100%;
564+
text-align: center;
565+
line-height: 1.4; /* Adjust line height for vertical centering */
566+
color: #fff; /* Color for the tick mark */
567+
position: absolute;
568+
top: 0;
569+
left: 0;
570+
}
528571

529572
#animation-duration,
530573
#gradient-border-input {
@@ -1263,3 +1306,21 @@ a {
12631306
margin-top: 50px;
12641307
}
12651308
}
1309+
@media screen and (max-width: 768px) {
1310+
.input-range-container {
1311+
display: flex;
1312+
flex-direction: row;
1313+
gap: 10px;
1314+
padding: 5px;
1315+
}
1316+
.track-input,
1317+
.thumb-input {
1318+
padding: 2px;
1319+
width: 60%;
1320+
}
1321+
.checkbox-title {
1322+
display: flex;
1323+
align-items: center;
1324+
gap: 5px;
1325+
}
1326+
}

0 commit comments

Comments
 (0)