-
-
Notifications
You must be signed in to change notification settings - Fork 111
/
Copy pathTranslations.tsx
60 lines (55 loc) · 1.36 KB
/
Translations.tsx
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
import * as React from 'react'
import { Flex, Badge, Link } from '@theme-ui/components'
import Ads from './Ads'
import HighlightBox from './HighlightBox'
type Props = {
children: ReadonlyArray<{ language: string; url: string }>
}
const Translations = ({ children }: Props) => (
<Flex
as="ul"
sx={{
alignItems: 'center',
padding: 0,
gap: ['1em', '1.125em'],
flexWrap: 'wrap',
}}
>
{children.length > 0 ? (
children.map(({ language, url }) => (
<Badge as="li" key={language} variant="outline">
<Link
href={url}
target="_blank"
rel="noopener noreferrer"
sx={{ paddingX: '24px', paddingY: '12px' }}
>
{language}
</Link>
</Badge>
))
) : (
<i>No translations available.</i>
)}
<Flex as="li">
<Link
href="https://github.com/TkDodo/blog/blob/main/CONTRIBUTING.md#translations"
target="_blank"
rel="noopener noreferrer"
>
Add translation
</Link>
</Flex>
</Flex>
)
const TranslationsWrapper = ({ children }: Props) => {
return (
<Flex sx={{ flexDirection: 'column', gap: ['1em', '1.125em'] }}>
<Ads />
<HighlightBox>
<Translations>{children}</Translations>
</HighlightBox>
</Flex>
)
}
export default TranslationsWrapper