fulldev-ui 0.6.0-beta.2 → 0.6.0-beta.3

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 (183) hide show
  1. package/package.json +1 -1
  2. package/src/blocks/Banner1.astro +35 -0
  3. package/src/blocks/Contact1.astro +92 -0
  4. package/src/blocks/Cta1.astro +72 -0
  5. package/src/blocks/Feature1.astro +67 -0
  6. package/src/blocks/Footer.astro +47 -54
  7. package/src/blocks/Header1.astro +192 -0
  8. package/src/blocks/Hero1.astro +74 -0
  9. package/src/blocks/Intro1.astro +56 -0
  10. package/src/blocks/Products1.astro +90 -0
  11. package/src/blocks/{Hero.astro → _Hero.astro} +7 -6
  12. package/src/components/Badge.astro +10 -18
  13. package/src/components/Banner.astro +26 -0
  14. package/src/components/Block.astro +49 -0
  15. package/src/components/Blocks.astro +26 -0
  16. package/src/components/Button.astro +10 -23
  17. package/src/components/Card.astro +8 -150
  18. package/src/components/Cart.astro +1 -0
  19. package/src/components/CartSummary.astro +3 -3
  20. package/src/components/Channel.astro +5 -14
  21. package/src/components/Container.astro +25 -0
  22. package/src/components/Drawer.astro +57 -118
  23. package/src/components/DrawerOld.astro +143 -0
  24. package/src/components/Element.astro +2 -0
  25. package/src/components/Form.astro +5 -3
  26. package/src/components/Head.astro +18 -32
  27. package/src/components/Header.astro +8 -105
  28. package/src/components/Heading.astro +29 -70
  29. package/src/components/Icon.astro +6 -4
  30. package/src/components/Link.astro +12 -18
  31. package/src/components/Logo.astro +31 -18
  32. package/src/components/Navigation.astro +39 -0
  33. package/src/components/Panel.astro +25 -0
  34. package/src/components/Paragraph.astro +24 -7
  35. package/src/components/Price.astro +4 -4
  36. package/src/components/Prose.astro +41 -132
  37. package/src/components/Rating.astro +24 -75
  38. package/src/components/Search.astro +4 -3
  39. package/src/components/Section.astro +20 -29
  40. package/src/components/Sidebar.astro +44 -64
  41. package/src/components/Social.astro +9 -2
  42. package/src/components/Tagline.astro +21 -31
  43. package/src/components/Toc.astro +12 -3
  44. package/src/components/_Author.astro +90 -0
  45. package/src/components/_Header.astro +129 -0
  46. package/src/components/_Prose copy.astro +172 -0
  47. package/src/components/_Sidebar copy.astro +87 -0
  48. package/src/content/categories/category.md +7 -0
  49. package/src/content/config.ts +7 -8
  50. package/src/content/docs/components/text.mdx +47 -0
  51. package/src/content/docs/components.mdx +1 -4
  52. package/src/content/docs/index.mdx +1 -4
  53. package/src/content/layouts/base.yml +41 -80
  54. package/src/content/layouts/docs.yml +2 -70
  55. package/src/content/pages/index.mdx +17 -25
  56. package/src/content/{categories/mugs.md → posts/post.md} +1 -1
  57. package/src/content/products/product.md +3 -3
  58. package/src/css/theme.css +2 -0
  59. package/src/images/favicon/android-chrome-192x192.png +0 -0
  60. package/src/images/favicon/android-chrome-512x512.png +0 -0
  61. package/src/images/favicon/apple-touch-icon.png +0 -0
  62. package/src/images/favicon/browserconfig.xml +9 -0
  63. package/src/images/favicon/favicon-16x16.png +0 -0
  64. package/src/images/favicon/favicon-32x32.png +0 -0
  65. package/src/images/favicon/favicon-48x48.png +0 -0
  66. package/src/images/favicon/favicon.ico +0 -0
  67. package/src/images/favicon/favicon.svg +16 -0
  68. package/src/images/favicon/manifest.webmanifest +30 -0
  69. package/src/images/favicon/mstile-150x150.png +0 -0
  70. package/src/images/favicon/safari-pinned-tab.svg +16 -0
  71. package/src/images/favicon/yandex-browser-50x50.png +0 -0
  72. package/src/images/favicon/yandex-browser-manifest.json +9 -0
  73. package/src/integration/index.ts +10 -1
  74. package/src/layouts/CategoryLayout.astro +16 -9
  75. package/src/layouts/DocLayout.astro +49 -7
  76. package/src/layouts/Layout.astro +55 -27
  77. package/src/layouts/PageLayout.astro +12 -5
  78. package/src/layouts/PostLayout.astro +7 -5
  79. package/src/layouts/ProductLayout.astro +12 -7
  80. package/src/pages/test.astro +7 -1
  81. package/src/schemas/blocks/banner.ts +10 -0
  82. package/src/schemas/blocks/categories.ts +14 -0
  83. package/src/schemas/blocks/contact.ts +18 -0
  84. package/src/schemas/blocks/cta.ts +18 -0
  85. package/src/schemas/blocks/feature.ts +18 -0
  86. package/src/schemas/blocks/hero.ts +20 -0
  87. package/src/schemas/blocks/intro.ts +16 -0
  88. package/src/schemas/blocks/products.ts +14 -0
  89. package/src/schemas/categorySchema.ts +8 -8
  90. package/src/schemas/components/avatar.ts +4 -1
  91. package/src/schemas/components/badge.ts +16 -11
  92. package/src/schemas/components/block.ts +18 -0
  93. package/src/schemas/components/button.ts +13 -19
  94. package/src/schemas/components/channel.ts +15 -9
  95. package/src/schemas/components/footer.ts +15 -14
  96. package/src/schemas/components/head.ts +17 -0
  97. package/src/schemas/components/header.ts +19 -16
  98. package/src/schemas/components/heading.ts +7 -1
  99. package/src/schemas/components/icon.ts +7 -1
  100. package/src/schemas/components/image.ts +17 -14
  101. package/src/schemas/components/link.ts +10 -16
  102. package/src/schemas/components/logo.ts +12 -2
  103. package/src/schemas/components/menu.ts +11 -13
  104. package/src/schemas/components/navigation.ts +10 -0
  105. package/src/schemas/components/paragraph.ts +9 -0
  106. package/src/schemas/components/price.ts +9 -0
  107. package/src/schemas/components/rating.ts +8 -13
  108. package/src/schemas/components/sidebar.ts +14 -12
  109. package/src/schemas/components/social.ts +16 -1
  110. package/src/schemas/components/tagline.ts +7 -1
  111. package/src/schemas/docSchema.ts +6 -2
  112. package/src/schemas/imageSchema.ts +30 -1
  113. package/src/schemas/layoutSchema.ts +14 -20
  114. package/src/schemas/pageSchema.ts +9 -12
  115. package/src/schemas/postSchema.ts +6 -8
  116. package/src/schemas/productSchema.ts +18 -18
  117. package/src/types/global-props.ts +0 -9
  118. package/src/types/{virtual-modules.d.ts → virtual.d.ts} +1 -1
  119. package/src/utils/getHref.ts +3 -2
  120. package/tsconfig.json +1 -3
  121. package/example.svelte +0 -0
  122. package/parent.svelte +0 -0
  123. package/src/App.svelte +0 -0
  124. package/src/blocks/Banner.astro +0 -35
  125. package/src/blocks/Categories.astro +0 -12
  126. package/src/blocks/Colleagues.astro +0 -12
  127. package/src/blocks/Contact.astro +0 -117
  128. package/src/blocks/Content.astro +0 -130
  129. package/src/blocks/Cta.astro +0 -13
  130. package/src/blocks/Excerpt.astro +0 -12
  131. package/src/blocks/Features.astro +0 -11
  132. package/src/blocks/Header.astro +0 -7
  133. package/src/blocks/Intro.astro +0 -101
  134. package/src/blocks/Jobs.astro +0 -12
  135. package/src/blocks/Posts.astro +0 -11
  136. package/src/blocks/Prices.astro +0 -24
  137. package/src/blocks/Product.astro +0 -89
  138. package/src/blocks/Products.astro +0 -101
  139. package/src/blocks/Reviews.astro +0 -12
  140. package/src/blocks/_Contact.astro +0 -112
  141. package/src/components/CartForm.astro +0 -120
  142. package/src/components/CartList.astro +0 -122
  143. package/src/components/Lead.astro +0 -46
  144. package/src/components/ProductCard.astro +0 -52
  145. package/src/components/Text.astro +0 -43
  146. package/src/components/Writeup.astro +0 -108
  147. package/src/components/_CartList backup.astro +0 -125
  148. package/src/components/_CartList copy.astro +0 -213
  149. package/src/components/_CartListSimple.astro +0 -148
  150. package/src/components/sections.astro +0 -28
  151. package/src/content/docs/components/lead.mdx +0 -49
  152. package/src/content/docs/components/paragraph.mdx +0 -49
  153. package/src/loaders/imageLoader.ts +0 -26
  154. package/src/schemas/archive/_pageSchema.ts +0 -94
  155. package/src/schemas/components/avatars.ts +0 -4
  156. package/src/schemas/components/banner.ts +0 -3
  157. package/src/schemas/components/buttons.ts +0 -4
  158. package/src/schemas/components/card.ts +0 -43
  159. package/src/schemas/components/cards.ts +0 -4
  160. package/src/schemas/components/channels.ts +0 -4
  161. package/src/schemas/components/global.ts +0 -16
  162. package/src/schemas/components/links.ts +0 -4
  163. package/src/schemas/components/list.ts +0 -3
  164. package/src/schemas/components/section.ts +0 -17
  165. package/src/schemas/components/sections.ts +0 -3
  166. package/src/schemas/components/socials.ts +0 -4
  167. package/src/schemas/components/subheader.ts +0 -10
  168. package/src/schemas/components/text.ts +0 -3
  169. package/src/schemas/components/themer.ts +0 -3
  170. package/src/schemas/components/toc.ts +0 -3
  171. package/src/schemas/components/writeup.ts +0 -20
  172. package/src/schemas/fields/categories.ts +0 -3
  173. package/src/schemas/fields/description.ts +0 -3
  174. package/src/schemas/fields/href.ts +0 -3
  175. package/src/schemas/fields/image.ts +0 -24
  176. package/src/schemas/fields/images.ts +0 -4
  177. package/src/schemas/fields/order.ts +0 -3
  178. package/src/schemas/fields/price.ts +0 -3
  179. package/src/schemas/fields/products.ts +0 -5
  180. package/src/schemas/fields/seo.ts +0 -12
  181. package/src/schemas/fields/soldout.ts +0 -3
  182. package/src/schemas/fields/title.ts +0 -3
  183. package/src/schemas/fields/variants.ts +0 -3
