2021-06-19 10:29:04 -04:00
|
|
|
import styled, { css } from "styled-components";
|
|
|
|
import { Children } from "../../types/Preact";
|
2021-06-27 06:17:59 -04:00
|
|
|
import { Plus } from "@styled-icons/boxicons-regular";
|
2021-06-19 10:29:04 -04:00
|
|
|
|
|
|
|
const CategoryBase = styled.div<Pick<Props, 'variant'>>`
|
|
|
|
font-size: 12px;
|
|
|
|
font-weight: 700;
|
|
|
|
text-transform: uppercase;
|
|
|
|
|
|
|
|
margin-top: 4px;
|
2021-06-28 03:55:05 -04:00
|
|
|
padding: 6px 0;
|
2021-06-19 10:29:04 -04:00
|
|
|
margin-bottom: 4px;
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
flex-direction: row;
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
|
|
svg {
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
|
2021-06-28 03:55:05 -04:00
|
|
|
&:first-child {
|
|
|
|
margin-top: 0;
|
|
|
|
padding-top: 0;
|
|
|
|
}
|
|
|
|
|
2021-06-19 10:29:04 -04:00
|
|
|
${ props => props.variant === 'uniform' && css`
|
|
|
|
padding-top: 6px;
|
|
|
|
` }
|
|
|
|
`;
|
|
|
|
|
2021-07-04 10:53:06 -04:00
|
|
|
type Props = Omit<JSX.HTMLAttributes<HTMLDivElement>, 'children' | 'as' | 'action'> & {
|
2021-06-19 10:29:04 -04:00
|
|
|
text: Children;
|
|
|
|
action?: () => void;
|
|
|
|
variant?: 'default' | 'uniform';
|
|
|
|
}
|
|
|
|
|
|
|
|
export default function Category(props: Props) {
|
2021-07-02 04:41:37 -04:00
|
|
|
let { text, action, ...otherProps } = props;
|
|
|
|
|
2021-06-19 10:29:04 -04:00
|
|
|
return (
|
2021-07-02 04:41:37 -04:00
|
|
|
<CategoryBase {...otherProps}>
|
|
|
|
{text}
|
|
|
|
{action && (
|
|
|
|
<Plus size={16} onClick={action} />
|
2021-06-19 10:29:04 -04:00
|
|
|
)}
|
|
|
|
</CategoryBase>
|
|
|
|
);
|
|
|
|
};
|