-
Notifications
You must be signed in to change notification settings - Fork 60
/
PostEditor.jsx
110 lines (96 loc) · 3.72 KB
/
PostEditor.jsx
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
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import React from 'react';
import { useDispatch } from 'react-redux';
import { Button, Form } from '@edx/paragon';
import { faComments, faQuestion, faStar } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { hidePostEditor } from '../data';
import messages from './messages';
function PostEditor({ intl }) {
const dispatch = useDispatch();
const cancelAdding = () => dispatch(hidePostEditor());
return (
<div className="mx-4 my-2">
<Form>
<Form.Group>
<Form.Label>
{intl.formatMessage(messages.type)}
</Form.Label>
<Form.Text className="mb-3" muted>
{intl.formatMessage(messages.typeDescription)} ({intl.formatMessage(messages.required)})
</Form.Text>
<Form.Check inline type="radio" id="question">
<Form.Check.Input type="radio" />
<Form.Check.Label>
<FontAwesomeIcon icon={faQuestion} />
<span className="ml-2">{intl.formatMessage(messages.questionType)}</span>
</Form.Check.Label>
</Form.Check>
<Form.Check inline type="radio" id="discussion">
<Form.Check.Input type="radio" />
<Form.Check.Label>
<FontAwesomeIcon icon={faComments} />
<span className="ml-2">{intl.formatMessage(messages.discussionType)}</span>
</Form.Check.Label>
</Form.Check>
</Form.Group>
<Form.Group>
<Form.Label>
{intl.formatMessage(messages.topicArea)}
</Form.Label>
<Form.Text id="topicAreaInput" muted>
{intl.formatMessage(messages.topicAreaDescription)} ({intl.formatMessage(messages.required)})
</Form.Text>
<Form.Control
as="select"
defaultValue="General"
aria-describedby="topicAreaInput"
>
{/* TODO: topics has to be filled in another PR */}
<option>General</option>
</Form.Control>
</Form.Group>
<Form.Group>
<Form.Label>
{intl.formatMessage(messages.title)}
</Form.Label>
<Form.Text id="titleInput" muted>
{intl.formatMessage(messages.titleDescription)} ({intl.formatMessage(messages.required)})
</Form.Text>
<Form.Control type="text" aria-describedby="titleInput" />
</Form.Group>
<Form.Group>
<Form.Label>
{intl.formatMessage(messages.questionText)}
</Form.Label>
<Form.Control as="textarea" rows="3" />
</Form.Group>
<Form.Group>
<Form.Check inline type="checkbox" id="follow">
<Form.Check.Input type="checkbox" />
<Form.Check.Label>
<FontAwesomeIcon icon={faStar} />
<span className="ml-2">{intl.formatMessage(messages.followPost)}</span>
</Form.Check.Label>
</Form.Check>
<Form.Check inline type="checkbox" id="anonymous">
<Form.Check.Input type="checkbox" />
<Form.Check.Label>
<span className="ml-2">{intl.formatMessage(messages.anonymousPost)}</span>
</Form.Check.Label>
</Form.Check>
</Form.Group>
<Button className="rounded-lg" variant="primary">
{intl.formatMessage(messages.submit)}
</Button>
<Button className="rounded-lg ml-2" variant="outline-primary" onClick={cancelAdding}>
{intl.formatMessage(messages.cancel)}
</Button>
</Form>
</div>
);
}
PostEditor.propTypes = {
intl: intlShape.isRequired,
};
export default injectIntl(PostEditor);