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';
|
2025-02-20 20:22:05 +03:00
|
|
|
import { type GramData } from '../models/language';
|
2025-02-10 01:32:16 +03:00
|
|
|
|
2024-06-07 20:17:03 +03:00
|
|
|
interface BadgeGrammemeProps {
|
2024-11-21 15:09:31 +03:00
|
|
|
/** Grammeme to display. */
|
2024-06-07 20:17:03 +03:00
|
|
|
grammeme: GramData;
|
|
|
|
}
|
|
|
|
|
2024-11-21 15:09:31 +03:00
|
|
|
/**
|
|
|
|
* 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
|
2025-03-10 16:01:40 +03:00
|
|
|
className='min-w-12 px-1 border rounded-md text-sm font-medium text-center whitespace-nowrap'
|
2024-06-07 20:17:03 +03:00
|
|
|
style={{
|
2024-12-16 23:51:31 +03:00
|
|
|
borderColor: colorFgGrammeme(grammeme),
|
|
|
|
color: colorFgGrammeme(grammeme),
|
|
|
|
backgroundColor: APP_COLORS.bgInput
|
2024-06-07 20:17:03 +03:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
{labelGrammeme(grammeme)}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|