From 6aa8c5c0ba2ef775520d1b17d1e39f0ffafd0077 Mon Sep 17 00:00:00 2001 From: Paul <paulmakles@gmail.com> Date: Fri, 2 Jul 2021 09:41:37 +0100 Subject: [PATCH] All class name to be set on category / overline. --- src/components/ui/Category.tsx | 12 +++++++----- src/components/ui/Overline.tsx | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/ui/Category.tsx b/src/components/ui/Category.tsx index 16c1444..ccdd4e9 100644 --- a/src/components/ui/Category.tsx +++ b/src/components/ui/Category.tsx @@ -31,18 +31,20 @@ const CategoryBase = styled.div<Pick<Props, 'variant'>>` ` } `; -interface Props { +type Props = Omit<JSX.HTMLAttributes<HTMLDivElement>, 'children' | 'as'> & { text: Children; action?: () => void; variant?: 'default' | 'uniform'; } export default function Category(props: Props) { + let { text, action, ...otherProps } = props; + return ( - <CategoryBase> - {props.text} - {props.action && ( - <Plus size={16} onClick={props.action} /> + <CategoryBase {...otherProps}> + {text} + {action && ( + <Plus size={16} onClick={action} /> )} </CategoryBase> ); diff --git a/src/components/ui/Overline.tsx b/src/components/ui/Overline.tsx index 8623369..5a9f9d0 100644 --- a/src/components/ui/Overline.tsx +++ b/src/components/ui/Overline.tsx @@ -2,7 +2,7 @@ import styled, { css } from "styled-components"; import { Children } from "../../types/Preact"; import { Text } from 'preact-i18n'; -interface Props { +type Props = Omit<JSX.HTMLAttributes<HTMLDivElement>, 'children' | 'as'> & { error?: string; block?: boolean; children?: Children; -- GitLab