|
| 1 | +import Link from 'next/link'; |
1 | 2 | import React, { useMemo } from 'react';
|
2 | 3 | import { BlockTitle } from '@/components/BlockTitle/BlockTitle';
|
| 4 | +import { Button } from '@/components/Button/Button'; |
3 | 5 | import { ContentBlock } from '@/components/ContentBlock/ContentBlock';
|
4 | 6 | import { formatDate } from '@/lib/date';
|
5 |
| -import { |
6 |
| - HeadingWrapper, |
7 |
| - MeetupButton, |
8 |
| - MeetupListWrapper, |
9 |
| - MeetupWrapper, |
10 |
| - MeetupTitle, |
11 |
| - Person, |
12 |
| - PersonWrapper, |
13 |
| - PersonTitle, |
14 |
| -} from './styled'; |
| 7 | +import styles from './styles.module.css'; |
15 | 8 | import { BlockMeetupsProps, MeetupListProps, BlockMeetupProps } from './types';
|
16 | 9 |
|
17 | 10 | const MeetupBlock = ({ event }: BlockMeetupProps) => {
|
18 | 11 | const { day, month, year } = useMemo(() => formatDate(event.date), [event.date]);
|
19 | 12 | return (
|
20 |
| - <MeetupWrapper href={`meetups/${event.id}`}> |
21 |
| - <MeetupTitle>{event.title}</MeetupTitle> |
| 13 | + <Link className={styles['blockMeetups-item']} href={`meetups/${event.id}`}> |
| 14 | + <h3 className={styles['blockMeetups-itemTitle']}>{event.title}</h3> |
22 | 15 |
|
23 | 16 | <time dateTime={`${year}-${month}-${day}`}>
|
24 | 17 | {day} {month} {year}
|
25 | 18 | </time>
|
26 | 19 |
|
27 |
| - <PersonTitle>Участники:</PersonTitle> |
| 20 | + <div className={styles['blockMeetups-itemPersonTitle']}>Участники:</div> |
28 | 21 | {event.talks.map((talk, index) => (
|
29 |
| - <PersonWrapper key={index}> |
| 22 | + <div className={styles['blockMeetups-itemPersonWrapper']} key={index}> |
30 | 23 | {talk.persons.map((person, key) => (
|
31 |
| - !!person?.photo && <Person |
| 24 | + !!person?.photo && <img |
| 25 | + className={styles['blockMeetups-itemPersonPortrait']} |
32 | 26 | src={person.photo.file.url}
|
33 | 27 | alt={`${person.name} ${person.lastname}`}
|
34 | 28 | title={`${person.name} ${person.lastname}`}
|
35 | 29 | key={key}
|
36 | 30 | />
|
37 | 31 | ))}
|
38 |
| - </PersonWrapper> |
| 32 | + </div> |
39 | 33 | ))}
|
40 |
| - </MeetupWrapper> |
| 34 | + </Link> |
41 | 35 | );
|
42 | 36 | };
|
43 | 37 | export const MeetupList = ({ events }: MeetupListProps) => (
|
44 |
| - <MeetupListWrapper> |
| 38 | + <div className={styles['blockMeetups-list']}> |
45 | 39 | {events.map((event, i) => (
|
46 | 40 | <MeetupBlock event={event} key={i} />
|
47 | 41 | ))}
|
48 |
| - </MeetupListWrapper> |
| 42 | + </div> |
49 | 43 | );
|
50 | 44 |
|
51 | 45 | export const BlockMeetups = (props: BlockMeetupsProps) => (
|
52 | 46 | <section>
|
53 | 47 | <ContentBlock>
|
54 |
| - <HeadingWrapper> |
| 48 | + <div className={styles['blockMeetups-headingWrapper']}> |
55 | 49 | <BlockTitle>Митапы</BlockTitle>
|
56 |
| - <MeetupButton |
| 50 | + <Button |
| 51 | + className={styles['blockMeetups-button']} |
57 | 52 | href="/meetups"
|
58 | 53 | variant="contained"
|
59 | 54 | type="primary"
|
60 | 55 | title="Смотреть все митапы">
|
61 | 56 | Смотреть все
|
62 |
| - </MeetupButton> |
63 |
| - </HeadingWrapper> |
| 57 | + </Button> |
| 58 | + </div> |
64 | 59 |
|
65 | 60 | <MeetupList events={props.events} />
|
66 | 61 | </ContentBlock>
|
|
0 commit comments