Skip to content

Commit

Permalink
feat: add icon props
Browse files Browse the repository at this point in the history
  • Loading branch information
walt-it committed Nov 29, 2024
1 parent 7785dc7 commit 3bb918f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
14 changes: 11 additions & 3 deletions src/shared/components/ui/Calendar/CalendarHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,23 @@ const calendarHeader = tv({

const { root, previous, next, heading } = calendarHeader();

export const CalendarHeader = () => {
interface CalendarHeaderProps {
prevIcon?: React.ReactNode;
nextIcon?: React.ReactNode;
}

export const CalendarHeader = ({
prevIcon = "◀",
nextIcon = "▶",
}: CalendarHeaderProps) => {
return (
<header className={root()}>
<Button className={previous()} slot='previous'>
{prevIcon}
</Button>
<Heading className={heading()} />
<Button className={next()} slot='next'>
{nextIcon}
</Button>
</header>
);
Expand Down
4 changes: 3 additions & 1 deletion src/shared/components/ui/DatePicker/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ interface DatePickerBaseProps<T extends DateValue>
label?: string;
description?: string;
errorMessage?: string;
triggerIcon?: React.ReactNode;
}

type DatePickerProps<
Expand All @@ -52,6 +53,7 @@ export const DatePicker = <T extends DateValue, U extends FieldValues>({
name,
control,
slot,
triggerIcon = "▼",
...props
}: DatePickerProps<T, U>) => {
const controller = useFieldController({ name, control });
Expand All @@ -77,7 +79,7 @@ export const DatePicker = <T extends DateValue, U extends FieldValues>({
/>
)}
</DateInput>
<Button className={classNames.trigger}></Button>
<Button className={classNames.trigger}>{triggerIcon}</Button>
</Group>

<FieldMessage description={description} error={errorMessage} />
Expand Down
4 changes: 3 additions & 1 deletion src/shared/components/ui/DateRangePicker/DateRangePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ interface DateRangePickerBaseProps<T extends DateValue>
label?: string;
description?: string;
errorMessage?: string;
triggerIcon?: React.ReactNode;
}

type DateRangePickerProps<
Expand All @@ -56,6 +57,7 @@ export const DateRangePicker = <T extends DateValue, U extends FieldValues>({
errorMessage,
control,
name,
triggerIcon = "▼",
...props
}: DateRangePickerProps<T, U>) => {
const controller = useFieldController({ name, control });
Expand Down Expand Up @@ -89,7 +91,7 @@ export const DateRangePicker = <T extends DateValue, U extends FieldValues>({
<DateSegment segment={segment} className={classNames.dateSegment} />
)}
</DateInput>
<Button></Button>
<Button>{triggerIcon}</Button>
</Group>

<FieldMessage description={description} error={errorMessage} />
Expand Down

0 comments on commit 3bb918f

Please sign in to comment.