Skip to content

Commit 99b830d

Browse files
committed
Show an optional inline label
1 parent c4e4882 commit 99b830d

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

apps/webapp/app/components/primitives/DateTimePicker.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type DateTimePickerProps = {
1717
showSeconds?: boolean;
1818
showNowButton?: boolean;
1919
showClearButton?: boolean;
20+
showInlineLabel?: boolean;
2021
className?: string;
2122
};
2223

@@ -27,6 +28,7 @@ export function DateTimePicker({
2728
showSeconds = true,
2829
showNowButton = false,
2930
showClearButton = false,
31+
showInlineLabel = false,
3032
className,
3133
}: DateTimePickerProps) {
3234
const [open, setOpen] = React.useState(false);
@@ -74,12 +76,15 @@ export function DateTimePicker({
7476

7577
return (
7678
<div className={cn("flex items-center gap-2", className)}>
79+
{showInlineLabel && (
80+
<span className="w-6 shrink-0 text-right text-xxs text-text-dimmed">{label}</span>
81+
)}
7782
<Popover open={open} onOpenChange={setOpen}>
7883
<PopoverTrigger asChild>
7984
<button
8085
type="button"
8186
className={cn(
82-
"flex h-[1.8rem] items-center justify-between gap-2 whitespace-nowrap rounded border border-charcoal-600 bg-charcoal-750 px-2 text-xs tabular-nums transition hover:border-charcoal-500",
87+
"flex h-[1.8rem] w-full items-center justify-between gap-2 whitespace-nowrap rounded border border-charcoal-600 bg-charcoal-750 px-2 text-xs tabular-nums transition hover:border-charcoal-500",
8388
value ? "text-text-bright" : "text-text-dimmed"
8489
)}
8590
>

0 commit comments

Comments
 (0)