This repository has been archived by the owner on Apr 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.js
255 lines (232 loc) · 8.21 KB
/
App.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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
import React from 'react'
import { ThemeProvider } from 'styled-components'
import {
H,
P,
Button,
Tabs,
FormGroup,
Label,
Input,
Hint,
Select,
Textarea,
Modal,
Field,
theme,
Container,
Row,
Col,
Shift,
PageTitle,
Pagination,
Navigation,
NavItem,
DataGrid,
LanguageSwitcher,
} from '@raketa-cms/raketa-mir'
const App = () => {
const [open, setOpen] = React.useState(false)
return (
<ThemeProvider theme={theme}>
<Container>
<h1>Examples</h1>
<Tabs>
<div title='Content'>
<PageTitle>A page title!</PageTitle>
<FormGroup>
<Label>Label</Label>
<Input type='text' />
<Hint>A hint here!</Hint>
</FormGroup>
<FormGroup>
<Label>Two word label</Label>
<Select>
<option>Please select...</option>
</Select>
<Hint type='error'>An Error here!</Hint>
</FormGroup>
<Textarea />
<Field
as='select'
name='open_modal'
label='Open modal'
hint='Some hint'
onChange={(e) => {
if (e.target.value === 'opened') {
setOpen(true)
} else {
setOpen(false)
}
}}
>
<option value='opened' selected={open}>
Opened
</option>
<option value='closed' selected={!open}>
Closed
</option>
</Field>
<Field
as='input'
type='text'
name='bla-bla'
label='Some compound input with hint'
hint='Some hint'
/>
<Field
as='input'
type='text'
name='bla-bla-bla'
label='Some compound input with error'
error='Error!'
/>
<Button type='button' variant='primary'>
Save
</Button>
<Button type='button' variant='secondary'>
Cancel
</Button>
</div>
<div title='Settings'>
<H size='large'>Title of page</H>
<P>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Molestias
nemo dicta nesciunt provident quod autem, optio incidunt amet,
consequuntur laborum totam error. Illum at officia voluptate natus
ab praesentium! Iusto.
</P>
</div>
<div title='Grid: Col 6 & Col 6'>
<Row gutter='2em'>
<Col s='6'>
<P>
Lorem ipsum dolor sit amet consectetur adipisicing elit.
Molestias nemo dicta nesciunt provident quod autem, optio
incidunt amet, consequuntur laborum totam error. Illum at
officia voluptate natus ab praesentium! Iusto.
</P>
</Col>
<Col s='6'>
<P>
Lorem ipsum dolor sit amet consectetur adipisicing elit.
Molestias nemo dicta nesciunt provident quod autem, optio
incidunt amet, consequuntur laborum totam error. Illum at
officia voluptate natus ab praesentium! Iusto.
</P>
</Col>
</Row>
</div>
<div title='Grid: Shift 2'>
<Row gutter='2em'>
<Shift s='2'>
<P>
Lorem ipsum dolor sit amet consectetur adipisicing elit.
Molestias nemo dicta nesciunt provident quod autem, optio
incidunt amet, consequuntur laborum totam error. Illum at
officia voluptate natus ab praesentium! Iusto.
</P>
</Shift>
</Row>
</div>
<div title='Pagination'>
<Pagination
pagination={{ currentPage: 5, pagesCount: 25 }}
LinkComponent={({ href, children }) => {
const formattedHref = `${href.pathname}?page=${href.query.page}`
return <div href={formattedHref}>{children}</div>
}}
router={{ query: {}, pathname: '/path' }}
/>
</div>
<div title='Navigation'>
<Navigation>
<NavItem>
<a href='/'>
<img
style={{ filter: 'invert(1)' }}
alt='directions'
src='data:image/svg+xml;base64,PHN2ZyBzdHJva2U9ImN1cnJlbnRDb2xvciIgZmlsbD0iY3VycmVudENvbG9yIiBzdHJva2Utd2lkdGg9IjAiIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiBoZWlnaHQ9IjFlbSIgd2lkdGg9IjFlbSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMjc3LjMgMzUuMTFsLTMyLjEgMi4xMi0xIDMyLjkzIDMzLjYuMDUtLjUtMzUuMXpNMTUxLjcgODguMDRMNjcuOTYgMTE4LjkgMTUyIDE2OS4ybDE4OC02LjIgMi40LTc0LjcyLTE5MC43LS4yNHpNMjc5LjIgMTgzbC0zOC4zIDEuMy0uOCAyNy44IDM5LjUgMS4yLS40LTMwLjN6bS05My4xIDQ1LjZsLjggNjQuMiAyMDAuNC45IDUxLjctMjkuMi01NS44LTMwLjItMTk3LjEtNS43em01MS4xIDgyLjVsLTUgMTc1LjMgNTAuOS42LTIuMy0xNzUuNy00My42LS4yeiI+PC9wYXRoPjwvc3ZnPgo='
/>
</a>
</NavItem>
<NavItem active>
<a href='/'>
<img
style={{ filter: 'invert(1)' }}
alt='directions'
src='data:image/svg+xml;base64,PHN2ZyBzdHJva2U9ImN1cnJlbnRDb2xvciIgZmlsbD0iY3VycmVudENvbG9yIiBzdHJva2Utd2lkdGg9IjAiIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiBoZWlnaHQ9IjFlbSIgd2lkdGg9IjFlbSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMjc3LjMgMzUuMTFsLTMyLjEgMi4xMi0xIDMyLjkzIDMzLjYuMDUtLjUtMzUuMXpNMTUxLjcgODguMDRMNjcuOTYgMTE4LjkgMTUyIDE2OS4ybDE4OC02LjIgMi40LTc0LjcyLTE5MC43LS4yNHpNMjc5LjIgMTgzbC0zOC4zIDEuMy0uOCAyNy44IDM5LjUgMS4yLS40LTMwLjN6bS05My4xIDQ1LjZsLjggNjQuMiAyMDAuNC45IDUxLjctMjkuMi01NS44LTMwLjItMTk3LjEtNS43em01MS4xIDgyLjVsLTUgMTc1LjMgNTAuOS42LTIuMy0xNzUuNy00My42LS4yeiI+PC9wYXRoPjwvc3ZnPgo='
/>
</a>
</NavItem>
<NavItem active>
<LanguageSwitcher
current='EN'
navigation={[
{ path: '/bg/', label: 'BG' },
{ path: '/de/', label: 'DE', newItem: true },
]}
/>
</NavItem>
</Navigation>
</div>
<div title='DataGrid'>
<DataGrid
list={[
{ name: 'Test', slug: '/test' },
{ name: 'Another test', slug: '/another-test' },
]}
header={() => (
<>
<th>Name</th>
<th>URL</th>
</>
)}
row={({ name, slug }) => (
<>
<td>{name}</td>
<td>{slug}</td>
</>
)}
/>
</div>
</Tabs>
</Container>
{open && (
<Modal title='Section Title' onClose={() => setOpen(false)}>
<Tabs>
<div title='Content'>
<FormGroup>
<Label>Label</Label>
<Input type='text' />
</FormGroup>
<FormGroup>
<Label>Two word label</Label>
<Select>
<option>Please select...</option>
</Select>
</FormGroup>
<Textarea />
<Button type='button' variant='primary'>
Save
</Button>
<Button type='button' variant='secondary'>
Cancel
</Button>
</div>
<div title='Settings'>
<H size='large'>Title of page</H>
<P>
Lorem ipsum dolor sit amet consectetur adipisicing elit.
Molestias nemo dicta nesciunt provident quod autem, optio
incidunt amet, consequuntur laborum totam error. Illum at
officia voluptate natus ab praesentium! Iusto.
</P>
</div>
</Tabs>
</Modal>
)}
</ThemeProvider>
)
}
export default App