Skip to content

Commit 67da5a6

Browse files
committed
feat: toggle_switch styling
1 parent 5f2ff7e commit 67da5a6

File tree

4 files changed

+57
-20
lines changed

4 files changed

+57
-20
lines changed
Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,56 @@
11
.ui.toggle-switch {
22
display: flex;
3-
align-items: center;
4-
padding: 0 12px;
5-
width: 64px;
6-
height: 32px;
7-
appearance: none;
8-
border: 1px solid;
3+
padding: 1px;
4+
width: 48px;
5+
height: 24px;
6+
border: 1px solid #3d444d;
97
border-radius: 6px;
10-
font-size: 14px;
11-
font-weight: 500;
8+
background-color: #2a313c;
9+
appearance: none;
10+
outline: none;
1211
cursor: pointer;
1312
user-select: none;
13+
overflow: hidden;
14+
transition: background-color 100ms ease-in-out;
1415

1516
&[class$='--active'] {
16-
background-color: #f6f8fa;
17-
box-shadow: 0px 1px 0px 0px #1f23280a;
18-
border-color: #d1d9e0;
19-
color: #25292e;
17+
background-color: #316dca;
18+
border-color: #316dca;
19+
20+
.toggle-switch__slider {
21+
transform: translateX(24px);
22+
background-color: #cdd9e5;
23+
border-color: #316dca;
24+
}
25+
}
26+
27+
.toggle-switch__slider {
28+
position: relative;
29+
display: block;
30+
height: 100%;
31+
aspect-ratio: 1;
32+
border-radius: 4px;
33+
border: 1px solid #3d444d;
34+
background-color: #151b23;
35+
transition: transform 100ms ease-in-out;
36+
37+
&::before,
38+
&::after {
39+
position: absolute;
40+
font-family: monospace;
41+
width: 23px;
42+
height: 100%;
43+
top: 5%;
44+
}
45+
46+
&::before {
47+
content: 'I';
48+
right: 100%;
49+
}
50+
51+
&::after {
52+
content: 'O';
53+
left: 100%;
54+
}
2055
}
2156
}

src/components/toggle_switch/toggle_switch.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ export function ToggleSwitch() : JSXElement {
1919
}}
2020
data-checked={state()}
2121
onClick={toggle}
22-
>
23-
{state() ? 'ON' : 'OFF'}
24-
</button>
22+
><div class='toggle-switch__slider'></div></button>
2523
);
2624
}

src/render/index.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@
77
color-scheme: dark;
88
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
99
}
10+
11+
body {
12+
padding: 100px;
13+
}

src/server/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { serveDir } from '@std/http/file-server';
33
const rootDirectory = './dist/';
44

55
Deno.serve(
6-
{ port: 8080 },
7-
(request) =>
8-
serveDir(request, {
9-
fsRoot: rootDirectory
10-
})
6+
{port: 8080},
7+
(request) => serveDir(
8+
request,
9+
{fsRoot: rootDirectory}
10+
)
1111
);

0 commit comments

Comments
 (0)