glitch-soc/app/javascript/flavours/glitch/components/autosuggest_hashtag.tsx
Eugen Rochko 9c10aaa4d5 [Glitch] Change design of compose form in web UI
Port 6936e5aa69 to glitch-soc

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-02-22 23:06:12 +01:00

32 lines
706 B
TypeScript

import { ShortNumber } from 'flavours/glitch/components/short_number';
interface Props {
tag: {
name: string;
url?: string;
history?: {
uses: number;
accounts: string;
day: string;
}[];
following?: boolean;
type: 'hashtag';
};
}
export const AutosuggestHashtag: React.FC<Props> = ({ tag }) => (
<div className='autosuggest-hashtag'>
<div className='autosuggest-hashtag__name'>
#<strong>{tag.name}</strong>
</div>
{tag.history !== undefined && (
<div className='autosuggest-hashtag__uses'>
<ShortNumber
value={tag.history.reduce((total, day) => total + day.uses * 1, 0)}
/>
</div>
)}
</div>
);