oxen-website/components/TagBlock.tsx

30 lines
758 B
TypeScript
Raw Normal View History

2021-02-08 07:37:50 +01:00
import React from 'react';
2022-03-03 07:23:18 +01:00
import classNames from 'classnames';
2021-02-08 07:37:50 +01:00
interface Props {
tag: string;
2021-02-11 06:26:56 +01:00
size?: 'small' | 'medium' | 'large';
2021-09-15 06:08:23 +02:00
classes?: string;
2021-02-08 07:37:50 +01:00
}
export function TagBlock(props: Props) {
2021-09-15 06:08:23 +02:00
const { tag, size = 'small', classes } = props;
2022-03-03 07:23:18 +01:00
const href = `/tag/${tag}`;
2021-02-08 07:37:50 +01:00
return (
<a
href={href}
2021-02-11 06:26:56 +01:00
style={{ width: 'min-content' }}
2021-02-08 07:37:50 +01:00
className={classNames(
2021-02-18 04:07:53 +01:00
'flex items-center cursor-pointer rounded-full whitespace-nowrap border border-secondary bg-secondary bg-opacity-25 text-primary font-thin',
2021-02-11 06:26:56 +01:00
size === 'small' && 'h-4 text-xs',
size === 'medium' && 'h-5 text-sm',
size === 'medium' && 'h-6 text-base',
2021-09-15 06:08:23 +02:00
classes,
2021-02-08 07:37:50 +01:00
)}
>
2022-03-03 07:23:18 +01:00
<span className="px-2">{tag}</span>
2021-02-08 07:37:50 +01:00
</a>
);
}