Skip to content

Commit

Permalink
feat(ui): Implement workflow tags UI (#658)
Browse files Browse the repository at this point in the history
  • Loading branch information
daryllimyt authored Dec 24, 2024
1 parent be7f7e5 commit 4cb82f3
Show file tree
Hide file tree
Showing 7 changed files with 974 additions and 101 deletions.
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"next-themes": "^0.2.1",
"posthog-js": "^1.146.0",
"react": "^18.3.1",
"react-colorful": "^5.6.1",
"react-confetti-explosion": "^2.1.2",
"react-day-picker": "8.10.0",
"react-dom": "^18.3.1",
Expand Down
14 changes: 14 additions & 0 deletions frontend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions frontend/src/components/color-picker.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React, { useState } from "react"
import { HexColorPicker } from "react-colorful"

import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover"

export const ColorPicker = ({
value = "#aabbcc",
onChange,
showInput = false,
}: {
value: string
onChange: (color: string) => void
showInput?: boolean
}) => {
const [isOpen, setIsOpen] = useState(false)

return (
<div className="flex items-center gap-2">
<Popover open={isOpen} onOpenChange={setIsOpen}>
<PopoverTrigger asChild>
<button
className="size-6 rounded border border-gray-200 shadow-sm"
style={{ backgroundColor: value }}
aria-label="Pick a color"
/>
</PopoverTrigger>
<PopoverContent className="w-auto">
<HexColorPicker
color={value}
onChange={(color: string) => onChange?.(color)}
/>
</PopoverContent>
</Popover>
{showInput && <div className="text-sm text-gray-600">{value}</div>}
</div>
)
}
Loading

0 comments on commit 4cb82f3

Please sign in to comment.