forked from cofacts/rumors-site
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppFooter.js
198 lines (188 loc) · 5 KB
/
AppFooter.js
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
import React from 'react';
import { c, t } from 'ttag';
import { withStyles, makeStyles } from '@material-ui/core/styles';
import { Box, useMediaQuery } from '@material-ui/core';
import { withDarkTheme } from 'lib/theme';
import {
EDITOR_FACEBOOK_GROUP,
PROJECT_HACKFOLDR,
PROJECT_SOURCE_CODE,
PROJECT_MEDIUM,
CONTACT_EMAIL,
LINE_URL,
DONATION_URL,
} from 'constants/urls';
import NavLink from 'components/NavLink';
import GoogleWebsiteTranslator from './GoogleWebsiteTranslator';
import facebookIcon from './images/facebook.svg';
import mailIcon from './images/mail.svg';
import lineIcon from './images/line.svg';
const useStyles = makeStyles(theme => ({
first: {
display: 'flex',
justifyContent: 'center',
background: theme.palette.secondary.main,
'& h3': {
color: theme.palette.secondary[300],
fontSize: 18,
lineHeight: 1.56,
letterSpacing: 0.5,
marginBottom: 27,
},
},
container: {
width: 800,
color: theme.palette.text.primary,
margin: 60,
display: 'flex',
},
second: {
display: 'flex',
justifyContent: 'center',
padding: 28,
background: theme.palette.secondary[900],
},
logo: {
width: 275,
height: 'auto',
},
column: {
flex: '1 1',
},
linkTextWithIcon: {
marginLeft: 12,
},
}));
const CustomLink = withStyles(theme => ({
linkWrapper: {
margin: '20px 0',
display: 'flex',
alignItems: 'center',
},
link: {
color: 'inherit',
textDecoration: 'none',
lineHeight: '28px',
fontSize: 18,
fontWeight: 500,
letterSpacing: 0.15,
'&:hover': { color: theme.palette.text.secondary },
},
linkActive: {
color: theme.palette.primary[500],
},
icon: {
marginRight: 20,
},
}))(({ classes, icon: Icon, ...rest }) => (
<div className={classes.linkWrapper}>
{Icon && <Icon className={classes.icon} />}
<NavLink
className={classes.link}
activeClassName={classes.linkActive}
{...rest}
/>
</div>
));
function FactCheckSection({ classes }) {
return (
<div className={classes.column}>
<h3>{t`Fact Check`}</h3>
<CustomLink href="/articles">{t`Messages`}</CustomLink>
<CustomLink href="/replies">{c('App layout').t`Replies`}</CustomLink>
<CustomLink href="/hoax-for-you">{c('App layout').t`For You`}</CustomLink>
<CustomLink href="/tutorial">{c('App layout').t`Tutorial`}</CustomLink>
</div>
);
}
function AboutSection({ classes }) {
return (
<div className={classes.column}>
<h3>{t`About`}</h3>
<CustomLink href="/about">{t`About Cofacts`}</CustomLink>
<CustomLink href="/terms">{t`User Agreement`}</CustomLink>
<CustomLink external href={PROJECT_HACKFOLDR}>
{t`Introduction`}
</CustomLink>
<CustomLink external href={PROJECT_SOURCE_CODE}>
{t`Source Code`}
</CustomLink>
<CustomLink external href={PROJECT_MEDIUM}>
Medium
</CustomLink>
<CustomLink href="/impact">{t`Impact Report`}</CustomLink>
</div>
);
}
function ContactSection({ classes, isDesktop }) {
return (
<div className={classes.column}>
<h3>{t`Contact`}</h3>
<CustomLink
external
href={`mailto:${CONTACT_EMAIL}`}
icon={({ className }) => (
<img className={className} src={mailIcon} style={{ width: '30px' }} />
)}
>
{t`Contact Us`}
</CustomLink>
<CustomLink
external
href={EDITOR_FACEBOOK_GROUP}
icon={({ className }) => (
<img
className={className}
src={facebookIcon}
style={{ width: '30px' }}
/>
)}
>
{t`Facebook forum`}
</CustomLink>
<CustomLink
external
href={LINE_URL}
icon={({ className }) => (
<img className={className} src={lineIcon} style={{ width: '30px' }} />
)}
>
Line: @cofacts
</CustomLink>
{isDesktop && <GoogleWebsiteTranslator />}
<CustomLink external href={DONATION_URL}>
{t`Donate to Cofacts`}
</CustomLink>
</div>
);
}
function AppFooter() {
const classes = useStyles();
const isDesktop = useMediaQuery('(min-width:768px)');
return (
// <Box component="footer" display={['block', 'block', 'block']}>
<Box component="footer">
<div className={classes.first}>
<div className={classes.container}>
{isDesktop && <FactCheckSection classes={classes} />}
{isDesktop && <AboutSection classes={classes} />}
<ContactSection classes={classes} isDesktop={isDesktop} />
</div>
</div>
<div className={classes.second}>
<a
href="https://grants.g0v.tw/power/"
target="_blank"
rel="noopener noreferrer"
>
<img
className={classes.logo}
src="https://grants.g0v.tw/images/power/poweredby-long-i.svg"
alt="Powered by g0v"
/>
</a>
</div>
</Box>
);
}
export default React.memo(withDarkTheme(AppFooter));