@@ -1,122 +0,0 @@
1
- ---
2
- import Element from 'fulldev-ui/components/Element.astro'
3
- import { scope } from 'simple:scope'
4
- import Button from './Button.astro'
5
- import Heading from './Heading.astro'
6
- import Input from './Input.astro'
7
- import Price from './Price.astro'
8
-
9
- const { ...rest } = Astro.props
10
- ---
11
-
12
- <RootElement>
13
- <Element
14
- data-target={scope('list')}
15
- class:list={'cart-list'}
16
- if={true}
17
- {...rest}
18
- />
19
-
20
- <template data-target={scope('template')}>
21
- <Element class="cart-list-card">
22
- <img class="image" />
23
- <Element class="cart-list-card-segment">
24
- <Element class="cart-list-card-content">
25
- <Heading
26
- if
27
- level={6}
28
- />
29
- <Price if />
30
- </Element>
31
- <Element class="cart-list-card-actions">
32
- <Input
33
- type="number"
34
- name="quantity"
35
- value={1}
36
- min={0}
37
- />
38
- <Button
39
- type="button"
40
- variant="outline"
41
- icon="trash"
42
- type="button"
43
- />
44
- </Element>
45
- </Element>
46
- </Element>
47
- </template>
48
- </RootElement>
49
-
50
- <script>
51
- import { $cart, removeItem, updateQuantity } from 'fulldev-ui/stores/cart.ts'
52
- import { formatPrice } from 'fulldev-ui/utils/cart'
53
-
54
- RootElement.ready(($) => {
55
- $cart.subscribe((items) => {
56
- const list = $('list')
57
- const template = $('template') as HTMLTemplateElement
58
-
59
- // list.innerHTML = ''
60
- items.forEach((item) => {
61
- const clone = template?.content.cloneNode(true) as HTMLElement
62
- const clonedCard = clone.querySelector('.cart-list-card') as HTMLElement
63
- const existingCard = list.querySelector(`[data-slug="${item.slug}"]`)
64
- const card = existingCard || (clonedCard as HTMLElement)
65
- const heading = card.querySelector('.heading') as HTMLElement
66
- const price = card.querySelector('.price') as HTMLElement
67
- const image = card.querySelector('.image') as HTMLImageElement
68
- const remove = card.querySelector('.button') as HTMLButtonElement
69
- const quantity = card.querySelector('.input') as HTMLInputElement
70
-
71
- card.dataset.slug = item.slug
72
- heading.textContent = item.title
73
- price.textContent = formatPrice(item.price)
74
- image.src = item.image
75
-
76
- remove.addEventListener('click', () => removeItem(item.slug))
77
-
78
- quantity.addEventListener('change', (e) => {
79
- console.log('blur')
80
- const target = e.target as HTMLInputElement
81
- const value = Number(target.value)
82
- updateQuantity(item.slug, value)
83
- })
84
-
85
- $('list').appendChild(clone)
86
- })
87
- })
88
- })
89
- </script>
90
-
91
- <style is:global>
92
- @layer fulldev {
93
- .cart-list {
94
- @apply flex flex-col text-foreground;
95
-
96
- .cart-list-card {
97
- @apply flex w-full gap-5;
98
-
99
- &:not(:first-child) {
100
- @apply mt-5 border-t pt-5;
101
- }
102
- }
103
-
104
- .image {
105
- @apply block h-auto w-24;
106
- }
107
-
108
- .cart-list-card-segment {
109
- @apply flex h-full w-full flex-col justify-between gap-4;
110
- }
111
-
112
- .cart-list-card-content,
113
- .cart-list-card-actions {
114
- @apply flex justify-between gap-2;
115
- }
116
-
117
- .input {
118
- @apply w-16;
119
- }
120
- }
121
- }
122
- </style>
@@ -1,46 +0,0 @@
1
- ---
2
- import type { HTMLAttributes, HTMLTag } from 'astro/types'
3
- import Element from 'fulldev-ui/components/Element.astro'
4
- import type { GlobalProps } from 'fulldev-ui/types/global-props'
5
-
6
- interface Props extends GlobalProps, HTMLAttributes<'p'> {
7
- as?: HTMLTag
8
- text?: string | undefined
9
- }
10
-
11
- const { as = 'p', text, ...rest } = Astro.props
12
- ---
13
-
14
- <Element
15
- class:list="lead"
16
- {as}
17
- {...rest}
18
- >
19
- <slot />
20
- <Fragment set:html={text} />
21
- </Element>
22
-
23
- <style is:global>
24
- @layer fulldev {
25
- .lead,
26
- .prose-content h1 + p {
27
- @apply text-muted-foreground;
28
-
29
- &.size-sm {
30
- @apply text-sm;
31
- }
32
-
33
- &.size-md {
34
- @apply text-base;
35
- }
36
-
37
- &.size-lg {
38
- @apply text-lg;
39
-
40
- &:is(h1 + p) {
41
- @apply text-xl;
42
- }
43
- }
44
- }
45
- }
46
- </style>
@@ -1,52 +0,0 @@
1
- ---
2
- import type { CollectionEntry } from 'astro:content'
3
- import Element from 'fulldev-ui/components/Element.astro'
4
- import Heading from 'fulldev-ui/components/Heading.astro'
5
- import Image from 'fulldev-ui/components/Image.astro'
6
- import Price from 'fulldev-ui/components/Price.astro'
7
- import type { ProductSchema } from 'fulldev-ui/schemas/productSchema'
8
-
9
- interface Props extends ProductSchema {
10
- slug?: CollectionEntry<'products'>['slug']
11
- }
12
-
13
- const { slug, images, title, price, ...rest } = Astro.props
14
- ---
15
-
16
- <Element
17
- class:list="product-card"
18
- as="a"
19
- href={`/producten/${slug}/`}
20
- {...rest}
21
- >
22
- <Image {...images?.[0]} />
23
- <Element class:list="product-card-content">
24
- <Heading
25
- as="h3"
26
- level={5}
27
- size={'sm'}
28
- text={title}
29
- />
30
- <Price value={price} />
31
- </Element>
32
- </Element>
33
-
34
- <style is:global>
35
- @layer fulldev {
36
- .product-card {
37
- @apply relative flex flex-col gap-3;
38
-
39
- &:hover > .image {
40
- @apply opacity-75 transition-opacity;
41
- }
42
-
43
- .image {
44
- @apply rounded-md border;
45
- }
46
-
47
- .product-card-content {
48
- @apply flex h-full flex-col gap-2;
49
- }
50
- }
51
- }
52
- </style>
@@ -1,43 +0,0 @@
1
- ---
2
- import type { HTMLAttributes } from 'astro/types'
3
- import Element from 'fulldev-ui/components/Element.astro'
4
-
5
- interface Props extends HTMLAttributes<'p'> {
6
- size?: 'sm' | 'md' | 'lg' | undefined
7
- color?: 'base' | 'brand' | undefined
8
- theme?: 'light' | 'dark' | undefined
9
- contrast?: boolean | undefined
10
- lead?: boolean | undefined
11
- text?: string | undefined
12
- if?: any
13
- }
14
-
15
- const { color = 'base', text, ...rest } = Astro.props
16
- ---
17
-
18
- <Element
19
- class:list="text"
20
- as="p"
21
- {color}
22
- {...rest}
23
- >
24
- <slot />
25
- <Fragment set:html={text} />
26
- </Element>
27
-
28
- <style is:global>
29
- @layer fulldev {
30
- .text {
31
- margin: 0;
32
- max-width: calc(var(--space-4) * 44);
33
- color: var(--color-11);
34
- font-size: var(--text-3);
35
- line-height: 1.625;
36
-
37
- &.lead {
38
- font-size: var(--text-4);
39
- text-wrap: balance;
40
- }
41
- }
42
- }
43
- </style>
@@ -1,108 +0,0 @@
1
- ---
2
- import type { ComponentProps, HTMLAttributes } from 'astro/types'
3
- import Badge from 'fulldev-ui/components/Badge.astro'
4
- import Element from 'fulldev-ui/components/Element.astro'
5
- import Heading from 'fulldev-ui/components/Heading.astro'
6
- import List from 'fulldev-ui/components/List.astro'
7
- import Price from 'fulldev-ui/components/Price.astro'
8
- import Rating from 'fulldev-ui/components/Rating.astro'
9
- import Tagline from 'fulldev-ui/components/Tagline.astro'
10
- import Text from 'fulldev-ui/components/Text.astro'
11
- import type { GlobalProps } from 'fulldev-ui/types/global-props'
12
- import Lead from './Lead.astro'
13
- import Paragraph from './Paragraph.astro'
14
-
15
- interface Props extends GlobalProps, HTMLAttributes<'div'> {
16
- level?: ComponentProps<typeof Heading>['level']
17
- badge?: ComponentProps<typeof Badge> | undefined
18
- tagline?: ComponentProps<typeof Tagline>['text']
19
- heading?: ComponentProps<typeof Heading>['text']
20
- lead?: ComponentProps<typeof Lead>['text']
21
- paragraph?: ComponentProps<typeof Paragraph>['text']
22
- text?: ComponentProps<typeof Text>['text']
23
- list?: ComponentProps<typeof List>['items']
24
- align?: 'start' | 'center' | 'end' | undefined
25
- price?: ComponentProps<typeof Price>['value']
26
- rating?:
27
- | ComponentProps<typeof Rating>
28
- | ComponentProps<typeof Rating>['value']
29
- }
30
-
31
- const {
32
- level = 2,
33
- rating,
34
- badge,
35
- tagline,
36
- heading,
37
- lead,
38
- paragraph,
39
- text,
40
- list,
41
- price,
42
- size,
43
- ...rest
44
- } = Astro.props
45
- ---
46
-
47
- <Element
48
- class:list="writeup"
49
- {size}
50
- {...rest}
51
- >
52
- <slot>
53
- <Rating
54
- {size}
55
- {...typeof rating === 'number' ? { value: rating } : rating}
56
- />
57
- <Tagline text={tagline} />
58
- <Badge
59
- {size}
60
- {...badge}
61
- />
62
- <Heading
63
- {size}
64
- {level}
65
- text={heading}
66
- />
67
- <Lead
68
- {size}
69
- text={lead}
70
- />
71
- <Paragraph
72
- {size}
73
- text={paragraph}
74
- />
75
- <List
76
- items={list}
77
- {size}
78
- />
79
- <Price value={price} />
80
- </slot>
81
- </Element>
82
-
83
- <style is:global>
84
- @layer fulldev {
85
- .writeup {
86
- display: flex;
87
- position: relative;
88
- flex-direction: column;
89
- align-items: inherit;
90
- text-align: inherit;
91
-
92
- &.align-start {
93
- align-items: flex-start;
94
- text-align: left;
95
- }
96
-
97
- &.align-center {
98
- align-items: center;
99
- text-align: center;
100
- }
101
-
102
- &.align-end {
103
- align-items: flex-end;
104
- text-align: right;
105
- }
106
- }
107
- }
108
- </style>
@@ -1,125 +0,0 @@
1
- <!-- ---
2
- import Element from 'fulldev-ui/components/Element.astro'
3
- import Image from 'fulldev-ui/components/Image.astro'
4
- import Button from './Button.astro'
5
- import Heading from './Heading.astro'
6
- import Input from './Input.astro'
7
- import Price from './Price.astro'
8
-
9
- const { ...rest } = Astro.props
10
- ---
11
-
12
- <Element
13
- if={true}
14
- class:list="cart-list"
15
- {...rest}
16
- />
17
-
18
- <template id="cart-list-template">
19
- <Element class="cart-list-card">
20
- <Image src="/placeholder-portrait.webp" />
21
- <Element class="cart-list-card-segment">
22
- <Element class="cart-list-card-content">
23
- <Heading
24
- level={6}
25
- text="Product title"
26
- />
27
- <Price value={999} />
28
- </Element>
29
- <Element class="cart-list-card-actions">
30
- <Input
31
- type="number"
32
- name="quantity"
33
- value={1}
34
- min={0}
35
- />
36
- <Button
37
- variant="outline"
38
- icon="trash"
39
- type="button"
40
- />
41
- </Element>
42
- </Element>
43
- </Element>
44
- </template>
45
-
46
- <script>
47
- import { $cart } from 'fulldev-ui/stores/cart.ts'
48
- import { formatPrice } from 'fulldev-ui/utils/cart'
49
-
50
- function setCards(items: any) {
51
- const template = document.querySelector('template')
52
- const container = document.querySelector('.cart-list')
53
- if (!(container instanceof HTMLElement)) return
54
- if (!(template instanceof HTMLTemplateElement)) return
55
-
56
- container.innerHTML = ''
57
-
58
- items.forEach((item: any, index: number) => {
59
- const clone = template?.content.cloneNode(true)
60
- if (!(clone instanceof DocumentFragment)) return
61
- const card = clone.querySelector('.cart-list-card')
62
- if (!card) return
63
-
64
- const image = card.querySelector('img')
65
- const heading = card.querySelector('.heading')
66
- const price = card.querySelector('.price')
67
- // const input = card.querySelector('.input-input')
68
- const remove = card.querySelector('.button')
69
-
70
- if (image) image.src = item.image
71
- if (heading) heading.textContent = item.name
72
- if (price) price.textContent = formatPrice(item.price)
73
-
74
- remove?.addEventListener('click', () => {
75
- const currentCart = $cart.get()
76
- const newCart = [...currentCart]
77
- newCart.splice(index, 1)
78
- $cart.set(newCart)
79
- })
80
-
81
- container.appendChild(clone)
82
- })
83
- }
84
-
85
- document.addEventListener('astro:page-load', () => {
86
- setCards($cart.get())
87
-
88
- $cart.subscribe((items: any) => {
89
- setCards(items)
90
- })
91
- })
92
- </script>
93
-
94
- <style is:global>
95
- @layer fulldev {
96
- .cart-list {
97
- @apply flex flex-col text-foreground;
98
-
99
- .cart-list-card {
100
- @apply flex w-full gap-5;
101
-
102
- &:not(:first-child) {
103
- @apply mt-5 border-t pt-5;
104
- }
105
- }
106
-
107
- .image {
108
- @apply block h-auto w-24;
109
- }
110
-
111
- .cart-list-card-segment {
112
- @apply flex h-full w-full flex-col justify-between gap-4;
113
- }
114
-
115
- .cart-list-card-content,
116
- .cart-list-card-actions {
117
- @apply flex justify-between gap-2;
118
- }
119
-
120
- .input {
121
- @apply w-16;
122
- }
123
- }
124
- }
125
- </style> -->
@@ -1,213 +0,0 @@
1
- <!-- ---
2
- import Element from 'fulldev-ui/components/Element.astro'
3
- import Image from 'fulldev-ui/components/Image.astro'
4
- import { $cart } from 'fulldev-ui/stores/cart.ts'
5
- import { formatPrice } from 'fulldev-ui/utils/cart'
6
- import Button from './Button.astro'
7
- import Card from './Card.astro'
8
- import Heading from './Heading.astro'
9
- import Input from './Input.astro'
10
- import Price from './Price.astro'
11
- import Text from './Text.astro'
12
-
13
- const { ...rest } = Astro.props
14
- ---
15
-
16
- <Element
17
- class:list="cart-list"
18
- {...rest}
19
- >
20
- <template id="cart-card-template">
21
- <Element class="cart-card">
22
- <Image src="/placeholder-portrait.webp" />
23
- <Element class="cart-card-segment">
24
- <Element class="cart-card-content">
25
- <Heading
26
- level={6}
27
- text="Product title"
28
- />
29
- <Price value={999} />
30
- </Element>
31
- <Element class="cart-card-actions">
32
- <Input
33
- type="number"
34
- name="quantity"
35
- value={1}
36
- min={0}
37
- />
38
- <Button
39
- variant="outline"
40
- icon="trash"
41
- type="button"
42
- />
43
- </Element>
44
- </Element>
45
- </Element>
46
- </template>
47
- </Element>
48
- <Element
49
- if
50
- class:list="cart-list"
51
- {...rest}
52
- />
53
-
54
- <template>
55
- <Card class="cart-list-card">
56
- <img class="cart-list-image image" />
57
- <Element class="column">
58
- <Heading
59
- if
60
- level={4}
61
- class="heading"
62
- />
63
- <Element class="row">
64
- <Text
65
- if
66
- class="cart-list-price"
67
- />
68
- <Button
69
- class:list="cart-list-remove"
70
- variant="ghost"
71
- icon="trash"
72
- type="button"
73
- />
74
- </Element>
75
- </Element>
76
- </Card>
77
- </template>
78
-
79
- <script>
80
- import { $cart } from 'fulldev-ui/stores/cart.ts'
81
- import { formatPrice } from 'fulldev-ui/utils/cart'
82
-
83
- function setCards(items: any) {
84
- const template = document.querySelector('template')
85
- const container = document.querySelector('.cart-list')
86
-
87
- if (!container || !template) return
88
-
89
- container.innerHTML = ''
90
-
91
- items.forEach((item: any, index: number) => {
92
- const clone = template?.content.cloneNode(true)
93
- if (!(clone instanceof DocumentFragment)) return
94
- const card = clone.querySelector('.cart-card')
95
- if (!card) return
96
-
97
- const img = card.querySelector('img')
98
- if (img) img.src = item.image
99
-
100
- const h4 = card.querySelector('h4')
101
- if (h4) h4.textContent = item.name
102
-
103
- const p = card.querySelector('p')
104
- if (p) p.textContent = formatPrice(item.price)
105
-
106
- const button = card.querySelector('button')
107
- if (button) {
108
- button.addEventListener('click', () => {
109
- const currentCart = $cart.get()
110
- const newCart = [...currentCart]
111
- newCart.splice(index, 1)
112
- $cart.set(newCart)
113
- })
114
- }
115
-
116
- container.appendChild(clone)
117
- })
118
- }
119
-
120
- document.addEventListener('astro:page-load', () => {
121
- setCards($cart.get())
122
-
123
- $cart.subscribe((items: any) => {
124
- setCards(items)
125
- })
126
- })
127
- </script>
128
-
129
- <script>
130
- function setCards(items: any) {
131
- const template = document.querySelector('template')
132
- const container = document.querySelector('.cart-list')
133
- if (!(container instanceof HTMLElement)) return
134
- if (!(template instanceof HTMLTemplateElement)) return
135
-
136
- container.innerHTML = ''
137
-
138
- items.forEach((item: any, index: number) => {
139
- const clone = template?.content.cloneNode(true)
140
- if (!(clone instanceof DocumentFragment)) return
141
- const card = clone.querySelector('.cart-list-card')
142
- if (!card) return
143
-
144
- const image = card.querySelector('img')
145
- const heading = card.querySelector('.heading')
146
- const price = card.querySelector('.price')
147
- // const input = card.querySelector('.input-input')
148
- const remove = card.querySelector('.button')
149
-
150
- if (image) image.src = item.image
151
- if (heading) heading.textContent = item.name
152
- if (price) price.textContent = formatPrice(item.price)
153
-
154
- remove?.addEventListener('click', () => {
155
- const currentCart = $cart.get()
156
- const newCart = [...currentCart]
157
- newCart.splice(index, 1)
158
- $cart.set(newCart)
159
- })
160
-
161
- container.appendChild(clone)
162
- })
163
- }
164
-
165
- document.addEventListener('astro:page-load', () => {
166
- setCards($cart.get())
167
-
168
- $cart.subscribe((items: any) => {
169
- setCards(items)
170
- })
171
- })
172
- </script>
173
-
174
- <style is:global>
175
- @layer fulldev {
176
- .cart-list {
177
- @apply flex flex-col text-foreground;
178
-
179
- .cart-card {
180
- @apply flex w-full gap-5;
181
-
182
- &:not(:first-child) {
183
- @apply mt-5 border-t pt-5;
184
- }
185
-
186
- .image {
187
- @apply block h-auto w-24;
188
- }
189
-
190
- .column {
191
- @apply flex h-full w-full flex-col justify-between gap-3;
192
- }
193
-
194
- .row {
195
- @apply flex w-full flex-row justify-between;
196
- }
197
- }
198
-
199
- .cart-card-segment {
200
- @apply flex h-full w-full flex-col justify-between gap-4;
201
- }
202
-
203
- .cart-card-content,
204
- .cart-card-actions {
205
- @apply flex justify-between gap-2;
206
- }
207
-
208
- .input {
209
- @apply w-16;
210
- }
211
- }
212
- }
213
- </style> -->-->