-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcomponents_page.tsx
345 lines (335 loc) · 12.8 KB
/
components_page.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
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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import jsx from "texsaur";
import Button from "../components/Button";
import { Table } from "../components/Table";
import Icon from "../components/Icon";
import Card from "../components/Card";
import { Accordion } from "../components/Accordion";
const components = ["Icon", "Button", "Table", "Cards", "Accordion"];
export function createComponentsPage() {
// TODO: remove this check
if (!document.location.href.toLowerCase().includes("components")) {
return;
}
document.body.innerHTML = "";
document.title = "Components";
const sidebarItems = components.map((component) => (
<a href={`#${component}`} key={component}>
<li className="se-sidebar-item">{component}</li>
</a>
));
const page = (
<div className="se-docs-container">
{/* Sidebar */}
<div className="se-sidebar">
<img
src={chrome.runtime.getURL("images/logo/extended.png")}
alt="NitSig Logo"
width="100"
/>
<ul>{sidebarItems}</ul>
</div>
{/* Main Content */}
<div className="se-main-content">
<h1>NitSig Components</h1>
<div className="introduction">
<p>
These components were created by the NitSig team in
order to use them across the Sigarra pages.
</p>
<p>
If you find something in your Sigarra that would be
interesting to change by one of the following
components, send an email to{" "}
<a href="mailto:[email protected]">[email protected]</a>.
</p>
<p>
Interesting to see the extension code base? Check our
open source{" "}
<a
href="https://github.com/NIAEFEUP/nitsig"
target="_blank"
rel="noopener noreferrer"
>
GitHub Repository
</a>
!
</p>
</div>
{/* Icon */}
<Component
name="Icon"
description="Talking about icons, we exclusive use the Remix Icon library, the outlined style! Check remixicon.com for all the available icons."
code={`
<Icon name="ri-notification-line" />
`}
>
<Icon name="ri-notification-line" />
</Component>
{/* Button */}
<Component
name="Button"
description="Our button abstraction that can be used to create buttons with icons and text. "
code={`
<Button
name="MY BUTTON"
text="Click me"
icon="ri-notification-line"
onclick={() => console.log("Button was clicked")}
/>
`}
>
<Button
title="Small"
size="sm"
onclick={() => console.log("Button was clicked")}
/>
<Button
title="Medium"
size="md"
onclick={() => console.log("Button was clicked")}
/>
<Button
title="Large"
size="lg"
onclick={() => console.log("Button was clicked")}
/>
<Button
title="Full"
radius="full"
onclick={() => console.log("Button was clicked")}
/>
<Button
title="Large"
radius="lg"
onclick={() => console.log("Button was clicked")}
/>
<Button
title="Medium"
radius="md"
onclick={() => console.log("Button was clicked")}
/>
<Button
title="Small"
radius="sm"
onclick={() => console.log("Button was clicked")}
/>
<Button
title="None"
radius="none"
onclick={() => console.log("Button was clicked")}
/>
<Button
title="Default"
onclick={() => console.log("Button was clicked")}
/>
<Button
title="Primary"
color="primary"
onclick={() => console.log("Button was clicked")}
/>
<Button
title="Solid"
variant="solid"
onclick={() => console.log("Button was clicked")}
/>
<Button
title="Outline"
variant="outline"
onclick={() => console.log("Button was clicked")}
/>
<Button
title="Link"
variant="link"
onclick={() => console.log("Button was clicked")}
/>
<Button
title="Outline Primary"
variant="outline"
color="primary"
onclick={() => console.log("Button was clicked")}
/>
<Button
title="Link Primary"
variant="link"
color="primary"
onclick={() => console.log("Button was clicked")}
/>
<Button
title="Icon"
icon="ri-notification-line"
onclick={() => console.log("Button was clicked")}
/>
<Button
icon="ri-notification-line"
radius="full"
onclick={() => console.log("Button was clicked")}
/>
</Component>
{/* Table */}
<Component
name="Table"
description="A simple table design with sorting capabilities on column headers."
code={`
<Table
name="my_table"
headers={[
["Component", "Component"],
["Description", "Description"],
["Status", "Status"]
]}
data={[
["Button", "A button that can be clicked", "In progress"],
["Input", "A text input field", "Complete"]
]}
/>
`}
>
<Table
name="my_table"
headers={[
["Component", "Component"],
["Description", "Description"],
["Status", "Status"],
]}
data={[
[
"Button",
"A button that can be clicked",
"In progress",
],
["Input", "A text input field", "Complete"],
]}
/>
</Component>
{/* Card */}
<Component
name="Card"
description="Our card component, that allows the creation of cards with different styles."
code={`<Card
id="1"
title="Default Card"
description="I have all attributes possible (i.e; image, title, description, subtitles and a button)"
subtitles={["One", "Two"]}
imgSrc="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcThD4or2R-Tpyokw8NzJyn-LXt6R8YK9Sih5w&s"
button ={<Button title="Button" variant="solid" size="sm" color="primary"/>}
/>
`}
>
<Card
id="1"
title="Default Card"
description="I have all attributes possible (i.e; image, title, description, subtitles and a button)"
subtitles={["One", "Two"]}
imgSrc="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcThD4or2R-Tpyokw8NzJyn-LXt6R8YK9Sih5w&s"
button={
<Button
title="Button"
variant="solid"
size="sm"
color="primary"
/>
}
/>
<Card
id="2"
title="Alt Card 1"
description="I don't have subtitles"
imgSrc="https://preview.redd.it/i-once-found-a-silly-cat-picture-in-black-and-white-v0-tzn8uvux7vmd1.png?width=236&format=png&auto=webp&s=f17ce524ff01e70fce304712ca5bf58a194b5fbe"
button={
<Button
title="Button"
variant="solid"
size="sm"
color="primary"
/>
}
/>
<Card
id="3"
title="Alt Card 2"
description="I don't have an image nor subtitles"
button={
<Button
icon="ri-notification-line"
radius="full"
color="primary"
/>
}
/>
</Component>
{/* Accordion */}
<Component
name="Accordion"
description="A collapsible component that can expand to show or hide content."
code={`
<Accordion
id="example-accordion"
header=
{ <h3>Expandable Content</h3> }
max_size={200}
>
<p>This is the content of the accordion</p>
<p>This is more content</p>
<Table
name="my_table_accordion"
headers={[
["Component", "Component"],
["Description", "Description"],
["Status", "Status"],
]}
data={[
["Button", "A button that can be clicked", "In progress"],
["Input", "A text input field", "Complete"],
]}
/>
</Accordion>
`}
>
<Accordion
id="example-accordion"
header={<h3>Expandable Content</h3>}
max_size={200}
>
<p>This is the content of the accordion</p>
<p>This is more content</p>
<Table
name="my_table_accordion"
headers={[
["Component", "Component"],
["Description", "Description"],
["Status", "Status"],
]}
data={[
[
"Button",
"A button that can be clicked",
"In progress",
],
["Input", "A text input field", "Complete"],
]}
/>
</Accordion>
</Component>
</div>
</div>
);
document.body.appendChild(page);
}
interface ComponentProps {
name: string;
description: string;
code: string;
}
const Component: JSX.Component<ComponentProps> = (
{ name, description, code },
children,
) => (
<div id={name} className="se-component-section">
<h2>{name}</h2>
<p>{description}</p>
<div className="se-component-show">{children}</div>
<pre className="se-code-block">{code}</pre>
{/* TODO(thePeras): Add Props field, so we can know the Component Reference and the default values */}
</div>
);