-
Notifications
You must be signed in to change notification settings - Fork 292
Expand file tree
/
Copy pathSkillGrid.tsx
More file actions
76 lines (72 loc) · 1.98 KB
/
SkillGrid.tsx
File metadata and controls
76 lines (72 loc) · 1.98 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import type { ReactElement } from 'react';
import React from 'react';
import classNames from 'classnames';
import type { Skill } from '../types';
import { SkillCard } from './SkillCard';
import {
Typography,
TypographyTag,
TypographyType,
} from '../../../components/typography/Typography';
import { AddUserIcon, ArrowIcon, HotIcon } from '../../../components/icons';
import { IconSize } from '../../../components/Icon';
import {
Button,
ButtonSize,
ButtonVariant,
} from '../../../components/buttons/Button';
interface SkillGridProps {
title: string;
skills: Skill[];
className?: string;
icon?: 'trending' | 'recent';
}
const getIcon = (icon?: 'trending' | 'recent'): ReactElement | null => {
if (icon === 'trending') {
return (
<HotIcon size={IconSize.Medium} className="text-accent-cheese-default" />
);
}
if (icon === 'recent') {
return (
<AddUserIcon
size={IconSize.Medium}
className="text-accent-cabbage-default"
/>
);
}
return null;
};
export const SkillGrid = ({
title,
skills,
className,
icon,
}: SkillGridProps): ReactElement => {
const iconElement = getIcon(icon);
return (
<section className={classNames('flex flex-col gap-4', className)}>
<div className="flex items-center justify-between">
<div className="flex items-center gap-3">
{iconElement}
<Typography tag={TypographyTag.H2} type={TypographyType.Title3}>
{title}
</Typography>
</div>
<Button
variant={ButtonVariant.Tertiary}
size={ButtonSize.Small}
className="text-text-tertiary hover:text-text-primary"
>
View all
<ArrowIcon className="ml-1 rotate-90" size={IconSize.Size16} />
</Button>
</div>
<div className="grid grid-cols-1 gap-4 tablet:grid-cols-2 laptopXL:grid-cols-3">
{skills.map((skill) => (
<SkillCard key={skill.id} skill={skill} />
))}
</div>
</section>
);
};