Rewrite styles to scss and use i respective components

This commit is contained in:
Max Karkowski
2020-07-17 08:44:02 +02:00
committed by Bastian
parent be0241674c
commit 73865eb209
94 changed files with 969 additions and 974 deletions

View File

@@ -0,0 +1,24 @@
import React, { MouseEventHandler } from 'react';
import classNames from 'classnames';
import './badge.scss';
type BadgeProps = {
onClick?: MouseEventHandler;
big?: boolean;
type: 'big' | 'all' | 'adopt' | 'trial' | 'assess' | 'hold' | 'empty';
};
export default function Badge({ onClick, big, type, children }: React.PropsWithChildren<BadgeProps>) {
const Comp = typeof onClick ? 'a' : 'span';
return (
<Comp
className={classNames('badge', `badge--${type}`, {
'badge--big': big === true,
})}
onClick={onClick}
href={Comp === 'a' ? '#' : undefined}
>
{children}
</Comp>
);
}