fulldev-ui 0.6.0-beta.8 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/astro.config.ts +6 -8
  2. package/cloudcannon.config.yml +38 -102
  3. package/package.json +2 -1
  4. package/public/images/block-code.png +0 -0
  5. package/public/images/component-code.png +0 -0
  6. package/src/blocks/Banner.astro +3 -5
  7. package/src/blocks/Colleagues1.astro +4 -3
  8. package/src/blocks/Content1.astro +6 -28
  9. package/src/blocks/Content2.astro +25 -49
  10. package/src/blocks/Content3.astro +25 -54
  11. package/src/blocks/Content4.astro +27 -50
  12. package/src/blocks/Content5.astro +7 -37
  13. package/src/blocks/Content6.astro +56 -0
  14. package/src/blocks/Content7.astro +64 -0
  15. package/src/blocks/Content8.astro +47 -0
  16. package/src/blocks/Cta1.astro +6 -9
  17. package/src/blocks/Cta2.astro +52 -0
  18. package/src/blocks/Features1.astro +5 -4
  19. package/src/blocks/Features2.astro +70 -0
  20. package/src/blocks/Footer.astro +2 -6
  21. package/src/blocks/Header.astro +8 -25
  22. package/src/blocks/Hero1.astro +19 -27
  23. package/src/blocks/Intro1.astro +3 -4
  24. package/src/blocks/{Industries1.astro → JobCategories1.astro} +13 -38
  25. package/src/blocks/JobCategory1.astro +90 -0
  26. package/src/blocks/Jobs1.astro +7 -10
  27. package/src/blocks/Logos1.astro +4 -4
  28. package/src/blocks/Pages1.astro +85 -0
  29. package/src/blocks/Pricings1.astro +61 -0
  30. package/src/blocks/Products1.astro +7 -10
  31. package/src/blocks/Projects1.astro +59 -83
  32. package/src/blocks/Reviews1.astro +10 -10
  33. package/src/blocks/Subheader.astro +4 -9
  34. package/src/blocks/{Contact1.astro → _Contact1.astro} +1 -3
  35. package/src/components/Avatar.astro +40 -0
  36. package/src/components/Avatars.astro +20 -0
  37. package/src/components/Badge.astro +6 -35
  38. package/src/components/Block.astro +19 -4
  39. package/src/components/Chip.astro +73 -0
  40. package/src/components/Element.astro +1 -0
  41. package/src/components/Heading.astro +13 -5
  42. package/src/components/Image.astro +1 -1
  43. package/src/components/Link.astro +1 -1
  44. package/src/components/Menu.astro +9 -5
  45. package/src/components/Proof.astro +52 -0
  46. package/src/components/Toc.astro +33 -35
  47. package/src/content/config.ts +5 -0
  48. package/src/content/layouts/base.yml +133 -143
  49. package/src/content/pages/{base → _base}/toggle.mdx +1 -1
  50. package/src/content/pages/_showcase/stark-vulcanising-products.md +0 -1
  51. package/src/content/pages/docs/blocks/_categories.mdx +1 -17
  52. package/src/content/pages/docs/blocks/banner.mdx +1 -1
  53. package/src/content/pages/docs/blocks/colleagues.mdx +1 -1
  54. package/src/content/pages/docs/blocks/content.mdx +162 -1
  55. package/src/content/pages/docs/blocks/cta.mdx +1 -1
  56. package/src/content/pages/docs/blocks/features.mdx +66 -1
  57. package/src/content/pages/docs/blocks/footer.mdx +1 -1
  58. package/src/content/pages/docs/blocks/header.mdx +1 -1
  59. package/src/content/pages/docs/blocks/hero.mdx +1 -1
  60. package/src/content/pages/docs/blocks/intro.mdx +1 -1
  61. package/src/content/pages/docs/blocks/logos.mdx +1 -1
  62. package/src/content/pages/docs/blocks/projects.mdx +1 -1
  63. package/src/content/pages/docs/blocks/reviews.mdx +1 -1
  64. package/src/content/pages/docs/blocks.mdx +1 -7
  65. package/src/content/pages/docs/collections/images.mdx +1 -1
  66. package/src/content/pages/docs/collections/pages.mdx +1 -1
  67. package/src/content/pages/docs/collections/presets.mdx +1 -1
  68. package/src/content/pages/docs/components/_localeswitcher.mdx +1 -1
  69. package/src/content/pages/docs/components/_table.mdx +1 -1
  70. package/src/content/pages/docs/components/_tagline.mdx +1 -1
  71. package/src/content/pages/docs/components/_themer.mdx +1 -1
  72. package/src/content/pages/docs/components/_toggle.mdx +1 -1
  73. package/src/content/pages/docs/components/avatar.mdx +32 -0
  74. package/src/content/pages/docs/components/badge.mdx +1 -34
  75. package/src/content/pages/docs/components/badges.mdx +1 -13
  76. package/src/content/pages/docs/components/button.mdx +1 -1
  77. package/src/content/pages/docs/components/buttons.mdx +1 -1
  78. package/src/content/pages/docs/components/channel.mdx +1 -1
  79. package/src/content/pages/docs/components/channels.mdx +1 -1
  80. package/src/content/pages/docs/components/checkbox.mdx +1 -1
  81. package/src/content/pages/docs/components/chip.mdx +75 -0
  82. package/src/content/pages/docs/components/heading.mdx +1 -1
  83. package/src/content/pages/docs/components/icon.mdx +1 -1
  84. package/src/content/pages/docs/components/image.mdx +2 -1
  85. package/src/content/pages/docs/components/input.mdx +1 -1
  86. package/src/content/pages/docs/components/label.mdx +1 -1
  87. package/src/content/pages/docs/components/link.mdx +1 -1
  88. package/src/content/pages/docs/components/links.mdx +11 -52
  89. package/src/content/pages/docs/components/list.mdx +1 -1
  90. package/src/content/pages/docs/components/logo.mdx +1 -1
  91. package/src/content/pages/docs/components/menu.mdx +5 -18
  92. package/src/content/pages/docs/components/paragraph.mdx +1 -1
  93. package/src/content/pages/docs/components/rating.mdx +1 -1
  94. package/src/content/pages/docs/components/select.mdx +1 -1
  95. package/src/content/pages/docs/components/social.mdx +1 -1
  96. package/src/content/pages/docs/components/socials.mdx +1 -1
  97. package/src/content/pages/docs/components/switch.mdx +1 -1
  98. package/src/content/pages/docs/components/tagline.mdx +1 -1
  99. package/src/content/pages/docs/components/textarea.mdx +1 -1
  100. package/src/content/pages/docs/components.mdx +1 -1
  101. package/src/content/pages/docs/customization.mdx +1 -1
  102. package/src/content/pages/docs/frameworks.mdx +1 -1
  103. package/src/content/pages/docs/index.mdx +1 -1
  104. package/src/content/pages/docs/installation.mdx +1 -24
  105. package/src/content/pages/docs/layouts/doc.mdx +1 -1
  106. package/src/content/pages/docs/layouts/page.mdx +1 -1
  107. package/src/content/pages/docs/pages.mdx +1 -1
  108. package/src/content/pages/docs/structures/_card.mdx +1 -1
  109. package/src/content/pages/docs/structures/_dialog.mdx +1 -1
  110. package/src/content/pages/docs/structures/_drawer.mdx +1 -1
  111. package/src/content/pages/docs/structures/card.mdx +1 -1
  112. package/src/content/pages/docs/structures/code.mdx +1 -1
  113. package/src/content/pages/docs/structures/container.mdx +1 -1
  114. package/src/content/pages/docs/structures/drawer.mdx +1 -1
  115. package/src/content/pages/docs/structures/group.mdx +1 -1
  116. package/src/content/pages/docs/structures/layout.mdx +1 -1
  117. package/src/content/pages/docs/structures/masonry.mdx +1 -1
  118. package/src/content/pages/docs/structures/matrix.mdx +1 -1
  119. package/src/content/pages/docs/structures/panel.mdx +1 -1
  120. package/src/content/pages/docs/structures/prose.mdx +1 -1
  121. package/src/content/pages/docs/structures/section.mdx +1 -1
  122. package/src/content/pages/docs/structures/stack.mdx +1 -1
  123. package/src/content/pages/docs/structures/writeup.mdx +1 -1
  124. package/src/content/pages/docs/structures.mdx +1 -1
  125. package/src/content/pages/index.mdx +20 -25
  126. package/src/layouts/Page.astro +44 -10
  127. package/src/layouts/{Product.astro → _Product.astro} +6 -6
  128. package/src/pages/test.astro +16 -0
  129. package/src/schemas/block.ts +18 -44
  130. package/src/schemas/button.ts +2 -0
  131. package/src/schemas/card.ts +43 -0
  132. package/src/schemas/{badge.ts → chip.ts} +3 -3
  133. package/src/schemas/page.ts +4 -18
  134. package/src/schemas/proof.ts +12 -0
  135. package/src/structures/Drawer.astro +2 -3
  136. package/src/structures/Prose.astro +31 -40
  137. package/src/structures/Section.astro +1 -1
  138. package/src/structures/Sidebar.astro +3 -4
  139. package/src/structures/Split.astro +38 -0
  140. package/tailwind.config.ts +4 -1
  141. package/pnpm-lock.yaml +0 -5186
  142. package/src/blocks/_Hero.astro +0 -245
  143. package/src/components/Blocks.astro +0 -26
  144. package/src/components/Sidebar.astro +0 -43
  145. package/src/content/pages/docs/blocks/feature.mdx +0 -17
  146. package/src/content/pages/docs/layouts.mdx +0 -80
  147. package/src/layouts/Block.astro +0 -81
  148. package/src/layouts/Category.astro +0 -136
  149. package/src/layouts/Doc.astro +0 -96
  150. package/src/layouts/Job.astro +0 -60
  151. package/src/layouts/Jobs.astro +0 -72
  152. package/src/layouts/Post.astro +0 -53
  153. /package/src/content/pages/{posts → _posts}/post.md +0 -0
