forked from owid/owid-grapher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGdocsPublicationContext.tsx
54 lines (51 loc) · 1.8 KB
/
GdocsPublicationContext.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
import { Col, Radio, RadioChangeEvent, Row } from "antd"
import {
OwidGdocPublicationContext,
OwidGdocPostInterface,
} from "@ourworldindata/utils"
import React from "react"
import { GdocsErrorHelp } from "./GdocsErrorHelp.js"
export const GdocsPublicationContext = ({
gdoc,
setCurrentGdoc,
}: {
gdoc: OwidGdocPostInterface
setCurrentGdoc: (gdoc: OwidGdocPostInterface) => void
}) => {
const { publicationContext } = gdoc
const onChange = (e: RadioChangeEvent) => {
setCurrentGdoc({
...gdoc,
publicationContext: e.target.value,
})
}
return (
<>
<Row>
<Col>
<label htmlFor="publicationContext" className="mr-3">
Publication context
</label>
<Radio.Group
onChange={onChange}
value={publicationContext}
optionType="button"
id="publicationContext"
>
<Radio value={OwidGdocPublicationContext.unlisted}>
{OwidGdocPublicationContext.unlisted}
</Radio>
<Radio value={OwidGdocPublicationContext.listed}>
{OwidGdocPublicationContext.listed}
</Radio>
</Radio.Group>
<GdocsErrorHelp
help={
"Listed articles show up in the 'Latest' section of the homepage as well as the newsletter. Unlisted articles are not listed, but can still be accessed via the search bar and search engines."
}
/>
</Col>
</Row>
</>
)
}