Portal/rsconcept/frontend/src/features/rsform/components/BadgeGrammeme.tsx

36 lines
809 B
TypeScript
Raw Normal View History

2024-06-07 20:17:03 +03:00
import clsx from 'clsx';
2025-02-11 21:07:06 +03:00
import { APP_COLORS } from '@/styling/colors';
2024-06-07 20:17:03 +03:00
2025-02-11 21:07:06 +03:00
import { colorFgGrammeme } from '../colors';
2025-02-11 20:56:11 +03:00
import { labelGrammeme } from '../labels';
import { GramData } from '../models/language';
2024-06-07 20:17:03 +03:00
interface BadgeGrammemeProps {
/** Grammeme to display. */
2024-06-07 20:17:03 +03:00
grammeme: GramData;
}
/**
* Displays a badge with a grammeme tag.
*/
2025-02-19 23:29:45 +03:00
export function BadgeGrammeme({ grammeme }: BadgeGrammemeProps) {
2024-06-07 20:17:03 +03:00
return (
<div
className={clsx(
2025-01-23 19:41:31 +03:00
'min-w-[3rem]', //
2024-06-07 20:17:03 +03:00
'px-1',
'border rounded-md',
'text-sm font-medium text-center whitespace-nowrap'
)}
style={{
borderColor: colorFgGrammeme(grammeme),
color: colorFgGrammeme(grammeme),
backgroundColor: APP_COLORS.bgInput
2024-06-07 20:17:03 +03:00
}}
>
{labelGrammeme(grammeme)}
</div>
);
}