mirror of
https://github.com/hex248/sprint.git
synced 2026-02-08 18:33:01 +00:00
select sprint
This commit is contained in:
46
packages/frontend/src/components/sprint-select.tsx
Normal file
46
packages/frontend/src/components/sprint-select.tsx
Normal file
@@ -0,0 +1,46 @@
|
||||
import type { SprintRecord, UserRecord } from "@issue/shared";
|
||||
import { useState } from "react";
|
||||
import SmallSprintDisplay from "@/components/small-sprint-display";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
|
||||
export function SprintSelect({
|
||||
sprints,
|
||||
value,
|
||||
onChange,
|
||||
placeholder = "Select sprint",
|
||||
}: {
|
||||
sprints: SprintRecord[];
|
||||
value: string;
|
||||
onChange: (value: string) => void;
|
||||
fallbackUser?: UserRecord | null;
|
||||
placeholder?: string;
|
||||
}) {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<Select value={value} onValueChange={onChange} onOpenChange={setIsOpen}>
|
||||
<SelectTrigger
|
||||
className="group w-auto flex items-center -mt-1"
|
||||
variant="unstyled"
|
||||
chevronClassName="hidden"
|
||||
isOpen={isOpen}
|
||||
>
|
||||
<SelectValue placeholder={placeholder} className="hover:opacity-85" />
|
||||
</SelectTrigger>
|
||||
<SelectContent
|
||||
side="bottom"
|
||||
position="popper"
|
||||
className="data-[side=bottom]:translate-y-1 data-[side=bottom]:translate-x-1"
|
||||
>
|
||||
<SelectItem value="unassigned">
|
||||
<SmallSprintDisplay />
|
||||
</SelectItem>
|
||||
{sprints.map((sprint) => (
|
||||
<SelectItem key={sprint.id} value={sprint.id.toString()}>
|
||||
<SmallSprintDisplay sprint={sprint} />
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user