-
Notifications
You must be signed in to change notification settings - Fork 44
/
radio-buttons.tsx
58 lines (50 loc) · 1.29 KB
/
radio-buttons.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
import React from "react";
import {
Button,
Text,
Input,
Message,
Modal,
Option,
PheliaMessageProps,
Section,
RadioButtons
} from "../../core";
export function RadioButtonModal() {
return (
<Modal title="Radio buttons example" submit="Submit">
<Input label="Radio buttons">
<RadioButtons action="radio-buttons">
<Option value="option-a">option a</Option>
<Option value="option-b" selected>
option b
</Option>
<Option value="option-c">option c</Option>
</RadioButtons>
</Input>
</Modal>
);
}
export function RadioButtonExample({ useModal, useState }: PheliaMessageProps) {
const [form, setForm] = useState("form");
const openModal = useModal("modal", RadioButtonModal, form => {
setForm(JSON.stringify(form, null, 2));
});
return (
<Message text="A radio button example">
<Section
text="You can only have radio buttons inside of a Modal or Home tab"
accessory={
<Button action="open-modal" onClick={() => openModal()}>
Open modal
</Button>
}
/>
{form && (
<Section text="Modal submission:">
<Text type="mrkdwn">{"```\n" + form + "\n```"}</Text>
</Section>
)}
</Message>
);
}