diff --git a/components/colorpicker/ColorPicker.stories.tsx b/components/colorpicker/ColorPicker.stories.tsx index 1130b3f..de8e4d4 100644 --- a/components/colorpicker/ColorPicker.stories.tsx +++ b/components/colorpicker/ColorPicker.stories.tsx @@ -17,5 +17,6 @@ type Story = StoryObj export const Default: Story = { args: { preColors: ["#4A90E2", "#FF6B6B", "#48D1CC", "#FFD700", "#9370DB", "#E17055", "#2ECC71", "#F39C12"], + title: "Pick a color", }, }; \ No newline at end of file diff --git a/components/colorpicker/ColorPicker.tsx b/components/colorpicker/ColorPicker.tsx index e491b0a..2706990 100644 --- a/components/colorpicker/ColorPicker.tsx +++ b/components/colorpicker/ColorPicker.tsx @@ -1,23 +1,31 @@ import React, {useEffect, useState} from "react"; +import { Seperator } from "../seperator/Seperator"; interface ColorPickerProps { initialColor?: string; onChange: (color: string) => void; preColors?: string[]; + title?: string; } -const ColorPicker: React.FC = ({ initialColor, preColors, onChange }) => { +const ColorPicker: React.FC = ({ initialColor, preColors, onChange, title }) => { const [color, setColor] = useState(initialColor || "#FFFFFF"); const handleColorChange = (e: React.ChangeEvent) => { setColor(e.target.value); - onChange(e.target.value); + onChange?.(e.target.value); }; return ( -
-
+
+ {title && +
+ {title} + +
+ } +
{preColors?.map((preColor) => ( = ({ initialColor, preColors, onCh ))}
-
- +
+ handleColorChange(e)} /> @@ -43,7 +51,7 @@ const ColorPicker: React.FC = ({ initialColor, preColors, onCh const ColorBox: React.FC<{ color: string, onClick: () => void }> = ({color, onClick}) => { return (
diff --git a/package.json b/package.json index 33357b6..53f8983 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@marraph/daisy", - "version": "1.0.141", + "version": "1.0.142", "description": "Daisy is a component library for the marraph organisation", "scripts": { "dev": "next dev", diff --git a/tailwind.config.ts b/tailwind.config.ts index 2516c04..92666fd 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -2,6 +2,7 @@ import type { Config } from "tailwindcss"; import colors = require("tailwindcss/colors"); const config: Config = { + darkMode: "selector", content: [ "./pages/**/*.{js,ts,jsx,tsx,mdx}", "./components/**/*.{js,ts,jsx,tsx,mdx}",