-
Notifications
You must be signed in to change notification settings - Fork 0
/
flavored.astro
83 lines (70 loc) · 1.46 KB
/
flavored.astro
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
---
import Layout from '../Layout.astro';
// -----------------------------------------------------------------------------
import type { FromSchema, JSONSchema7, UiSchema } from '@jsfe/form';
const mySchema = {
type: 'object',
properties: {
foo: {
type: 'string',
},
bar: {
type: 'boolean',
},
},
} as const satisfies JSONSchema7;
type MyData = FromSchema<typeof mySchema>;
const uiSchema: UiSchema = {
bar: {
'ui:widget': 'switch',
},
};
const dataInAstro: MyData = {
foo: 'hello',
};
// -----------------------------------------------------------------------------
const themes = [
//
'shoelace',
'material',
'carbon',
'wired',
'system',
];
---
<Layout>
<article id="astro">
{
themes.map((theme) => {
const FlavoredFormTagName = `jsf-${theme}`;
return (
<section>
<header>
<h2>{theme}</h2>
<code>{`<jsf-${theme}></jsf-${theme}>`}</code>
</header>
<FlavoredFormTagName
schema={JSON.stringify(mySchema)}
uiSchema={JSON.stringify(uiSchema)}
data={JSON.stringify(dataInAstro)}
/>
</section>
);
})
}
</article>
</Layout>
<script>
import '@jsfe/shoelace';
import '@jsfe/material';
import '@jsfe/carbon';
import '@jsfe/wired';
import '@jsfe/system';
import '../themes/material.js';
</script>
<style is:global>
@import '../themes/shoelace.scss';
@import '../themes/material.scss';
@import '../themes/carbon.scss';
@import '../themes/wired.scss';
</style>