optional asChild for colour picker trigger

This commit is contained in:
Oliver Bryan
2026-01-12 19:30:00 +00:00
parent 0a931ca47c
commit 5550030743
3 changed files with 15 additions and 5 deletions

View File

@@ -658,7 +658,7 @@ function OrganisationsDialog({
</div> </div>
{isAdmin && {isAdmin &&
(isCreatingStatus ? ( (isCreatingStatus ? (
<div className="flex flex-col gap-2"> <>
<div className="flex gap-2"> <div className="flex gap-2">
<Input <Input
value={newStatusName} value={newStatusName}
@@ -684,6 +684,8 @@ function OrganisationsDialog({
<ColourPicker <ColourPicker
colour={newStatusColour} colour={newStatusColour}
onChange={setNewStatusColour} onChange={setNewStatusColour}
asChild={false}
className="w-9 h-9"
/> />
<Button <Button
variant="outline" variant="outline"
@@ -702,7 +704,7 @@ function OrganisationsDialog({
{statusError} {statusError}
</p> </p>
)} )}
</div> </>
) : ( ) : (
<Button <Button
variant="outline" variant="outline"

View File

@@ -2,18 +2,27 @@ import { HexColorPicker } from "react-colorful";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input"; import { Input } from "@/components/ui/input";
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
import { cn } from "@/lib/utils";
export default function ColourPicker({ export default function ColourPicker({
colour, colour,
onChange, onChange,
asChild = true,
className,
}: { }: {
colour: string; colour: string;
onChange: (value: string) => void; onChange: (value: string) => void;
asChild?: boolean;
className?: string;
}) { }) {
return ( return (
<Popover> <Popover>
<PopoverTrigger asChild> <PopoverTrigger asChild={asChild}>
<Button type="button" className="w-8 h-8" style={{ backgroundColor: colour }} /> <Button
type="button"
className={cn("w-8 h-8", className)}
style={{ backgroundColor: colour }}
/>
</PopoverTrigger> </PopoverTrigger>
<PopoverContent className="w-fit grid gap-2 p-2" align="start" side={"top"}> <PopoverContent className="w-fit grid gap-2 p-2" align="start" side={"top"}>
<HexColorPicker color={colour} onChange={onChange} className="p-0 m-0" /> <HexColorPicker color={colour} onChange={onChange} className="p-0 m-0" />

View File

@@ -1,6 +1,5 @@
# HIGH PRIORITY # HIGH PRIORITY
- fix colour picker alignment in new status form
- projects - projects
- project management menu (will this be accessed from the organisations-dialog? or will it be a separate menu in the user select) - project management menu (will this be accessed from the organisations-dialog? or will it be a separate menu in the user select)
- sprints - sprints