fulldev-ui 0.5.0-beta.15 → 0.5.0-beta.17

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fulldev-ui",
3
- "version": "0.5.0-beta.15",
3
+ "version": "0.5.0-beta.17",
4
4
  "description": "A component library built for Astro",
5
5
  "homepage": "https://ui.full.dev",
6
6
  "bugs": "https://github.com/fulldotdev/ui/issues",
@@ -24,6 +24,7 @@ const {
24
24
  button,
25
25
  description,
26
26
  form,
27
+ uitverkocht,
27
28
  gallery = 'horizontal',
28
29
  ...rest
29
30
  } = Astro.props
@@ -66,6 +67,7 @@ const gotImage =
66
67
  style={{ marginTop: 'var(--space-5)' }}
67
68
  />
68
69
  <CartForm
70
+ soldout={uitverkocht}
69
71
  image={gotImage?.src}
70
72
  {title}
71
73
  {price}
@@ -12,6 +12,7 @@ interface Props extends Omit<ComponentProps<typeof Form>, 'fields' | 'submit'> {
12
12
  slug: string
13
13
  price: number
14
14
  image?: string | undefined
15
+ soldout?: boolean
15
16
  variants?:
16
17
  | {
17
18
  [key: string]: string[]
@@ -19,7 +20,7 @@ interface Props extends Omit<ComponentProps<typeof Form>, 'fields' | 'submit'> {
19
20
  | undefined
20
21
  }
21
22
 
22
- const { title, slug, image, price, variants, ...rest } = Astro.props
23
+ const { title, slug, image, price, variants, soldout, ...rest } = Astro.props
23
24
  ---
24
25
 
25
26
  <Form
@@ -41,7 +42,6 @@ const { title, slug, image, price, variants, ...rest } = Astro.props
41
42
  name="url"
42
43
  value={Astro.site ? Astro.site.href + slug : undefined}
43
44
  />
44
-
45
45
  <Input
46
46
  type="hidden"
47
47
  name="image"
@@ -53,6 +53,7 @@ const { title, slug, image, price, variants, ...rest } = Astro.props
53
53
  label={capitalize(key)}
54
54
  name={`variant-${key}`}
55
55
  options={options}
56
+ disabled={soldout}
56
57
  />
57
58
  ))
58
59
  }
@@ -67,7 +68,8 @@ const { title, slug, image, price, variants, ...rest } = Astro.props
67
68
  color="brand"
68
69
  type="submit"
69
70
  class="cart-add"
70
- text="Toevoegen aan winkelwagen"
71
+ text={soldout ? 'Uitverkocht' : 'Toevoegen aan winkelwagen'}
72
+ disabled={soldout}
71
73
  />
72
74
  </Form>
73
75
 
@@ -1,6 +1,13 @@
1
1
  import { reference, z } from 'astro:content'
2
2
 
3
- export default z.union([reference('images'), z.object({}).passthrough()]).pipe(
3
+ const imagePath = z.preprocess((data: unknown) => {
4
+ if (typeof data === 'string') {
5
+ return data.split('/').pop()
6
+ }
7
+ return data
8
+ }, reference('images'))
9
+
10
+ export default z.union([imagePath, z.object({}).passthrough()]).pipe(
4
11
  z
5
12
  .object({
6
13
  id: z