|
1 | 1 | import React from 'react';
|
2 | 2 | import styled from 'react-emotion';
|
| 3 | +import { space } from 'styled-system'; |
| 4 | +import { Flex, Box } from 'grid-emotion'; |
3 | 5 | import TimeIcon from 'react-icons/lib/md/access-time';
|
4 | 6 | import format from 'date-fns/format';
|
5 | 7 | import LocationIcon from 'react-icons/lib/md/location-on';
|
6 | 8 | import AttendeesIcon from 'react-icons/lib/md/people';
|
7 | 9 | import TicketIcon from 'react-icons/lib/md/exit-to-app';
|
8 | 10 | import StreamIcon from 'react-icons/lib/md/desktop-mac';
|
9 | 11 |
|
10 |
| -import { Button, graySecondary } from '../../utils/base.styles'; |
| 12 | +import { breakpoints, Button, graySecondary } from '../../utils/base.styles'; |
11 | 13 |
|
12 | 14 | const Card = styled.div`
|
13 |
| - display: flex; |
14 |
| - flex-direction: row; |
15 |
| - flex-wrap: wrap; |
16 |
| - max-height: 120px; |
17 |
| - justify-content: center; |
18 |
| - align-content: stretch; |
19 |
| - align-items: center; |
20 |
| - margin-top: 20px; |
| 15 | + ${space}; |
| 16 | + background: #fff; |
21 | 17 | border: 1px solid ${graySecondary};
|
22 |
| - & .photo { |
23 |
| - flex: 1 1 auto; |
24 |
| - align-self: auto; |
25 |
| - max-width: 180px; |
| 18 | + & .eventPhoto { |
| 19 | + width: 100%; |
| 20 | + height: 150px; |
| 21 | + vertical-align: middle; |
| 22 | + object-fit: cover; |
26 | 23 | }
|
27 |
| - & .content { |
28 |
| - flex: 3 1 auto; |
29 |
| - align-self: stretch; |
30 |
| - display: flex; |
31 |
| - flex-direction: column; |
32 |
| - flex-wrap: wrap; |
33 |
| - justify-content: center; |
34 |
| - align-content: stretch; |
35 |
| - align-items: flex-start; |
36 |
| - margin: 5px; |
37 |
| - & .title { |
38 |
| - order: 1; |
39 |
| - flex: 1.5 1 auto; |
40 |
| - align-self: flex-start; |
41 |
| - font-size: 1.2rem; |
42 |
| - vertical-align: top; |
43 |
| - font-weight: 400; |
44 |
| - } |
45 |
| - & .location { |
46 |
| - order: 2; |
47 |
| - flex: 1 1 auto; |
48 |
| - align-self: auto; |
49 |
| - font-size: 0.8rem; |
50 |
| - } |
51 |
| - & .info { |
52 |
| - order: 3; |
53 |
| - flex: 1 1 auto; |
54 |
| - align-self: auto; |
55 |
| - display: flex; |
56 |
| - width: 100%; |
57 |
| - font-size: 0.8rem; |
58 |
| - flex-direction: row; |
59 |
| - flex-wrap: nowrap; |
60 |
| - justify-content: flex-start; |
61 |
| - align-content: stretch; |
62 |
| - align-items: center; |
63 |
| - & .infotext { |
64 |
| - flex: 0 1 auto; |
65 |
| - align-self: auto; |
66 |
| - margin-right: 1rem; |
67 |
| - } |
68 |
| - & .rsvp { |
69 |
| - align-items: flex-end; |
70 |
| - flex: 1 1 auto; |
71 |
| - align-self: auto; |
72 |
| - text-align: right; |
73 |
| - } |
74 |
| - } |
75 |
| - & .icons{ |
76 |
| - font-size: 1rem; |
77 |
| - margin-right: 0.25rem; |
78 |
| - } |
| 24 | + & .title { |
| 25 | + font-size: 1rem; |
| 26 | + font-weight: 350; |
| 27 | + color: #000; |
| 28 | + border-bottom: 1px solid ${graySecondary}; |
| 29 | + ${breakpoints.xs} { |
| 30 | + font-size: 0.9rem; |
79 | 31 | }
|
80 | 32 | }
|
| 33 | + & .secondaryText { |
| 34 | + font-size: 0.8rem; |
| 35 | + color: #36434d; |
| 36 | + } |
| 37 | + & .icons { |
| 38 | + font-size: 1.2rem; |
| 39 | + margin-right: 0.25rem; |
| 40 | + color: #36434d; |
| 41 | + } |
| 42 | + & .rsvp { |
| 43 | + text-align: right; |
| 44 | + } |
81 | 45 | `;
|
82 | 46 |
|
83 | 47 | export default props => (
|
84 |
| - <Card> |
85 |
| - <img className="photo" src={props.image} /> |
86 |
| - <div className="content"> |
87 |
| - <div className="title">{props.name}</div> |
88 |
| - <div className="location"> |
89 |
| - <LocationIcon className="icons" /> |
90 |
| - {props.location} |
91 |
| - </div> |
92 |
| - <div className="info"> |
93 |
| - <div className="infotext"> |
94 |
| - <TimeIcon className="icons" /> |
95 |
| - {props.tense === 'past' ? format(props.time, "ddd MMM Do 'YY") : format(props.time, "h:mm A, ddd MMM Do 'YY")} |
96 |
| - </div> |
97 |
| - <div className="infotext"> |
98 |
| - <AttendeesIcon className="icons" /> |
99 |
| - {props.tense === 'past' ? `${props.attendees} attended` : `${props.attendees} attending`} |
100 |
| - </div> |
101 |
| - {props.tense === 'past' ? null : ( |
102 |
| - <div className="infotext"> |
103 |
| - {props.online ? <StreamIcon className="icons" /> : <TicketIcon className="icons" />} |
104 |
| - {props.online ? 'Free session' : 'Free entry'} |
105 |
| - </div> |
106 |
| - )} |
107 |
| - <div className="rsvp"> |
108 |
| - <Button href={props.link} ghost> |
109 |
| - {props.tense === 'past' ? 'View' : 'RSVP'} |
110 |
| - </Button> |
111 |
| - </div> |
112 |
| - </div> |
113 |
| - </div> |
| 48 | + <Card m={2}> |
| 49 | + <Flex wrap> |
| 50 | + <Box width={[1, 1 / 3, 1 / 4, 1 / 4]}> |
| 51 | + <img className="eventPhoto" src={props.image} /> |
| 52 | + </Box> |
| 53 | + <Box width={[1, 2 / 3, 3 / 4, 3 / 4]} pb={1} pt={1}> |
| 54 | + <Flex column justify={'space-between'} align={'stretch'}> |
| 55 | + <Box className="title" pr={1} pl={1}> |
| 56 | + {props.name} |
| 57 | + </Box> |
| 58 | + <Box className="secondaryText" pr={1} pl={1}> |
| 59 | + <LocationIcon className="icons" /> |
| 60 | + <span>{props.location}</span> |
| 61 | + </Box> |
| 62 | + <Box pr={1} pl={1}> |
| 63 | + <Flex wrap> |
| 64 | + <Box className="secondaryText" pr={1}> |
| 65 | + <TimeIcon className="icons" /> |
| 66 | + {props.tense === 'past' |
| 67 | + ? format(props.time, "ddd MMM Do 'YY") |
| 68 | + : format(props.time, "h:mm A, ddd MMM Do 'YY")} |
| 69 | + </Box> |
| 70 | + <Box className="secondaryText" pr={1}> |
| 71 | + <AttendeesIcon className="icons" /> |
| 72 | + {props.tense === 'past' ? `${props.attendees} attended` : `${props.attendees} attending`} |
| 73 | + </Box> |
| 74 | + <Box className="secondaryText" pr={1}> |
| 75 | + {props.tense === 'past' ? null : ( |
| 76 | + <div> |
| 77 | + {props.online ? <StreamIcon className="icons" /> : <TicketIcon className="icons" />} |
| 78 | + {props.online ? 'Free session' : 'Free entry'} |
| 79 | + </div> |
| 80 | + )} |
| 81 | + </Box> |
| 82 | + <Box flex="1 1 auto" className="rsvp"> |
| 83 | + <Button href={props.link} ghost> |
| 84 | + {props.tense === 'past' ? 'View' : 'RSVP'} |
| 85 | + </Button> |
| 86 | + </Box> |
| 87 | + </Flex> |
| 88 | + </Box> |
| 89 | + </Flex> |
| 90 | + </Box> |
| 91 | + </Flex> |
114 | 92 | </Card>
|
115 | 93 | );
|
0 commit comments