|
1 | 1 | <script lang="ts"> |
2 | | - import { List, Li, Heading, Span, DescriptionList, A } from '$lib'; |
| 2 | + import { List, Li, Heading, Span, DescriptionList, A, Label, Radio } from '$lib'; |
3 | 3 | import { |
4 | 4 | CheckCircleSolid, |
5 | 5 | CloseCircleOutline, |
|
15 | 15 | import: 'default', |
16 | 16 | eager: true |
17 | 17 | }); |
| 18 | +
|
| 19 | + const tags = ['ul', 'ol', 'dl']; |
| 20 | + let listTag: List['tag'] = $state('ul'); |
| 21 | + const positions = ['inside', 'outside']; |
| 22 | + let listPosition: List['position'] = $state('inside'); |
18 | 23 | </script> |
19 | 24 |
|
20 | 25 | <H1>List</H1> |
21 | | - |
22 | 26 | <H2>Setup</H2> |
23 | 27 |
|
24 | 28 | <HighlightCompo code={modules['./md/setup.md'] as string} /> |
25 | 29 |
|
26 | | -<H2>Unordored list</H2> |
| 30 | +<H2>List position and tag</H2> |
27 | 31 | <CodeWrapper> |
28 | 32 | <Heading |
29 | 33 | tag="h2" |
30 | | - class="mb-2 text-lg text-lg font-semibold font-semibold text-gray-900 dark:text-white" |
| 34 | + class="mb-2 text-lg font-semibold text-gray-900 dark:text-white" |
31 | 35 | >Password requirements</Heading |
32 | 36 | > |
33 | | - <List class="space-y-1 text-gray-500 dark:text-gray-400"> |
| 37 | + <List tag={listTag} position={listPosition} class="space-y-1 text-gray-500 dark:text-gray-400"> |
34 | 38 | <Li>At least 10 characters (and up to 100 characters)</Li> |
35 | 39 | <Li>At least one lowercase character</Li> |
36 | 40 | <Li>Inclusion of at least one special character, e.g., ! @ # ?</Li> |
37 | 41 | </List> |
| 42 | + |
| 43 | + <div class="flex flex-wrap space-x-4 mt-4"> |
| 44 | + <Label class="w-full mb-4 font-bold">Tag:</Label> |
| 45 | + {#each tags as tag} |
| 46 | + <Radio labelClass="w-24 my-1" name="list_tag" bind:group={listTag} value={tag}>{tag}</Radio> |
| 47 | + {/each} |
| 48 | + </div> |
| 49 | + <div class="flex flex-wrap space-x-4 mt-4"> |
| 50 | + <Label class="w-full mb-4 font-bold">Position:</Label> |
| 51 | + {#each positions as position} |
| 52 | + <Radio labelClass="w-24 my-1" name="list_position" bind:group={listPosition} value={position}>{position}</Radio> |
| 53 | + {/each} |
| 54 | + </div> |
| 55 | + |
38 | 56 | </CodeWrapper> |
39 | 57 |
|
40 | 58 | <HighlightCompo code={modules['./md/unordered-list.md'] as string} /> |
|
43 | 61 | <CodeWrapper> |
44 | 62 | <Heading |
45 | 63 | tag="h2" |
46 | | - class="mb-2 text-lg text-lg font-semibold font-semibold text-gray-900 dark:text-white" |
| 64 | + class="mb-2 text-lg font-semibold text-gray-900 dark:text-white" |
47 | 65 | >Password requirements</Heading |
48 | 66 | > |
49 | 67 | <List class="space-y-1 text-gray-500 dark:text-gray-400"> |
|
73 | 91 | <List class="space-y-4 text-gray-500 dark:text-gray-400"> |
74 | 92 | <Li> |
75 | 93 | List item one |
76 | | - <List tag="decimal" ctxclass="mt-2 space-y-1 ps-5"> |
| 94 | + <List tag="ol" ctxclass="mt-2 space-y-1 ps-5"> |
77 | 95 | <Li>You might feel like you are being really "organized" o</Li> |
78 | 96 | <Li |
79 | 97 | >Nested navigation in UIs is a bad idea too, keep things as flat as |
|
85 | 103 | </Li> |
86 | 104 | <Li> |
87 | 105 | List item two |
88 | | - <List tag="decimal" ctxclass="mt-2 space-y-1 ps-5"> |
| 106 | + <List tag="ol" ctxclass="mt-2 space-y-1 ps-5"> |
89 | 107 | <Li>I'm not sure if we'll bother styling more than two levels deep.</Li> |
90 | 108 | <Li>Two is already too much, three is guaranteed to be a bad idea.</Li> |
91 | 109 | <Li>If you nest four levels deep you belong in prison.</Li> |
92 | 110 | </List> |
93 | 111 | </Li> |
94 | 112 | <Li> |
95 | 113 | List item three |
96 | | - <List tag="decimal" ctxclass="mt-2 space-y-1 ps-5"> |
| 114 | + <List tag="ol" ctxclass="mt-2 space-y-1 ps-5"> |
97 | 115 | <Li>Again please don't nest lists if you want</Li> |
98 | 116 | <Li>Nobody wants to look at this.</Li> |
99 | 117 | <Li>I'm upset that we even have to bother styling this.</Li> |
|
109 | 127 | <CodeWrapper> |
110 | 128 | <Heading |
111 | 129 | tag="h2" |
112 | | - class="mb-2 text-lg text-lg font-semibold font-semibold text-gray-900 dark:text-white" |
| 130 | + class="mb-2 text-lg font-semibold text-gray-900 dark:text-white" |
113 | 131 | >Password requirements</Heading |
114 | 132 | > |
115 | 133 | <List class="space-y-1 text-gray-500 dark:text-gray-400"> |
|
125 | 143 | <CodeWrapper> |
126 | 144 | <Heading |
127 | 145 | tag="h2" |
128 | | - class="mb-2 text-lg text-lg font-semibold font-semibold text-gray-900 dark:text-white" |
| 146 | + class="mb-2 text-lg font-semibold text-gray-900 dark:text-white" |
129 | 147 | >Top students:</Heading |
130 | 148 | > |
131 | | - <List tag="decimal" class="space-y-1 text-gray-500 dark:text-gray-400"> |
| 149 | + <List tag="ol" class="space-y-1 text-gray-500 dark:text-gray-400"> |
132 | 150 | <Li><Span>Bonnie Green</Span> with <Span>70</Span> points</Li> |
133 | 151 | <Li><Span>Jese Leos</Span> with <Span>63</Span> points</Li> |
134 | 152 | <Li><Span>Leslie Livingston</Span> with <Span>57</Span> points</Li> |
|
140 | 158 | <H2>Description list</H2> |
141 | 159 | <CodeWrapper> |
142 | 160 | <List |
143 | | - tag="none" |
| 161 | + tag="dl" |
144 | 162 | class="divide-y divide-gray-200 text-gray-900 dark:divide-gray-700 dark:text-white" |
145 | 163 | > |
146 | 164 | <div class="flex flex-col pb-3"> |
|
166 | 184 |
|
167 | 185 | <CodeWrapper> |
168 | 186 | <List |
169 | | - tag="disc" |
| 187 | + tag="ul" |
170 | 188 | class="mb-8 space-y-4 text-gray-500 dark:text-gray-400" |
171 | 189 | > |
172 | 190 | <Li icon class="gap-3"> |
|
197 | 215 | <H2>Advanced layout</H2> |
198 | 216 | <CodeWrapper> |
199 | 217 | <List |
200 | | - tag="none" |
| 218 | + tag="dl" |
201 | 219 | class="max-w-md divide-y divide-gray-200 dark:divide-gray-700" |
202 | 220 | > |
203 | 221 | <Li class="pb-3 sm:pb-4"> |
|
328 | 346 | <H2>Horizontal list</H2> |
329 | 347 | <CodeWrapper> |
330 | 348 | <List |
331 | | - tag="disc" |
| 349 | + tag="ul" |
332 | 350 | class="mb-6 flex flex-wrap items-center justify-center" |
333 | 351 | > |
334 | 352 | <Li> |
|
0 commit comments