diff options
Diffstat (limited to 'components/tag.tsx')
| -rw-r--r-- | components/tag.tsx | 24 | 
1 files changed, 24 insertions, 0 deletions
| diff --git a/components/tag.tsx b/components/tag.tsx new file mode 100644 index 0000000..6cacb89 --- /dev/null +++ b/components/tag.tsx @@ -0,0 +1,24 @@ +import { CSSProperties } from 'react'; + +export default function Tags(props: { +	tags: Array<string>; +}) { +	return <div className="tags"> +		<span>Tags:</span> +		{props.tags.map(tag => <Tag name={tag}/>)} +	</div> +} + +export function Tag(props: { +	name: string; +}) { +	return <a className="tag" href={"/search?tag=" + props.name} style={{ +		"--tag-hue": props.name +			.split("") +			.map(char => char.charCodeAt(0)) +			.reduce((a, b) => a + b) +			% 360 +	} as CSSProperties}> +		{props.name} +	</a> +} |