Skip to content

Commit fbaa55b

Browse files
committed
fix color picker
1 parent b698bcf commit fbaa55b

File tree

3 files changed

+20
-30
lines changed

3 files changed

+20
-30
lines changed

src/App.tsx

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
import { useAtomValue } from "jotai";
21
import { DownloadIcon } from "lucide-react";
32
import Canvas from "./Canvas";
43
import Controls from "./Controls";
5-
import Expand from "./Expand";
6-
import { imageAtom } from "./atoms";
74

85
export default function App() {
9-
const image = useAtomValue(imageAtom);
10-
116
return (
127
<main className="container mx-auto max-w-md p-4 pt-6 flex flex-col gap-4 select-none">
138
<header>
@@ -17,15 +12,13 @@ export default function App() {
1712
<Controls />
1813
<Canvas />
1914

20-
<Expand expanded={image != null}>
21-
<div className="flex gap-2">
22-
<DownloadIcon />
23-
<span>
24-
<b className="font-semibold">To save:</b> Touch and hold &gt;
25-
Save&nbsp;to&nbsp;Photos
26-
</span>
27-
</div>
28-
</Expand>
15+
<div className="flex gap-2">
16+
<DownloadIcon />
17+
<span>
18+
<b className="font-semibold">To save:</b> Touch and hold &gt;
19+
Save&nbsp;to&nbsp;Photos
20+
</span>
21+
</div>
2922

3023
<footer className="mt-auto text-sm text-slate-500 dark:text-slate-400 flex justify-between">
3124
<div>

src/CustomControls.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export default function CustomControls() {
8686
value={color}
8787
onChange={(e) => setColor(e.target.value)}
8888
aria-label="Color"
89-
className="block w-8 h-8"
89+
className="input shrink-0 w-8 h-8 box-content"
9090
/>
9191
</div>
9292

src/index.css

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@
3636

3737
@utility input-base {
3838
@apply rounded-lg;
39-
@apply block min-w-0 w-full grow py-1 pr-3 pl-1;
39+
@apply block min-w-0 w-full grow py-1 px-3;
4040
@apply caret-primary-500;
4141
@apply font-normal text-right;
4242
@apply bg-white dark:bg-slate-950;
4343
@apply inset-shadow-xs;
4444
@apply border-1 border-slate-300;
4545
@apply dark:border-1 dark:border-slate-700;
4646

47-
@apply focus:outline-offset-0;
4847
@apply focus:border-1 focus:border-primary-500;
48+
@apply focus:outline-3 focus:outline-offset-0 focus:outline-primary-500/30 dark:focus:outline-primary-400/50;
4949
}
5050

5151
@utility recessed {
@@ -120,21 +120,18 @@
120120
@apply font-medium;
121121
}
122122

123-
/* input[type="color" i] {
124-
@apply input-base;
125-
@apply p-0;
126-
} */
123+
input[type="color" i] {
124+
@apply p-0 overflow-hidden;
127125

128-
input[type="color" i]::-webkit-color-swatch-wrapper,
129-
input[type="color" i]::-moz-color-swatch-wrapper {
130-
@apply p-0;
131-
}
126+
&::-webkit-color-swatch-wrapper,
127+
&::-moz-color-swatch-wrapper {
128+
@apply p-0;
129+
}
132130

133-
input[type="color" i]::-webkit-color-swatch,
134-
input[type="color" i]::-moz-color-swatch {
135-
@apply rounded-lg aspect-square;
136-
@apply border-0;
137-
@apply inset-ring-1 inset-ring-slate-400/50;
131+
&::-webkit-color-swatch,
132+
&::-moz-color-swatch {
133+
@apply border-0;
134+
}
138135
}
139136

140137
.input {

0 commit comments

Comments
 (0)