-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui): Implement workflow tags UI (#658)
- Loading branch information
1 parent
be7f7e5
commit 4cb82f3
Showing
7 changed files
with
974 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
) | ||
} |
Oops, something went wrong.