@@ -1,245 +0,0 @@
1
- <!-- ---
2
- import type { ComponentProps,HTMLAttributes,HTMLTag } from 'astro/types'
3
- import Badge from 'fulldev-ui/components/Badge.astro'
4
- import Buttons from 'fulldev-ui/components/Buttons.astro'
5
- import Element from 'fulldev-ui/components/Element.astro'
6
- import Heading from 'fulldev-ui/components/Heading.astro'
7
- import Image from 'fulldev-ui/components/Image.astro'
8
- import Paragraph,{
9
- default as Lead,
10
- } from 'fulldev-ui/components/Paragraph.astro'
11
- import Rating from 'fulldev-ui/components/Rating.astro'
12
- import Tagline from 'fulldev-ui/components/Tagline.astro'
13
-
14
- interface Props extends HTMLAttributes<'section'> {
15
- rating?: ComponentProps<typeof Rating> | undefined
16
- badge?: ComponentProps<typeof Badge> | undefined
17
- tagline?: ComponentProps<typeof Tagline>['text']
18
- heading?: ComponentProps<typeof Heading>['text']
19
- lead?: ComponentProps<typeof Lead>['text']
20
- paragraph?: ComponentProps<typeof Paragraph>['text']
21
- buttons?: ComponentProps<typeof Buttons>['buttons']
22
- image?: ComponentProps<typeof Image>['id']
23
- level?: ComponentProps<typeof Heading>['level']
24
- as?: HTMLTag
25
- size?: 'sm' | 'md' | 'lg' | undefined
26
- variant?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | undefined
27
- }
28
-
29
- const {
30
- as = 'section',
31
- size = 'lg',
32
- variant = 1,
33
- level = 1,
34
- rating,
35
- tagline,
36
- badge,
37
- heading,
38
- lead,
39
- paragraph,
40
- buttons,
41
- image,
42
- ...rest
43
- } = Astro.props
44
- ---
45
-
46
- <Element
47
- class:list="hero"
48
- {as}
49
- {size}
50
- {variant}
51
- {...rest}
52
- >
53
- <Element class:list="hero-container">
54
- <Element class:list="hero-segment">
55
- <Element class:list="hero-content">
56
- <Rating
57
- {size}
58
- {...rating}
59
- />
60
- <Tagline
61
- text={tagline}
62
- {size}
63
- />
64
- <Badge
65
- {size}
66
- {...badge}
67
- />
68
- <Heading
69
- text={heading}
70
- {level}
71
- {size}
72
- />
73
- <Paragraph
74
- text={lead}
75
- {size}
76
- />
77
- <Paragraph
78
- text={paragraph}
79
- {size}
80
- />
81
- <slot name="content" />
82
- </Element>
83
- <Buttons
84
- variant="primary"
85
- {size}
86
- {buttons}
87
- />
88
- <slot name="segment" />
89
- </Element>
90
- <Image
91
- class:list="hero-image"
92
- {...image}
93
- />
94
- <slot />
95
- </Element>
96
- </Element>
97
-
98
- <style is:global>
99
- @layer fulldev {
100
- .hero {
101
- @apply relative w-full;
102
-
103
- .hero-container {
104
- @apply flex h-full w-full flex-col;
105
- }
106
-
107
- .hero-segment {
108
- @apply z-10 flex flex-col items-start gap-8;
109
- }
110
-
111
- .hero-content {
112
- @apply flex max-w-screen-md flex-col gap-6;
113
- }
114
-
115
- &.dark {
116
- @apply bg-background;
117
- }
118
-
119
- /* Column left aligned */
120
- &.variant-1 {
121
- .hero-container {
122
- @apply container py-8;
123
- }
124
-
125
- .hero-segment {
126
- @apply gap-8 py-16;
127
- }
128
-
129
- .content-image {
130
- @apply rounded-lg;
131
- }
132
- }
133
-
134
- /* Column centered */
135
- &.variant-2 {
136
- .hero-container {
137
- @apply container items-center py-8;
138
- }
139
-
140
- .hero-segment {
141
- @apply items-center py-16;
142
- }
143
-
144
- .hero-content {
145
- @apply items-center text-center;
146
- }
147
-
148
- .content-image {
149
- @apply rounded-lg;
150
- }
151
- }
152
-
153
- /* Spread */
154
- &.variant-3 {
155
- .hero-container {
156
- @apply container items-center py-8;
157
- }
158
-
159
- .hero-segment {
160
- @apply w-full flex-row flex-wrap items-end justify-between py-16;
161
- }
162
-
163
- .content-image {
164
- @apply rounded-lg;
165
- }
166
- }
167
-
168
- /* Split */
169
- &.variant-4 {
170
- .hero-container {
171
- @apply container py-8 lg:grid lg:grid-cols-2 lg:items-center;
172
- }
173
-
174
- .content-image {
175
- @apply rounded-lg;
176
- }
177
- }
178
-
179
- /* Split fill */
180
- &.variant-5 {
181
- @apply min-h-hero;
182
-
183
- .hero-container {
184
- @apply container px-0 lg:grid lg:grid-cols-2 lg:items-center;
185
- }
186
-
187
- .hero-segment {
188
- @apply w-auto max-w-screen-md px-gutter pb-16 pt-24 lg:pb-24;
189
- }
190
-
191
- .hero-image {
192
- @apply right-0 top-0 h-full object-cover lg:absolute lg:w-1/2;
193
- }
194
- }
195
-
196
- /* Background left */
197
- &.variant-6 {
198
- @apply min-h-hero;
199
-
200
- .hero-container {
201
- @apply container justify-center py-16;
202
- }
203
-
204
- .hero-image {
205
- @apply absolute inset-0 h-full w-full object-cover opacity-30;
206
- }
207
- }
208
-
209
- /* Background center */
210
- &.variant-7 {
211
- @apply min-h-hero;
212
-
213
- .hero-container {
214
- @apply container items-center justify-center py-16;
215
- }
216
-
217
- .hero-image {
218
- @apply absolute inset-0 h-full w-full object-cover opacity-30;
219
- }
220
-
221
- .hero-segment,
222
- .hero-content {
223
- @apply items-center text-center;
224
- }
225
- }
226
-
227
- /* Background spread */
228
- &.variant-8 {
229
- @apply min-h-hero;
230
-
231
- .hero-container {
232
- @apply container items-center justify-end py-16;
233
- }
234
-
235
- .hero-image {
236
- @apply absolute inset-0 h-full w-full object-cover opacity-30;
237
- }
238
-
239
- .hero-segment {
240
- @apply w-full flex-row flex-wrap items-end justify-between;
241
- }
242
- }
243
- }
244
- }
245
- </style> -->
@@ -1,26 +0,0 @@
1
- ---
2
- import type { ComponentProps, HTMLAttributes } from 'astro/types'
3
- import Block from 'fulldev-ui/components/Block.astro'
4
- import Element from 'fulldev-ui/components/Element.astro'
5
-
6
- interface Props extends HTMLAttributes<'div'> {
7
- blocks?: ComponentProps<typeof Block>[] | undefined
8
- }
9
-
10
- const { blocks, ...rest } = Astro.props
11
- ---
12
-
13
- <Element
14
- class:list="blocks"
15
- {...rest}
16
- >
17
- {blocks?.map((block) => <Block {...block} />)}
18
- </Element>
19
-
20
- <style is:global>
21
- @layer fulldev {
22
- .blocks {
23
- @apply flex flex-col;
24
- }
25
- }
26
- </style>
@@ -1,43 +0,0 @@
1
- ---
2
- import type { HTMLAttributes } from 'astro/types'
3
- import Element from 'fulldev-ui/components/Element.astro'
4
- import Menus from 'fulldev-ui/components/Menus.astro'
5
- import type { BlockSchema } from 'fulldev-ui/schemas/block'
6
-
7
- interface Props extends HTMLAttributes<'aside'>, BlockSchema {}
8
-
9
- const { menus, ...rest } = Astro.props
10
- ---
11
-
12
- <Element
13
- class:list="sidebar"
14
- as="aside"
15
- {...rest}
16
- >
17
- <Menus
18
- size="sm"
19
- menu={rest}
20
- {menus}
21
- />
22
- </Element>
23
-
24
- <!-- <style is:global>
25
- @layer fulldev {
26
- .sidebar {
27
- @apply sticky bottom-0 left-0 hidden h-full w-56 max-w-56 shrink-0 grow flex-col items-start gap-8 overflow-y-auto border-r bg-background py-8 pr-8 lg:flex;
28
- @apply scrollbar scrollbar-track-transparent scrollbar-thumb-accent scrollbar-thumb-rounded-full scrollbar-w-2 hover:scrollbar-thumb-accent-hover;
29
-
30
- --headers: calc(var(--header-height, 0px) + var(--subheader-height, 0px));
31
- top: var(--headers);
32
- width: var(--sidebar-width);
33
- height: calc(100vh - var(--headers));
34
-
35
- &,
36
- & ~ * {
37
- @media (min-width: 1024px) {
38
- --sidebar-width: 14rem;
39
- }
40
- }
41
- }
42
- }
43
- </style> -->
@@ -1,17 +0,0 @@
1
- ---
2
- _layout: block
3
- title: Feature
4
- ---
5
-
6
- ```astro live
7
- ---
8
- import Feature1 from 'fulldev-ui/blocks/Feature1.astro'
9
- ---
10
-
11
- <Feature1
12
- heading="Lorem ipsum dolor sit"
13
- paragraph="Lorem ipsum dolor sit amet consectetur ades"
14
- buttons={[{ text: 'Lorem ipsum' }, { text: 'Lorem ipsum' }]}
15
- image={{ src: '/images/placeholder-landscape.webp' }}
16
- />
17
- ```
@@ -1,80 +0,0 @@
1
- ---
2
- _layout: doc
3
- title: Using Layouts
4
- description: Ready to use layouts and page generation.
5
- ---
6
-
7
- ## Regular usage
8
-
9
- ```astro
10
- ---
11
- import Page from 'fulldev-ui/layouts/Page.astro'
12
- ---
13
-
14
- <Page
15
- title="Your meta title"
16
- description="Your meta description"
17
- banner={{
18
- text: 'This is a banner',
19
- }}
20
- header={{
21
- logo: {
22
- image: '/favicon/android-chrome-512x512.png',
23
- text: 'Fulldev UI',
24
- },
25
- links: [{ text: 'Docs', href: '/docs/' }],
26
- socials: [
27
- 'https://github.com/fulldotdev/ui',
28
- 'https://discord.gg/vXZqMbadm8',
29
- ],
30
- }}
31
- />
32
- ```
33
-
34
- ## Dynamic page generation
35
-
36
- To generate pages dynamically, you need to enable page generation in your `astro.config.ts` file.
37
-
38
- ```ts
39
- // astro.config.ts
40
- import { defineConfig } from 'astro/config'
41
- import fulldev from 'fulldev-ui/integration'
42
-
43
- export default defineConfig({
44
- integrations: [
45
- fulldev({
46
- injectRoutes: true,
47
- }),
48
- ],
49
- })
50
- ```
51
-
52
- ### Configuring collections
53
-
54
- There are two types of collections:
55
-
56
- 1. `pages`: Used for generating pages and/or cards.
57
- 2. `layouts`: Default values that can be referenced by pages
58
-
59
- Create a content collections config file at `src/content/config.ts`, and add the following content:
60
-
61
- ```ts
62
- // src/content/config.ts
63
- import { defineCollection } from 'astro:content'
64
- import { pageSchema } from 'fulldev-ui/schemas/page.ts'
65
-
66
- export const collections = {
67
- pages: defineCollection({
68
- type: 'content',
69
- schema: pageSchema,
70
- }),
71
- layouts: defineCollection({
72
- type: 'data',
73
- schema: pageSchema,
74
- }),
75
- }
76
- ```
77
-
78
- #### Pages
79
-
80
- Please reference `fulldev-ui/schemas/page.ts` for more information on the page schema.
@@ -1,81 +0,0 @@
1
- ---
2
- import type { ComponentProps } from 'astro/types'
3
- import type { CollectionEntry } from 'astro:content'
4
- import Footer from 'fulldev-ui/blocks/Footer.astro'
5
- import Header from 'fulldev-ui/blocks/Header.astro'
6
- import Heading from 'fulldev-ui/components/Heading.astro'
7
- import Menus from 'fulldev-ui/components/Menus.astro'
8
- import Paragraph from 'fulldev-ui/components/Paragraph.astro'
9
- import type { PageSchema } from 'fulldev-ui/schemas/page.ts'
10
- import Container from 'fulldev-ui/structures/Container.astro'
11
- import Layout from 'fulldev-ui/structures/Layout.astro'
12
- import Prose from 'fulldev-ui/structures/Prose.astro'
13
- import Sidebar from 'fulldev-ui/structures/Sidebar.astro'
14
-
15
- type Props = ComponentProps<typeof Layout> &
16
- PageSchema & {
17
- render: CollectionEntry<'pages'>['render']
18
- }
19
-
20
- const { header, sidebar, render, title, description, footer } = Astro.props
21
-
22
- const { Content } = await render()
23
- ---
24
-
25
- <Layout
26
- class:list="block"
27
- {...Astro.props}
28
- >
29
- <Header
30
- {...sidebar}
31
- {...header}
32
- />
33
- <Container
34
- class:list="block-main"
35
- as="main"
36
- >
37
- <Sidebar>
38
- <Menus
39
- size="sm"
40
- menus={sidebar?.menus}
41
- />
42
- </Sidebar>
43
- <Container class:list="block-container">
44
- <Prose class:list="block-prose">
45
- <Heading
46
- size="4xl"
47
- as="h1"
48
- text={title}
49
- />
50
- <Paragraph
51
- muted
52
- text={description}
53
- />
54
- <Content />
55
- </Prose>
56
- </Container>
57
- </Container>
58
- <Footer {...footer} />
59
- </Layout>
60
-
61
- <style is:global>
62
- @layer fulldev {
63
- .block {
64
- .block-main {
65
- @apply flex w-full items-start justify-between !px-0;
66
- }
67
-
68
- .block-container {
69
- max-width: calc(100% - var(--sidebar-width)) !important;
70
- }
71
-
72
- .sidebar {
73
- @apply hidden lg:flex;
74
- }
75
-
76
- .block-prose {
77
- @apply mx-auto max-w-none py-8;
78
- }
79
- }
80
- }
81
- </style>
@@ -1,136 +0,0 @@
1
- <!-- ---
2
- import type { ComponentProps } from 'astro/types'
3
- import type { CollectionEntry } from 'astro:content'
4
- import { getCollection } from 'astro:content'
5
- import Products1 from 'fulldev-ui/blocks/Products1.astro'
6
- import Carousel from 'fulldev-ui/components/Carousel.astro'
7
- import Element from 'fulldev-ui/components/Element.astro'
8
- import Select from 'fulldev-ui/components/Select.astro'
9
- import type { PageSchema } from 'fulldev-ui/schemas/page.ts'
10
- import Layout from 'fulldev-ui/structures/Layout.astro'
11
- import Prose from 'fulldev-ui/structures/Prose.astro'
12
- import { getHref } from 'fulldev-ui/utils/getHref.ts'
13
-
14
- interface Props extends ComponentProps<typeof Layout>, PageSchema {
15
- render: CollectionEntry<'pages'>['render']
16
- slug: CollectionEntry<'pages'>['slug']
17
- }
18
-
19
- const { render, slug, title, description } = Astro.props
20
-
21
- const categories = await getCollection('pages', ({ data }) =>
22
- data.categories?.some((c) => c.slug.includes(slug))
23
- )
24
-
25
- const products = await getCollection('pages', ({ data }) =>
26
- data.categories?.some((c) => c.slug.includes(slug))
27
- )
28
-
29
- const sorts = [
30
- {
31
- option: 'Aanbevolen',
32
- products: [...products].sort(
33
- (a, b) => (a.data.order || 0) - (b.data.order || 0)
34
- ),
35
- },
36
- {
37
- option: 'Prijs (laag - hoog)',
38
- products: [...products].sort(
39
- (a, b) => (a.data.price || 0) - (b.data.price || 0)
40
- ),
41
- },
42
- {
43
- option: 'Prijs (hoog - laag)',
44
- products: [...products].sort(
45
- (a, b) => (b.data.price || 0) - (a.data.price || 0)
46
- ),
47
- },
48
- {
49
- option: 'Alfabetisch (A-Z)',
50
- products: [...products],
51
- },
52
- {
53
- option: 'Alfabetisch (Z-A)',
54
- products: [...products].sort((a, b) =>
55
- (b.data.title || '').localeCompare(a.data.title || '')
56
- ),
57
- },
58
- ]
59
- ---
60
-
61
- <script>
62
- document.addEventListener('astro:page-load', () => {
63
- const sort = document.querySelector('.sort')
64
-
65
- sort?.addEventListener('change', (e) => {
66
- const blocks = document.querySelectorAll('.products')
67
- const value = (e.target as HTMLSelectElement).value
68
- blocks?.forEach((block) => block.classList.add('hide'))
69
-
70
- const block = document.querySelector(`.products[id='${value}']`)
71
- block?.classList.remove('hide')
72
- })
73
- })
74
- </script>
75
-
76
- <Layout
77
- class:list="category"
78
- {...Astro.props}
79
- >
80
- <Intro1
81
- heading={title}
82
- text={description}
83
- />
84
- <Carousel>
85
- {
86
- categories.map((category) => (
87
- <Element
88
- as="a"
89
- class:list="item"
90
- href={getHref(category.slug)}
91
- >
92
- {category.data.title}
93
- </Element>
94
- ))
95
- }
96
- </Carousel>
97
- <Element class:list="toolbar">
98
- <span>{products.length} resultaten</span>
99
- <Select
100
- class:list="sort"
101
- size="sm"
102
- name="Sorteren"
103
- options={sorts.map((sort) => sort.option)}
104
- />
105
- </Element>
106
- {
107
- sorts.map((sort: any) => (
108
- <Products1
109
- class:list={sort.option !== 'Aanbevolen' ? 'hide' : ''}
110
- products={sort.products}
111
- />
112
- ))
113
- }
114
- <Prose {render} />
115
- <slot />
116
- </Layout>
117
-
118
- <style is:global>
119
- .carousel {
120
- .item {
121
- @apply min-w-48 rounded-sm border p-4 text-sm;
122
- }
123
- }
124
-
125
- .products.hide {
126
- @apply hidden;
127
- }
128
-
129
- .toolbar {
130
- @apply container flex items-center justify-between pt-8;
131
-
132
- span {
133
- @apply text-sm text-muted-foreground;
134
- }
135
- }
136
- </style> -->