resume
57 строк · 2.0 Кб
1import { Component, For } from 'solid-js';
2import { Text, useTheme } from '@uikit';
3import { createThemeInvoker } from '@shared/themeInvoker';
4import { Education } from '@shared/data';
5import { format } from 'date-fns';
6import styles from './EducationList.module.sass';
7import { Theme } from '../../types/theme';
8
9type EducationListProps = {
10data: Education[];
11theme?: Theme;
12};
13
14const programmListPeriodThemeInvoker = createThemeInvoker(styles, 'ProgrammList__period');
15
16const EducationList: Component<EducationListProps> = (props) => {
17const { globalTheme } = useTheme();
18const theme = () => props.theme ?? globalTheme() ?? Theme.LIGHT;
19
20return (
21<ul class={styles.EducationList}>
22<For each={props.data.reverse()}>{(education) => (
23<li class={styles.EducationList__item}>
24<h3 class={styles.EducationList__institution}>
25{education.institution.name}
26</h3>
27<ul class={styles.ProgrammList}>
28<For each={education.education.reverse()}>{(programm) => (
29<li class={styles.ProgrammList__item}>
30<Text
31classList={{
32[styles.ProgrammList__period]: true,
33[programmListPeriodThemeInvoker[theme()]]: true,
34}}
35>
36<time>{format(programm.startDate, 'yyyy')}</time> –{' '}
37<time>{format(programm.endDate, 'yyyy')}</time>
38</Text>
39<div>
40<h4 class={styles.ProgrammList__degree}>{programm.degree}</h4>
41<Text class={styles.ProgrammList__faculty}>
42{programm.faculty?.name},
43</Text>
44<Text class={styles.ProgrammList__speciality}>
45{programm.speciality}.
46</Text>
47</div>
48</li>
49)}</For>
50</ul>
51</li>
52)}</For>
53</ul>
54);
55};
56
57export default EducationList;
58