-
Notifications
You must be signed in to change notification settings - Fork 326
Expand file tree
/
Copy pathTag.tsx
More file actions
52 lines (47 loc) · 1.02 KB
/
Tag.tsx
File metadata and controls
52 lines (47 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/
import cn from 'classnames';
import type {RouteTag} from './Layout/getRouteMeta';
const variantMap = {
foundation: {
name: 'Fundamentos',
classes: 'bg-yellow-50 text-white',
},
intermediate: {
name: 'Intermediário',
classes: 'bg-purple-40 text-white',
},
advanced: {
name: 'Avançado',
classes: 'bg-green-40 text-white',
},
experimental: {
name: 'Experimental',
classes: 'bg-ui-orange text-white',
},
deprecated: {
name: 'Obsoleto',
classes: 'bg-red-40 text-white',
},
};
interface TagProps {
variant: RouteTag;
text?: string;
className?: string;
}
function Tag({text, variant, className}: TagProps) {
const {name, classes} = variantMap[variant];
return (
<span className={cn('me-2', className)}>
<span
className={cn(
'inline font-bold text-sm uppercase py-1 px-2 rounded',
classes
)}>
{text || name}
</span>
</span>
);
}
export default Tag;