@ryanhelsing/ry-ui 1.0.10 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,126 +0,0 @@
1
- *,
2
- *::before,
3
- *::after {
4
- -moz-box-sizing: border-box;
5
- -webkit-box-sizing: border-box;
6
- box-sizing: border-box;
7
- }
8
-
9
- .all, .ring::before, .ring::after, .led::before, .led::after, .face::before, .face::after {
10
- content: "";
11
- display: block;
12
- position: absolute;
13
- }
14
-
15
- html,
16
- body {
17
- font-size: 100%;
18
- min-height: 100%;
19
- }
20
-
21
- body {
22
- background: #151917;
23
- background: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuMCIgeTE9IjAuMCIgeDI9IjEuMCIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzEyMTIxMiIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzFjMjExZiIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA==');
24
- background: -webkit-gradient(linear, 0% 0%, 100% 100%, color-stop(0%, #121212), color-stop(100%, #1c211f));
25
- background: -moz-linear-gradient(top left, #121212, #1c211f);
26
- background: -webkit-linear-gradient(top left, #121212, #1c211f);
27
- background: linear-gradient(to bottom right, #121212, #1c211f);
28
- }
29
-
30
- .ring {
31
- height: 14em;
32
- width: 14em;
33
- margin: 4em auto;
34
- position: relative;
35
- z-index: -5;
36
- -moz-border-radius: 7em;
37
- -webkit-border-radius: 7em;
38
- border-radius: 7em;
39
- background: #050505;
40
- background: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjAuMCIgeDI9IjAuNSIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzA1MDUwNSIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzA2MDYwOSIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA==');
41
- background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #050505), color-stop(100%, #060609));
42
- background: -moz-linear-gradient(top, #050505, #060609);
43
- background: -webkit-linear-gradient(top, #050505, #060609);
44
- background: linear-gradient(to bottom, #050505, #060609);
45
- }
46
-
47
- .led {
48
- height: 7em;
49
- width: 7em;
50
- position: absolute;
51
- top: 50%;
52
- z-index: -4;
53
- -moz-border-radius-bottomleft: 7em;
54
- -webkit-border-bottom-left-radius: 7em;
55
- border-bottom-left-radius: 7em;
56
- -moz-box-shadow: 0 0 2em #d7c6d4;
57
- -webkit-box-shadow: 0 0 2em #d7c6d4;
58
- box-shadow: 0 0 2em #d7c6d4;
59
- background-color: #d7c6d4;
60
- }
61
-
62
- .inner-glow {
63
- height: 6.72em;
64
- width: 6.72em;
65
- position: absolute;
66
- top: 50%;
67
- left: 0.3em;
68
- -moz-border-radius-bottomleft: 7em;
69
- -webkit-border-bottom-left-radius: 7em;
70
- border-bottom-left-radius: 7em;
71
- -moz-box-shadow: inset 0 0 2em rgba(215, 198, 212, 0.5), 0 0 2em rgba(215, 198, 212, 0.75);
72
- -webkit-box-shadow: inset 0 0 2em rgba(215, 198, 212, 0.5), 0 0 2em rgba(215, 198, 212, 0.75);
73
- box-shadow: inset 0 0 2em rgba(215, 198, 212, 0.5), 0 0 2em rgba(215, 198, 212, 0.75);
74
- background-color: transparent;
75
- }
76
-
77
- .face {
78
- height: 12.5em;
79
- width: 12.5em;
80
- position: absolute;
81
- top: 0.75em;
82
- left: 0.75em;
83
- -moz-border-radius: 6.5em;
84
- -webkit-border-radius: 6.5em;
85
- border-radius: 6.5em;
86
- background: #534b4d;
87
- background: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjAuMCIgeDI9IjAuNSIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzUzNGI0ZCIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzBiMDgwYyIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA==');
88
- background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #534b4d), color-stop(100%, #0b080c));
89
- background: -moz-linear-gradient(top, #534b4d, #0b080c);
90
- background: -webkit-linear-gradient(top, #534b4d, #0b080c);
91
- background: linear-gradient(to bottom, #534b4d, #0b080c);
92
- -moz-box-shadow: inset 1px -1px 10px rgba(215, 198, 212, 0.2);
93
- -webkit-box-shadow: inset 1px -1px 10px rgba(215, 198, 212, 0.2);
94
- box-shadow: inset 1px -1px 10px rgba(215, 198, 212, 0.2);
95
- }
96
- .face::before {
97
- height: 11.875em;
98
- width: 11.875em;
99
- top: 0.3125em;
100
- left: 0.3125em;
101
- -moz-border-radius: 6em;
102
- -webkit-border-radius: 6em;
103
- border-radius: 6em;
104
- background: #101312;
105
- background: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjEuMCIgeTE9IjAuMCIgeDI9IjAuMCIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzEwMTMxMiIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzE4MTExNCIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA==');
106
- background: -webkit-gradient(linear, 100% 0%, 0% 100%, color-stop(0%, #101312), color-stop(100%, #181114));
107
- background: -moz-linear-gradient(top right, #101312, #181114);
108
- background: -webkit-linear-gradient(top right, #101312, #181114);
109
- background: linear-gradient(to bottom left, #101312, #181114);
110
- }
111
- .face::after {
112
- height: 13.4375em;
113
- width: 13.4375em;
114
- top: -0.46875em;
115
- left: -0.46875em;
116
- z-index: -3;
117
- -moz-border-radius: 7em;
118
- -webkit-border-radius: 7em;
119
- border-radius: 7em;
120
- background: #171c1a;
121
- background: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjAuMCIgeDI9IjAuNSIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzE0MWYxYiIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzEzMTAxNCIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA==');
122
- background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #141f1b), color-stop(100%, #131014));
123
- background: -moz-linear-gradient(top, #141f1b, #131014);
124
- background: -webkit-linear-gradient(top, #141f1b, #131014);
125
- background: linear-gradient(to bottom, #141f1b, #131014);
126
- }
@@ -1,5 +0,0 @@
1
- <div class="ring">
2
- <div class="led"></div>
3
- <div class="inner-glow"></div>
4
- <div class="face"></div>
5
- </div>
@@ -1,161 +0,0 @@
1
- @import "compass/css3";
2
-
3
- *,
4
- *::before,
5
- *::after {
6
- @include box-sizing(border-box);
7
- }
8
-
9
- .all {
10
- // Required
11
- content: "";
12
- display: block;
13
- position: absolute;
14
- }
15
-
16
- html,
17
- body {
18
- font-size: 100%;
19
- min-height: 100%;
20
- }
21
-
22
- body {
23
- // Background
24
- background: hsl(150, 8, 9%);
25
-
26
- // Gradient
27
- @include background(linear-gradient(top left, hsl(0,0,7%), hsl(150,8,12%)));
28
- }
29
-
30
- .ring {
31
- // Dimensions
32
- height: 14em;
33
- width: 14em;
34
-
35
- // Positioning
36
- margin: 4em auto;
37
- position: relative;
38
- z-index: -5;
39
-
40
- // Border Radius
41
- @include border-radius(7em);
42
-
43
- // Background
44
- background: hsl(0,0,2%);
45
-
46
- // Gradient
47
- @include background(linear-gradient(top, hsl(0,0,2%), hsl(240,18,3%)));
48
-
49
- &::before, &::after {
50
- @extend .all;
51
- }
52
- }
53
-
54
- .led {
55
- // Dimensions
56
- height: 7em;
57
- width: 7em;
58
-
59
- // Positioning
60
- position: absolute;
61
- top: 50%;
62
- z-index: -4;
63
-
64
- // Border Radius
65
- @include border-bottom-left-radius(7em);
66
-
67
- // Box Shadow
68
- @include box-shadow(0 0 2em hsla(310,18,81%,1));
69
-
70
- // Background
71
- background-color: hsl(310,18,81%);
72
-
73
- &::before, &::after {
74
- @extend .all;
75
- }
76
- }
77
-
78
- .inner-glow {
79
- // Dimensions
80
- height: 6.72em;
81
- width: 6.72em;
82
-
83
- // Positioning
84
- position: absolute;
85
- top: 50%;
86
- left: 0.3em;
87
-
88
- // Border Radius
89
- @include border-bottom-left-radius(7em);
90
-
91
- // Box Shadow
92
- @include box-shadow(inset 0 0 2em hsla(310,18,81%,0.5),0 0 2em hsla(310,18,81%,0.75));
93
-
94
- // Background
95
- background-color: transparent;
96
- }
97
-
98
- .face {
99
- // Dimensions
100
- height: 12.5em;
101
- width: 12.5em;
102
-
103
- // Positioning
104
- position: absolute;
105
- top: 0.75em;
106
- left: 0.75em;
107
-
108
- // Border Radius
109
- @include border-radius(6.5em);
110
-
111
- // Background
112
- background: hsl(345,5,31%);
113
-
114
- // Gradient
115
- @include background(linear-gradient(top, hsl(345,5,31%), hsl(280,17,4%)));
116
-
117
- @include box-shadow(inset 1px -1px 10px hsla(310,17,81%,0.2));
118
-
119
- &::before, &::after {
120
- @extend .all;
121
- }
122
-
123
- &::before {
124
- // Dimensions
125
- height: 11.875em;
126
- width: 11.875em;
127
-
128
- // Positioning
129
- top: 0.3125em;
130
- left: 0.3125em;
131
-
132
- // Border Radius
133
- @include border-radius(6em);
134
-
135
- // Background
136
- background: hsl(150,9,7%);
137
-
138
- // Gradient
139
- @include background(linear-gradient(top right, hsl(150,9,7%), hsl(330,18,8%)));
140
- }
141
-
142
- &::after {
143
- // Dimensions
144
- height: 13.4375em;
145
- width: 13.4375em;
146
-
147
- // Positioning
148
- top: -0.46875em;
149
- left: -0.46875em;
150
- z-index: -3;
151
-
152
- // Border Radius
153
- @include border-radius(7em);
154
-
155
- // Background
156
- background: hsl(158,8,10%);
157
-
158
- // Gradient
159
- @include background(linear-gradient(top, hsl(158,22,10%), hsl(280,12,7%)));
160
- }
161
- }
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2026 Jon Kantner (https://codepen.io/jkantner/pen/JoPXzJJ)
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,7 +0,0 @@
1
- # LED Controls
2
-
3
- A Pen created on CodePen.
4
-
5
- Original URL: [https://codepen.io/jkantner/pen/JoPXzJJ](https://codepen.io/jkantner/pen/JoPXzJJ).
6
-
7
- iOS/iPadOS brightness and volume controls as grids of LED lights.
@@ -1,17 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
-
4
- <head>
5
- <meta charset="UTF-8">
6
- <title>LED Controls</title>
7
- <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"><link rel="stylesheet" href="./style.css">
8
-
9
- </head>
10
-
11
- <body>
12
- <div id="root"></div>
13
- <script type="module" src="./script.js"></script>
14
-
15
- </body>
16
-
17
- </html>
@@ -1,27 +0,0 @@
1
- import React, { StrictMode, useState } from "https://esm.sh/react";
2
- import { createRoot } from "https://esm.sh/react-dom/client";
3
- createRoot(document.getElementById("root")).render(React.createElement(StrictMode, null,
4
- React.createElement("main", null,
5
- React.createElement("div", { className: "grid" },
6
- React.createElement(LedControl, { icon: "sun", label: "Brightness", id: "brightness", name: "brightness", value: 30 }),
7
- React.createElement(LedControl, { icon: "audio", label: "Volume", id: "volume", name: "volume", value: 20 })))));
8
- function LedControl({ icon, label, id, name, value = 0 }) {
9
- const [val, setVal] = useState(value);
10
- const clipIncrements = 44;
11
- const clip = 1 - val / clipIncrements;
12
- const clipPercent = clip * 100;
13
- const clipA = {
14
- clipPath: `polygon(0 0,100% 0,100% ${clipPercent}%,0 ${clipPercent}%)`
15
- };
16
- const clipB = {
17
- clipPath: `polygon(0 ${clipPercent}%,100% ${clipPercent}%,100% 100%,0 100%)`
18
- };
19
- return (React.createElement("div", { className: "led-control" },
20
- React.createElement("div", { className: "led-control__layer-wrap" },
21
- React.createElement("div", { className: "led-control__layer", style: clipA },
22
- React.createElement("div", { className: `led-control__icon led-control__icon--${icon}` })),
23
- React.createElement("div", { className: "led-control__layer led-control__layer--inverted", style: clipB },
24
- React.createElement("div", { className: `led-control__icon led-control__icon--${icon}` }))),
25
- React.createElement("label", { className: "led-control__label", htmlFor: name }, label),
26
- React.createElement("input", { className: "led-control__input", type: "range", id: id, name: name, value: val, step: 1, min: 0, max: clipIncrements, onChange: e => setVal(+e.target.value) })));
27
- }
@@ -1,135 +0,0 @@
1
- * {
2
- border: 0;
3
- box-sizing: border-box;
4
- margin: 0;
5
- padding: 0;
6
- }
7
-
8
- :root {
9
- --hue: 223;
10
- --sat: 10%;
11
- --bg: hsl(var(--hue),var(--sat),30%);
12
- --fg: hsl(var(--hue),var(--sat),90%);
13
- font-size: 12px;
14
- }
15
-
16
- body,
17
- input {
18
- font: 1em/1.5 sans-serif;
19
- }
20
-
21
- body {
22
- background-color: var(--bg);
23
- color: var(--fg);
24
- display: flex;
25
- height: 100vh;
26
- }
27
-
28
- input {
29
- outline: transparent;
30
- -webkit-appearance: none;
31
- appearance: none;
32
- -webkit-tap-highlight-color: transparent;
33
- }
34
-
35
- main {
36
- display: flex;
37
- overflow-x: hidden;
38
- padding: 1.5em 0;
39
- width: 100vw;
40
- height: 100vh;
41
- }
42
-
43
- .grid {
44
- display: grid;
45
- gap: 1.5em;
46
- grid-template-columns: repeat(2, 1fr);
47
- margin: auto;
48
- }
49
-
50
- .led-control {
51
- margin: auto;
52
- position: relative;
53
- width: 10.5em;
54
- height: 22em;
55
- }
56
- .led-control__icon {
57
- color: #eee;
58
- bottom: 2.5em;
59
- left: 2.5em;
60
- width: 5.5em;
61
- height: 5.5em;
62
- }
63
- .led-control__icon, .led-control__icon:before {
64
- position: absolute;
65
- }
66
- .led-control__icon:before {
67
- border-radius: 50%;
68
- content: "";
69
- display: block;
70
- filter: drop-shadow(1px 1px var(--bg)) drop-shadow(-1px 0 var(--bg)) drop-shadow(0 -1px var(--bg));
71
- top: 0.0625em;
72
- left: 0.0625em;
73
- width: 0.375em;
74
- height: 0.375em;
75
- }
76
- .led-control__icon--audio:before {
77
- box-shadow: 2.5em 0.5em, 2em 1em, 2.5em 1em, 1.5em 1.5em, 2em 1.5em, 2.5em 1.5em, 4.5em 1.5em, 0.5em 2em, 1em 2em, 1.5em 2em, 2em 2em, 2.5em 2em, 4em 2em, 0.5em 2.5em, 1em 2.5em, 1.5em 2.5em, 2em 2.5em, 2.5em 2.5em, 4.5em 2.5em, 0.5em 3em, 1em 3em, 1.5em 3em, 2em 3em, 2.5em 3em, 4em 3em, 1.5em 3.5em, 2em 3.5em, 2.5em 3.5em, 4.5em 3.5em, 2em 4em, 2.5em 4em, 2.5em 4.5em;
78
- }
79
- .led-control__icon--sun:before {
80
- box-shadow: 2.5em 0em, 0.5em 0.5em, 2.5em 0.5em, 4.5em 0.5em, 1em 1em, 2em 1em, 2.5em 1em, 3em 1em, 4em 1em, 1.5em 1.5em, 3.5em 1.5em, 1em 2em, 4em 2em, 0em 2.5em, 0.5em 2.5em, 1em 2.5em, 4em 2.5em, 4.5em 2.5em, 5em 2.5em, 1em 3em, 4em 3em, 1.5em 3.5em, 3.5em 3.5em, 1em 4em, 2em 4em, 2.5em 4em, 3em 4em, 4em 4em, 0.5em 4.5em, 2.5em 4.5em, 4.5em 4.5em, 2.5em 5em;
81
- }
82
- .led-control__input, .led-control__label, .led-control__layer, .led-control__layer-wrap {
83
- position: absolute;
84
- }
85
- .led-control__input {
86
- background-color: transparent;
87
- box-shadow: 0 0 0 0.25em transparent;
88
- top: 50%;
89
- left: 50%;
90
- transform: translate(-50%, -50%) rotate(-90deg);
91
- width: 22em;
92
- height: 10.5em;
93
- }
94
- .led-control__input:focus-visible {
95
- box-shadow: 0 0 0 0.25em var(--fg);
96
- }
97
- .led-control__input::-webkit-slider-thumb {
98
- background-color: transparent;
99
- border: 0;
100
- border-radius: 0;
101
- box-shadow: none;
102
- cursor: pointer;
103
- width: 2.5em;
104
- height: 10.5em;
105
- -webkit-appearance: none;
106
- }
107
- .led-control__input::-moz-range-thumb {
108
- background-color: transparent;
109
- border: 0;
110
- border-radius: 0;
111
- box-shadow: none;
112
- cursor: pointer;
113
- width: 2.5em;
114
- height: 10.5em;
115
- }
116
- .led-control__label {
117
- overflow: hidden;
118
- width: 1px;
119
- height: 1px;
120
- }
121
- .led-control__layer {
122
- background: url("data:image/svg+xml,<svg viewBox='0 0 8 8' xmlns='http://www.w3.org/2000/svg'><circle fill='%23111' cx='4' cy='4' r='3' /></svg>") 0 0/0.5em 0.5em;
123
- }
124
- .led-control__layer, .led-control__layer-wrap {
125
- inset: 0;
126
- }
127
- .led-control__layer-wrap {
128
- clip-path: polygon(1em 0em, 9.5em 0em, 9.5em 0.5em, 10em 0.5em, 10em 1em, 10.5em 1em, 10.5em 21em, 10em 21em, 10em 21em, 10em 21.5em, 9.5em 21.5em, 9.5em 22em, 1em 22em, 1em 21.5em, 0.5em 21.5em, 0.5em 21em, 0em 21em, 0em 1em, 0.5em 1em, 0.5em 0.5em, 1em 0.5em);
129
- }
130
- .led-control__layer--inverted {
131
- background-image: url("data:image/svg+xml,<svg viewBox='0 0 8 8' xmlns='http://www.w3.org/2000/svg'><circle fill='%23eee' cx='4' cy='4' r='3' /></svg>");
132
- }
133
- .led-control__layer--inverted .led-control__icon {
134
- color: #111;
135
- }
@@ -1 +0,0 @@
1
- <div id="root"></div>
@@ -1,59 +0,0 @@
1
- import React, { StrictMode, useState } from "https://esm.sh/react";
2
- import { createRoot } from "https://esm.sh/react-dom/client";
3
-
4
- createRoot(document.getElementById("root")!).render(
5
- <StrictMode>
6
- <main>
7
- <div className="grid">
8
- <LedControl icon="sun" label="Brightness" id="brightness" name="brightness" value={30} />
9
- <LedControl icon="audio" label="Volume" id="volume" name="volume" value={20} />
10
- </div>
11
- </main>
12
- </StrictMode>
13
- );
14
-
15
- function LedControl({ icon, label, id, name, value = 0 }: LedControlProps) {
16
- const [val, setVal] = useState(value);
17
- const clipIncrements = 44;
18
- const clip = 1 - val / clipIncrements;
19
- const clipPercent = clip * 100;
20
- const clipA = {
21
- clipPath: `polygon(0 0,100% 0,100% ${clipPercent}%,0 ${clipPercent}%)`
22
- };
23
- const clipB = {
24
- clipPath: `polygon(0 ${clipPercent}%,100% ${clipPercent}%,100% 100%,0 100%)`
25
- };
26
-
27
- return (
28
- <div className="led-control">
29
- <div className="led-control__layer-wrap">
30
- <div className="led-control__layer" style={clipA}>
31
- <div className={`led-control__icon led-control__icon--${icon}`}></div>
32
- </div>
33
- <div className="led-control__layer led-control__layer--inverted" style={clipB}>
34
- <div className={`led-control__icon led-control__icon--${icon}`}></div>
35
- </div>
36
- </div>
37
- <label className="led-control__label" htmlFor={name}>{label}</label>
38
- <input
39
- className="led-control__input"
40
- type="range"
41
- id={id}
42
- name={name}
43
- value={val}
44
- step={1}
45
- min={0}
46
- max={clipIncrements}
47
- onChange={e => setVal(+e.target.value)}
48
- />
49
- </div>
50
- );
51
- }
52
-
53
- type LedControlProps = {
54
- icon: string;
55
- label: string;
56
- id: string;
57
- name: string;
58
- value?: number;
59
- };