diff --git a/packages/frontend/src/App.css b/packages/frontend/src/App.css index b0cdb70..89dc3c0 100644 --- a/packages/frontend/src/App.css +++ b/packages/frontend/src/App.css @@ -1,3 +1,4 @@ +/** biome-ignore-all lint/complexity/noImportantStyles: */ @import "./fonts.css"; @import "tailwindcss"; @@ -161,3 +162,35 @@ -ms-user-select: none; user-select: none; } + +/* react-colorful */ +.react-colorful { + width: 150px !important; + height: 150px !important; +} + +.react-colorful__saturation { + border-radius: 0 !important; + /* cursor: pointer; */ +} + +.react-colorful__last-control { + border-radius: 0 !important; +} + +.react-colorful__saturation-pointer { + width: 16px !important; + height: 16px !important; + border: 1px solid white !important; +} + +.react-colorful__hue { + height: 10px !important; + cursor: pointer; +} + +.react-colorful__hue-pointer { + width: 16px !important; + height: 16px !important; + border: 1px solid white !important; +} diff --git a/packages/frontend/src/components/ui/colour-picker.tsx b/packages/frontend/src/components/ui/colour-picker.tsx new file mode 100644 index 0000000..d1573f4 --- /dev/null +++ b/packages/frontend/src/components/ui/colour-picker.tsx @@ -0,0 +1,34 @@ +import { HexColorPicker } from "react-colorful"; +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; +import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; + +export default function ColourPicker({ + colour, + onChange, +}: { + colour: string; + onChange: (value: string) => void; +}) { + return ( + + + + + + +
+ onChange(`#${e.target.value}`)} + spellCheck={false} + className="flex-1 border-transparent h-fit pl-0 mx-0" + maxLength={6} + showCounter={false} + showHashPrefix + /> +
+
+
+ ); +} diff --git a/packages/frontend/src/components/ui/input.tsx b/packages/frontend/src/components/ui/input.tsx index 6922fc5..0d920a9 100644 --- a/packages/frontend/src/components/ui/input.tsx +++ b/packages/frontend/src/components/ui/input.tsx @@ -1,13 +1,14 @@ +import { Hash } from "lucide-react"; import type * as React from "react"; - import { cn } from "@/lib/utils"; function Input({ className, type, showCounter = true, + showHashPrefix = false, ...props -}: React.ComponentProps<"input"> & { showCounter?: boolean }) { +}: React.ComponentProps<"input"> & { showCounter?: boolean; showHashPrefix?: boolean }) { const maxLength = typeof props.maxLength === "number" ? props.maxLength : undefined; const currentLength = typeof props.value === "string" ? props.value.length : undefined; @@ -22,6 +23,11 @@ function Input({ className, )} > + {showHashPrefix && ( + + + + )} diff --git a/packages/frontend/src/pages/Test.tsx b/packages/frontend/src/pages/Test.tsx index 6c3f38c..0e195dc 100644 --- a/packages/frontend/src/pages/Test.tsx +++ b/packages/frontend/src/pages/Test.tsx @@ -1,7 +1,11 @@ +import { useState } from "react"; import LogOutButton from "@/components/log-out-button"; import { Button } from "@/components/ui/button"; +import ColourPicker from "@/components/ui/colour-picker"; function Test() { + const [colour, setColour] = useState("#e05656"); + return (

Test

@@ -11,6 +15,8 @@ function Test() { + +
); }