|
1 | 1 | import {format, parseISO} from 'date-fns'; |
2 | 2 | import esLocale from 'date-fns/locale/es'; |
3 | 3 | import React from 'react'; |
4 | | -import {Box, Card, Heading, Image, Link, Text} from 'rebass'; |
| 4 | +import {Box, Heading, Text} from '@chakra-ui/core'; |
5 | 5 | import {FontAwesomeIcon} from '@fortawesome/react-fontawesome'; |
6 | 6 |
|
7 | 7 | function buildStaticMapUrl(lat, lng) { |
8 | 8 | return `https://maps.googleapis.com/maps/api/staticmap?center=${lat},${lng}&zoom=16&size=580x300&markers=color:red%7Clabel:%7C12.136062922753,-86.266359686852&key=AIzaSyC5YSkpeBuJyiBp0BnkWBW6Es3CQPymD84`; |
9 | 9 | } |
10 | 10 |
|
11 | | -function EventCard(props) { |
| 11 | +export default function EventCard(props) { |
12 | 12 | let {place} = props; |
13 | 13 | let {location} = place; |
14 | 14 | let {latitude, longitude} = location; |
15 | 15 |
|
16 | 16 | return ( |
17 | | - <Card bg="white" borderRadius={4} css={{overflow: 'hidden'}}> |
18 | | - <Image alt={props.name} src={buildStaticMapUrl(latitude, longitude)} /> |
19 | | - <Box color="#777" p={3} css={{lineHeight: '24px'}}> |
20 | | - <Heading fontSize={3}> |
21 | | - <Link |
| 17 | + <Box bg="white" rounded={4} overflow="hidden"> |
| 18 | + <img alt={props.name} src={buildStaticMapUrl(latitude, longitude)} /> |
| 19 | + <Box color="#777" p={3}> |
| 20 | + <Heading as="h3" size="md"> |
| 21 | + <Box |
| 22 | + as="a" |
22 | 23 | color="#4183c4" |
23 | 24 | href={`https://www.facebook.com/events/${props.id}`} |
24 | 25 | > |
25 | 26 | {props.name} |
26 | | - </Link> |
| 27 | + </Box> |
27 | 28 | </Heading> |
28 | 29 |
|
29 | | - <Text mt={2} css={{textTransform: 'capitalize'}}> |
30 | | - <FontAwesomeIcon fixedWidth icon={['far', 'calendar-alt']} /> |
31 | | - {format(parseISO(props.start_time), 'MMMM d, y', {locale: esLocale})} |
32 | | - </Text> |
33 | | - <Text> |
34 | | - <FontAwesomeIcon fixedWidth icon={['far', 'clock']} /> |
35 | | - {format(parseISO(props.start_time), 'hh:mm a')} -{' '} |
36 | | - {format(parseISO(props.end_time), 'hh:mm a')} |
37 | | - </Text> |
38 | | - <Text> |
39 | | - <Link |
40 | | - color="#777" |
41 | | - href={`https://www.google.com/maps/@${latitude},${longitude},17z`} |
42 | | - > |
43 | | - <FontAwesomeIcon fixedWidth icon={['far', 'map']} /> |
44 | | - {place.name} |
45 | | - </Link> |
46 | | - </Text> |
47 | | - <Text> |
48 | | - <FontAwesomeIcon fixedWidth icon={['fas', 'globe-americas']} /> |
49 | | - {location.city}, {location.country} |
50 | | - </Text> |
| 30 | + <Box color="gray.600"> |
| 31 | + <Text mt={2}> |
| 32 | + <FontAwesomeIcon fixedWidth icon={['far', 'calendar-alt']} /> |
| 33 | + {format(parseISO(props.start_time), 'MMMM d, y', { |
| 34 | + locale: esLocale, |
| 35 | + })} |
| 36 | + </Text> |
| 37 | + <Text> |
| 38 | + <FontAwesomeIcon fixedWidth icon={['far', 'clock']} /> |
| 39 | + {format(parseISO(props.start_time), 'hh:mm a')} -{' '} |
| 40 | + {format(parseISO(props.end_time), 'hh:mm a')} |
| 41 | + </Text> |
| 42 | + <Text> |
| 43 | + <Box |
| 44 | + as="a" |
| 45 | + color="gray.600" |
| 46 | + href={`https://www.google.com/maps/@${latitude},${longitude},17z`} |
| 47 | + > |
| 48 | + <FontAwesomeIcon fixedWidth icon={['far', 'map']} /> |
| 49 | + {place.name} |
| 50 | + </Box> |
| 51 | + </Text> |
| 52 | + <Text> |
| 53 | + <FontAwesomeIcon fixedWidth icon={['fas', 'globe-americas']} /> |
| 54 | + {location.city}, {location.country} |
| 55 | + </Text> |
| 56 | + </Box> |
51 | 57 | </Box> |
52 | | - </Card> |
| 58 | + </Box> |
53 | 59 | ); |
54 | 60 | } |
55 | | - |
56 | | -export default EventCard; |
|
0 commit comments