Skip to content

Commit

Permalink
fixx theme hook
Browse files Browse the repository at this point in the history
  • Loading branch information
amcdnl committed Jul 25, 2024
1 parent 06561c5 commit 4bc4297
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/data/DateFormat/DateFormat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export const DateFormat: FC<DateFormatProps> = ({
return () => clearTimeout(cur);
});

const theme: DateFormatTheme = useComponentTheme('dateFormat', customTheme);
const theme = useComponentTheme<DateFormatTheme>('dateFormat', customTheme);

if (!date) {
return <>{emptyMessage}</>;
Expand Down
10 changes: 4 additions & 6 deletions src/utils/Theme/hooks/useComponentTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ import { ReablocksTheme } from '@/utils/Theme/themes/theme';
* @param customTheme
* @returns theme object
*/
export const useComponentTheme = <
T extends keyof Partial<ReablocksTheme['components']>
>(
component: T,
customTheme?: ReablocksTheme['components'][T]
): ReablocksTheme['components'][T] => {
export const useComponentTheme = <T extends any>(
component: string,
customTheme?: T
): T => {
const context = useTheme();

if (customTheme) {
Expand Down
1 change: 0 additions & 1 deletion src/utils/Theme/themes/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ export interface ReablocksTheme {
breadcrumbs: BreadcrumbsTheme;
stepper: StepperTheme;
callout: CalloutTheme;
[key: string]: any;
};
}

Expand Down

0 comments on commit 4bc4297

Please sign in to comment.