fulldev-ui 0.5.0-beta.0 → 0.5.0-beta.10
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/CONTRIBUTING.md +10 -4
- package/astro.config.ts +4 -11
- package/package.json +5 -3
- package/pnpm-lock.yaml +6400 -0
- package/src/blocks/Article.astro +31 -12
- package/src/blocks/Banner.astro +2 -1
- package/src/blocks/Contact.astro +7 -30
- package/src/blocks/Excerpt.astro +14 -0
- package/src/blocks/Intro.astro +3 -1
- package/src/blocks/Product.astro +55 -22
- package/src/components/Card.astro +11 -5
- package/src/components/Cart.astro +38 -0
- package/src/components/CartForm.astro +121 -0
- package/src/components/CartList.astro +134 -0
- package/src/components/CartSummary.astro +147 -0
- package/src/components/Drawer.astro +128 -52
- package/src/components/Footer.astro +6 -3
- package/src/components/Form.astro +49 -0
- package/src/components/Header.astro +19 -14
- package/src/components/Image.astro +0 -1
- package/src/components/Input.astro +6 -0
- package/src/components/Menu.astro +56 -0
- package/src/components/Price.astro +7 -11
- package/src/components/Search.astro +1 -4
- package/src/components/Section.astro +2 -1
- package/src/components/Sidebar.astro +66 -105
- package/src/components/Social.astro +7 -0
- package/src/components/ThemeSelect.astro +3 -0
- package/src/components/Toc.astro +33 -94
- package/src/components/docs/PropsTable.astro +2 -2
- package/src/components/experimental/Form.astro +31 -5
- package/src/components/experimental/Gallery.astro +50 -126
- package/src/components/experimental/Prose.astro +32 -0
- package/src/content/pages/base/select.mdx +0 -8
- package/src/content/pages/base/textarea.mdx +0 -5
- package/src/content/pages/blocks/_product.mdx +73 -2
- package/src/content/pages/index.mdx +0 -3
- package/src/content/pages/layouts/_layout.mdx +14 -0
- package/src/content/pages/layouts/docslayout.mdx +10 -1
- package/src/content/pages/overview/components.mdx +5 -0
- package/src/content/pages/overview/content-collections.mdx +139 -0
- package/src/content/pages/overview/installation.mdx +25 -26
- package/src/content/pages/overview/introduction.mdx +16 -10
- package/src/content/pages/overview/theming.mdx +69 -0
- package/src/content/pages/schemas/page.mdx +6 -0
- package/src/content/presets/base.yml +57 -44
- package/src/content/presets/blocks.yml +0 -3
- package/src/content/presets/docs.yml +3 -62
- package/src/env.d.ts +1 -1
- package/src/integration/index.ts +49 -33
- package/src/layouts/DocsLayout.astro +23 -35
- package/src/layouts/Layout.astro +37 -21
- package/src/layouts/OverviewLayout.astro +17 -10
- package/src/layouts/PostLayout.astro +7 -7
- package/src/layouts/ProductLayout.astro +5 -2
- package/src/schemas/components/footer.ts +1 -0
- package/src/schemas/components/header.ts +1 -0
- package/src/schemas/components/menu.ts +13 -0
- package/src/schemas/components/sidebar.ts +15 -0
- package/src/schemas/components/toc.ts +3 -0
- package/src/schemas/pageSchema.ts +72 -34
- package/src/schemas/presetSchema.ts +2 -28
- package/src/schemas/utils/navigation.ts +6 -51
- package/src/stores/cart.ts +23 -0
- package/src/utils/cart.ts +36 -0
- package/src/utils/{getChildPages.ts → getFolderChildren.ts} +3 -1
- package/src/utils/{getCategoryPages.ts → getReferenceChildren.ts} +6 -3
- package/tsconfig.json +1 -3
- package/.astro/assets.mjs +0 -1
- package/.astro/astro/content.d.ts +0 -547
- package/.astro/collections/blocks.schema.json +0 -851
- package/.astro/collections/collections.json +0 -63
- package/.astro/collections/images.schema.json +0 -22
- package/.astro/collections/layouts.schema.json +0 -826
- package/.astro/collections/pages.schema.json +0 -568
- package/.astro/collections/presets.schema.json +0 -489
- package/.astro/collections/records.schema.json +0 -822
- package/.astro/collections/settings.schema.json +0 -822
- package/.astro/data-store.json +0 -1
- package/.astro/modules.mjs +0 -1
- package/.astro/settings.json +0 -5
- package/.astro/types.d.ts +0 -2
- package/src/components/experimental/GalleryVertical.astro +0 -161
- package/src/content/pages/layouts/layout.mdx +0 -21
- package/src/content/pages/layouts/pagelayout.mdx +0 -21
- package/src/content/pages/overview/content-layer.mdx +0 -128
- package/src/content/pages/overview/customization.mdx +0 -83
- package/src/layouts/ContentLayout.astro +0 -16
- package/src/layouts/PageLayout.astro +0 -15
- /package/src/schemas/utils/{categories.ts → parents.ts} +0 -0
- /package/src/types/{global-props.d.ts → global-props.ts} +0 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Button from './Button.astro'
|
|
3
|
+
import Element from './Element.astro'
|
|
4
|
+
import Price from './Price.astro'
|
|
5
|
+
import Text from './Text.astro'
|
|
6
|
+
|
|
7
|
+
interface Props {}
|
|
8
|
+
|
|
9
|
+
const { ...rest } = Astro.props
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<Element
|
|
13
|
+
size="md"
|
|
14
|
+
class="cart-summary"
|
|
15
|
+
>
|
|
16
|
+
<div
|
|
17
|
+
class="row"
|
|
18
|
+
{...rest}
|
|
19
|
+
>
|
|
20
|
+
<Text
|
|
21
|
+
class:list="total"
|
|
22
|
+
text="Totaal"
|
|
23
|
+
contrast
|
|
24
|
+
/>
|
|
25
|
+
<Price value={10} />
|
|
26
|
+
</div>
|
|
27
|
+
<Text
|
|
28
|
+
class:list="shipping"
|
|
29
|
+
text="Verzendkosten worden berekend bij het afrekenen."
|
|
30
|
+
/>
|
|
31
|
+
<Button
|
|
32
|
+
class:list="checkout-button"
|
|
33
|
+
variant="primary"
|
|
34
|
+
color="brand"
|
|
35
|
+
text="Afrekenen"
|
|
36
|
+
/>
|
|
37
|
+
</Element>
|
|
38
|
+
|
|
39
|
+
<style is:global lang="scss">
|
|
40
|
+
@layer fulldev {
|
|
41
|
+
.cart-summary {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
gap: var(--space-3);
|
|
45
|
+
|
|
46
|
+
.price,
|
|
47
|
+
.total {
|
|
48
|
+
font-size: var(--text-4);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.row {
|
|
52
|
+
display: flex;
|
|
53
|
+
justify-content: space-between;
|
|
54
|
+
align-items: center;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.shipping {
|
|
58
|
+
font-size: var(--text-1);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
</style>
|
|
63
|
+
|
|
64
|
+
<script>
|
|
65
|
+
import { $cart } from 'fulldev-ui/stores/cart.ts'
|
|
66
|
+
import { formatPrice } from 'fulldev-ui/utils/cart'
|
|
67
|
+
import Stripe from 'stripe'
|
|
68
|
+
|
|
69
|
+
const stripe = new Stripe(import.meta.env.PUBLIC_STRIPE_CHECKOUT_KEY)
|
|
70
|
+
|
|
71
|
+
function setPrice(items: any) {
|
|
72
|
+
const price = document.querySelector('.cart-summary .price')
|
|
73
|
+
if (price)
|
|
74
|
+
price.textContent = formatPrice(
|
|
75
|
+
items.reduce(
|
|
76
|
+
(acc: number, item: { price: number }) => acc + item.price,
|
|
77
|
+
0
|
|
78
|
+
)
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
document.addEventListener('astro:page-load', () => {
|
|
83
|
+
setPrice($cart.get())
|
|
84
|
+
|
|
85
|
+
$cart.subscribe((items: any) => {
|
|
86
|
+
setPrice(items)
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
const button = document.querySelector('.cart-summary .checkout-button')
|
|
90
|
+
|
|
91
|
+
button?.addEventListener('click', async () => {
|
|
92
|
+
const items = $cart.get()
|
|
93
|
+
|
|
94
|
+
const checkoutConfig = {
|
|
95
|
+
success_url: `${import.meta.env.PUBLIC_SITE_URL}/checkout`,
|
|
96
|
+
mode: 'payment',
|
|
97
|
+
customer_creation: 'always',
|
|
98
|
+
shipping_address_collection: {
|
|
99
|
+
allowed_countries: ['NL'],
|
|
100
|
+
},
|
|
101
|
+
phone_number_collection: {
|
|
102
|
+
enabled: true,
|
|
103
|
+
},
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
try {
|
|
107
|
+
const lineItems = items.map((item: any) => ({
|
|
108
|
+
price_data: {
|
|
109
|
+
currency: 'eur',
|
|
110
|
+
product: item.id,
|
|
111
|
+
},
|
|
112
|
+
quantity: 1,
|
|
113
|
+
}))
|
|
114
|
+
|
|
115
|
+
// @ts-ignore
|
|
116
|
+
const checkoutSession = await stripe.checkout.sessions.create({
|
|
117
|
+
line_items: lineItems,
|
|
118
|
+
...checkoutConfig,
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
checkoutSession.url && window.location.replace(checkoutSession.url)
|
|
122
|
+
} catch (error) {
|
|
123
|
+
console.error(error)
|
|
124
|
+
|
|
125
|
+
const lineItems = items.map((item: any) => ({
|
|
126
|
+
quantity: 1,
|
|
127
|
+
price_data: {
|
|
128
|
+
currency: 'eur',
|
|
129
|
+
product_data: {
|
|
130
|
+
name: item.name,
|
|
131
|
+
images: [window],
|
|
132
|
+
},
|
|
133
|
+
unit_amount: Math.round(item.price * 100),
|
|
134
|
+
},
|
|
135
|
+
}))
|
|
136
|
+
|
|
137
|
+
// @ts-ignore
|
|
138
|
+
const checkoutSession = await stripe.checkout.sessions.create({
|
|
139
|
+
line_items: lineItems,
|
|
140
|
+
...checkoutConfig,
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
checkoutSession.url && window.location.replace(checkoutSession.url)
|
|
144
|
+
}
|
|
145
|
+
})
|
|
146
|
+
})
|
|
147
|
+
</script>
|
|
@@ -1,95 +1,171 @@
|
|
|
1
1
|
---
|
|
2
|
-
import type { ComponentProps } from 'astro/types'
|
|
2
|
+
import type { ComponentProps, HTMLAttributes } from 'astro/types'
|
|
3
3
|
import Button from 'fulldev-ui/components/Button.astro'
|
|
4
|
-
import Card from 'fulldev-ui/components/Card.astro'
|
|
5
4
|
import Element from 'fulldev-ui/components/Element.astro'
|
|
5
|
+
import Logo from 'fulldev-ui/components/experimental/Logo.astro'
|
|
6
|
+
import Menu from 'fulldev-ui/components/Menu.astro'
|
|
7
|
+
import type { GlobalProps } from 'fulldev-ui/types/global-props'
|
|
8
|
+
import Buttons from './Buttons.astro'
|
|
9
|
+
import Heading from './Heading.astro'
|
|
6
10
|
|
|
7
|
-
interface Props extends
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
interface Props extends GlobalProps, HTMLAttributes<'aside'> {
|
|
12
|
+
variant?: ComponentProps<typeof Button>['variant']
|
|
13
|
+
text?: ComponentProps<typeof Button>['text']
|
|
14
|
+
icon?: ComponentProps<typeof Button>['icon']
|
|
15
|
+
heading?: ComponentProps<typeof Heading>['text']
|
|
16
|
+
logo?: ComponentProps<typeof Logo> | undefined
|
|
17
|
+
company?: ComponentProps<typeof Logo>['company']
|
|
18
|
+
menu?: ComponentProps<typeof Menu>['groups']
|
|
19
|
+
buttons?: ComponentProps<typeof Buttons>['buttons']
|
|
12
20
|
}
|
|
13
21
|
|
|
14
22
|
const {
|
|
15
23
|
id = 'drawer',
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
24
|
+
size = 'sm',
|
|
25
|
+
icon = 'menu-2',
|
|
26
|
+
color,
|
|
27
|
+
variant,
|
|
28
|
+
text,
|
|
29
|
+
buttons,
|
|
30
|
+
heading,
|
|
31
|
+
logo,
|
|
32
|
+
company,
|
|
33
|
+
menu,
|
|
34
|
+
if: ifProp,
|
|
20
35
|
...rest
|
|
21
36
|
} = Astro.props
|
|
37
|
+
|
|
38
|
+
const buttonsGroup = { heading: '', buttons: buttons }
|
|
39
|
+
const mergedMenu = [buttonsGroup, ...(menu || [])] as typeof menu
|
|
22
40
|
---
|
|
23
41
|
|
|
24
42
|
<Button
|
|
25
|
-
|
|
43
|
+
if={ifProp}
|
|
26
44
|
variant="secondary"
|
|
27
|
-
|
|
28
|
-
text={label}
|
|
29
|
-
icon={icon}
|
|
45
|
+
class:list={['drawer-button', `${id}-button`]}
|
|
30
46
|
onclick={`document.getElementById('${id}').showModal()`}
|
|
47
|
+
{variant}
|
|
48
|
+
{text}
|
|
49
|
+
{icon}
|
|
50
|
+
{color}
|
|
31
51
|
/>
|
|
32
52
|
|
|
33
53
|
<Element
|
|
54
|
+
if={ifProp}
|
|
55
|
+
onclick={`event.target === this && this.close()`}
|
|
56
|
+
class:list="drawer"
|
|
34
57
|
as="dialog"
|
|
35
|
-
class="drawer"
|
|
36
58
|
{id}
|
|
37
|
-
{
|
|
38
|
-
|
|
59
|
+
{text}
|
|
60
|
+
{icon}
|
|
61
|
+
{...rest}
|
|
39
62
|
>
|
|
40
|
-
<Element
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
63
|
+
<Element class:list="drawer-body">
|
|
64
|
+
<Element
|
|
65
|
+
class:list="drawer-header"
|
|
66
|
+
as="header"
|
|
67
|
+
>
|
|
68
|
+
<Logo
|
|
69
|
+
{company}
|
|
70
|
+
{...logo}
|
|
71
|
+
/>
|
|
72
|
+
<Heading
|
|
73
|
+
level={4}
|
|
74
|
+
text={heading}
|
|
75
|
+
/>
|
|
76
|
+
<Button
|
|
77
|
+
variant="secondary"
|
|
78
|
+
icon="x"
|
|
79
|
+
onclick={`document.getElementById('${id}').close()`}
|
|
80
|
+
/>
|
|
81
|
+
<slot name="header" />
|
|
82
|
+
</Element>
|
|
83
|
+
<Element class:list="drawer-content">
|
|
84
|
+
<Menu groups={mergedMenu} />
|
|
85
|
+
<slot />
|
|
86
|
+
</Element>
|
|
87
|
+
<Element
|
|
88
|
+
class:list="drawer-footer"
|
|
89
|
+
as="footer"
|
|
90
|
+
>
|
|
91
|
+
<slot name="footer" />
|
|
92
|
+
</Element>
|
|
45
93
|
</Element>
|
|
46
94
|
</Element>
|
|
47
95
|
|
|
48
96
|
<style lang="scss" is:global>
|
|
49
97
|
@layer fulldev {
|
|
98
|
+
body:has(dialog[open]) {
|
|
99
|
+
overflow: hidden;
|
|
100
|
+
|
|
101
|
+
@media (min-width: 768px) {
|
|
102
|
+
overflow: auto;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
50
106
|
.drawer {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
margin: 0 !important;
|
|
55
|
-
outline: 0;
|
|
56
|
-
border: 0;
|
|
57
|
-
background: var(--color-2);
|
|
107
|
+
top: 0;
|
|
108
|
+
bottom: 0;
|
|
109
|
+
margin: 0;
|
|
58
110
|
padding: 0;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
height:
|
|
63
|
-
|
|
111
|
+
width: 100%;
|
|
112
|
+
max-width: 100%;
|
|
113
|
+
height: 100%;
|
|
114
|
+
max-height: 100%;
|
|
115
|
+
|
|
116
|
+
@media (min-width: 768px) {
|
|
117
|
+
width: 440px;
|
|
118
|
+
}
|
|
64
119
|
|
|
65
120
|
&::backdrop {
|
|
121
|
+
cursor: pointer;
|
|
66
122
|
background: rgba(0, 0, 0, 0.5);
|
|
67
123
|
}
|
|
68
124
|
|
|
69
|
-
|
|
70
|
-
|
|
125
|
+
.drawer-body {
|
|
126
|
+
display: flex;
|
|
127
|
+
flex-shrink: 1;
|
|
128
|
+
flex-direction: column;
|
|
129
|
+
border-right: 1px solid var(--color-a6);
|
|
130
|
+
height: 100%;
|
|
131
|
+
overflow: auto;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.drawer-content {
|
|
135
|
+
display: flex;
|
|
136
|
+
flex-direction: column;
|
|
137
|
+
padding: var(--space-6) var(--gutter);
|
|
71
138
|
}
|
|
72
139
|
|
|
73
|
-
|
|
74
|
-
|
|
140
|
+
.drawer-header,
|
|
141
|
+
.drawer-footer {
|
|
142
|
+
display: flex;
|
|
143
|
+
position: sticky;
|
|
144
|
+
flex-shrink: 0;
|
|
145
|
+
z-index: 1;
|
|
146
|
+
border-style: solid;
|
|
147
|
+
border-color: var(--color-a6);
|
|
148
|
+
background-color: var(--base-background);
|
|
75
149
|
}
|
|
76
150
|
|
|
77
|
-
.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
151
|
+
.drawer-header {
|
|
152
|
+
top: 0;
|
|
153
|
+
align-items: center;
|
|
154
|
+
border-bottom-width: 1px;
|
|
155
|
+
padding: 0 var(--gutter);
|
|
156
|
+
height: 56px;
|
|
83
157
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
padding-left: var(--gutter);
|
|
158
|
+
.button {
|
|
159
|
+
margin-left: auto;
|
|
87
160
|
}
|
|
161
|
+
}
|
|
88
162
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
163
|
+
.drawer-footer {
|
|
164
|
+
bottom: 0;
|
|
165
|
+
flex-direction: column;
|
|
166
|
+
margin-top: auto;
|
|
167
|
+
border-top-width: 1px;
|
|
168
|
+
padding: var(--space-5) var(--gutter);
|
|
93
169
|
}
|
|
94
170
|
}
|
|
95
171
|
}
|
|
@@ -53,9 +53,8 @@ const {
|
|
|
53
53
|
>
|
|
54
54
|
<Element class:list="column">
|
|
55
55
|
<Logo
|
|
56
|
-
id={logo}
|
|
57
|
-
src={logo}
|
|
58
56
|
{company}
|
|
57
|
+
{...typeof logo === 'string' ? { src: logo } : logo}
|
|
59
58
|
/>
|
|
60
59
|
<Text
|
|
61
60
|
color="base"
|
|
@@ -110,12 +109,12 @@ const {
|
|
|
110
109
|
align-items: flex-start;
|
|
111
110
|
gap: var(--space-6);
|
|
112
111
|
margin-top: auto;
|
|
112
|
+
margin-top: auto;
|
|
113
113
|
border-top-width: 1px;
|
|
114
114
|
border-color: var(--base-a6);
|
|
115
115
|
background-color: var(--base-2);
|
|
116
116
|
padding: var(--space-7) var(--gutter);
|
|
117
117
|
width: 100%;
|
|
118
|
-
overflow: auto;
|
|
119
118
|
|
|
120
119
|
@media (min-width: 1024px) {
|
|
121
120
|
grid-auto-columns: 1fr;
|
|
@@ -132,6 +131,10 @@ const {
|
|
|
132
131
|
flex-direction: column;
|
|
133
132
|
}
|
|
134
133
|
|
|
134
|
+
> .column {
|
|
135
|
+
gap: var(--space-4);
|
|
136
|
+
}
|
|
137
|
+
|
|
135
138
|
.socials {
|
|
136
139
|
display: flex;
|
|
137
140
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { ComponentProps, HTMLAttributes } from 'astro/types'
|
|
3
|
+
import Button from 'fulldev-ui/components/Button.astro'
|
|
4
|
+
import Element from 'fulldev-ui/components/Element.astro'
|
|
5
|
+
import Input from 'fulldev-ui/components/Input.astro'
|
|
6
|
+
import Select from 'fulldev-ui/components/Select.astro'
|
|
7
|
+
import Textarea from 'fulldev-ui/components/Textarea.astro'
|
|
8
|
+
import type { GlobalProps } from 'fulldev-ui/types/global-props'
|
|
9
|
+
|
|
10
|
+
interface Props extends GlobalProps, HTMLAttributes<'form'> {
|
|
11
|
+
fields: (
|
|
12
|
+
| ComponentProps<typeof Input>
|
|
13
|
+
| ComponentProps<typeof Select>
|
|
14
|
+
| (ComponentProps<typeof Textarea> & { type?: 'textarea' | undefined })
|
|
15
|
+
)[]
|
|
16
|
+
submit?: ComponentProps<typeof Button>['text']
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const { fields, submit, ...rest } = Astro.props
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
<Element
|
|
23
|
+
class:list="form"
|
|
24
|
+
as="form"
|
|
25
|
+
{...rest}
|
|
26
|
+
>
|
|
27
|
+
{
|
|
28
|
+
fields.map((field) => {
|
|
29
|
+
if ('options' in field) return <Select {...field} />
|
|
30
|
+
if ('type' in field && field.type === 'textarea')
|
|
31
|
+
return <Textarea {...field} />
|
|
32
|
+
return <Input {...(field as any)} />
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
<Button
|
|
36
|
+
type="submit"
|
|
37
|
+
text={submit}
|
|
38
|
+
/>
|
|
39
|
+
</Element>
|
|
40
|
+
|
|
41
|
+
<style is:global lang="scss">
|
|
42
|
+
.form {
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
gap: var(--space-4);
|
|
46
|
+
width: 100%;
|
|
47
|
+
max-width: calc(var(--space-4) * 44);
|
|
48
|
+
}
|
|
49
|
+
</style>
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { ComponentProps, HTMLAttributes } from 'astro/types'
|
|
3
|
-
import Button from 'fulldev-ui/components/Button.astro'
|
|
4
3
|
import Buttons from 'fulldev-ui/components/Buttons.astro'
|
|
5
4
|
import Element from 'fulldev-ui/components/Element.astro'
|
|
6
5
|
import Logo from 'fulldev-ui/components/experimental/Logo.astro'
|
|
7
|
-
import Search from 'fulldev-ui/components/Search.astro'
|
|
8
6
|
import ThemeSelect from 'fulldev-ui/components/ThemeSelect.astro'
|
|
9
7
|
import type { GlobalProps } from 'fulldev-ui/types/global-props'
|
|
8
|
+
import Cart from './Cart.astro'
|
|
9
|
+
import Drawer from './Drawer.astro'
|
|
10
|
+
import type Menu from './Menu.astro'
|
|
10
11
|
|
|
11
12
|
interface Props extends GlobalProps, HTMLAttributes<'header'> {
|
|
12
|
-
logo?: ComponentProps<typeof Logo>
|
|
13
|
+
logo?: ComponentProps<typeof Logo>
|
|
13
14
|
company?: ComponentProps<typeof Logo>['company']
|
|
14
15
|
buttons?: ComponentProps<typeof Buttons>['buttons']
|
|
16
|
+
menu?: ComponentProps<typeof Menu>['groups']
|
|
15
17
|
panel?: boolean | undefined
|
|
16
18
|
search?: boolean | undefined
|
|
17
19
|
open?: boolean | undefined
|
|
18
20
|
themeselect?: boolean | undefined
|
|
21
|
+
cart?: string | undefined
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
const {
|
|
@@ -26,7 +29,9 @@ const {
|
|
|
26
29
|
buttons,
|
|
27
30
|
search,
|
|
28
31
|
panel,
|
|
32
|
+
menu,
|
|
29
33
|
themeselect,
|
|
34
|
+
cart,
|
|
30
35
|
...rest
|
|
31
36
|
} = Astro.props
|
|
32
37
|
---
|
|
@@ -40,21 +45,25 @@ const {
|
|
|
40
45
|
{...rest}
|
|
41
46
|
>
|
|
42
47
|
<Logo
|
|
43
|
-
id={logo}
|
|
44
|
-
src={logo}
|
|
45
48
|
{company}
|
|
49
|
+
{...typeof logo === 'string' ? { src: logo } : logo}
|
|
46
50
|
/>
|
|
47
51
|
<Buttons
|
|
48
52
|
{buttons}
|
|
49
53
|
variant="link"
|
|
50
54
|
/>
|
|
51
|
-
{search && <Search />}
|
|
52
55
|
{themeselect && <ThemeSelect />}
|
|
53
|
-
<
|
|
54
|
-
class="menu-button"
|
|
55
|
-
variant="tertiary"
|
|
56
|
+
<Drawer
|
|
56
57
|
icon="menu-2"
|
|
57
|
-
|
|
58
|
+
id="menu"
|
|
59
|
+
{logo}
|
|
60
|
+
{company}
|
|
61
|
+
{buttons}
|
|
62
|
+
{menu}
|
|
63
|
+
/>
|
|
64
|
+
<Cart
|
|
65
|
+
if={cart}
|
|
66
|
+
heading={cart}
|
|
58
67
|
/>
|
|
59
68
|
</Element>
|
|
60
69
|
|
|
@@ -119,10 +128,6 @@ const {
|
|
|
119
128
|
}
|
|
120
129
|
|
|
121
130
|
.menu-button {
|
|
122
|
-
.icon {
|
|
123
|
-
transform: scale(1.56);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
131
|
@media (min-width: 1024px) {
|
|
127
132
|
display: none;
|
|
128
133
|
}
|
|
@@ -17,6 +17,7 @@ const {
|
|
|
17
17
|
disabled,
|
|
18
18
|
required,
|
|
19
19
|
placeholder,
|
|
20
|
+
readonly,
|
|
20
21
|
name = placeholder,
|
|
21
22
|
type = 'text',
|
|
22
23
|
...rest
|
|
@@ -41,6 +42,7 @@ const {
|
|
|
41
42
|
{value}
|
|
42
43
|
{disabled}
|
|
43
44
|
{required}
|
|
45
|
+
{readonly}
|
|
44
46
|
/>
|
|
45
47
|
<Icon name={icon} />
|
|
46
48
|
</Element>
|
|
@@ -97,6 +99,10 @@ const {
|
|
|
97
99
|
cursor: not-allowed;
|
|
98
100
|
pointer-events: none;
|
|
99
101
|
}
|
|
102
|
+
|
|
103
|
+
&[readonly] {
|
|
104
|
+
pointer-events: none;
|
|
105
|
+
}
|
|
100
106
|
}
|
|
101
107
|
}
|
|
102
108
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { ComponentProps, HTMLAttributes } from 'astro/types'
|
|
3
|
+
import Button from 'fulldev-ui/components/Button.astro'
|
|
4
|
+
import Element from 'fulldev-ui/components/Element.astro'
|
|
5
|
+
import Heading from 'fulldev-ui/components/Heading.astro'
|
|
6
|
+
import type { GlobalProps } from 'fulldev-ui/types/global-props'
|
|
7
|
+
|
|
8
|
+
interface Props extends GlobalProps, HTMLAttributes<'div'> {
|
|
9
|
+
groups?:
|
|
10
|
+
| {
|
|
11
|
+
heading?: ComponentProps<typeof Heading>['text']
|
|
12
|
+
buttons?: ComponentProps<typeof Button>[]
|
|
13
|
+
}[]
|
|
14
|
+
| undefined
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const { groups, ...rest } = Astro.props
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
<Element
|
|
21
|
+
class:list="menu"
|
|
22
|
+
{...rest}
|
|
23
|
+
>
|
|
24
|
+
{
|
|
25
|
+
groups?.map(({ heading, buttons }) => (
|
|
26
|
+
<Element class:list="menu-group">
|
|
27
|
+
<Heading
|
|
28
|
+
level={6}
|
|
29
|
+
text={heading}
|
|
30
|
+
/>
|
|
31
|
+
{buttons?.map((button) => (
|
|
32
|
+
<Button
|
|
33
|
+
variant="link"
|
|
34
|
+
{...button}
|
|
35
|
+
/>
|
|
36
|
+
))}
|
|
37
|
+
</Element>
|
|
38
|
+
))
|
|
39
|
+
}
|
|
40
|
+
</Element>
|
|
41
|
+
|
|
42
|
+
<style lang="scss" is:global>
|
|
43
|
+
@layer fulldev {
|
|
44
|
+
.menu {
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
gap: var(--space-5);
|
|
48
|
+
|
|
49
|
+
.menu-group {
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: column;
|
|
52
|
+
gap: var(--space-4);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
</style>
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import type { HTMLAttributes } from 'astro/types'
|
|
3
3
|
import Element from 'fulldev-ui/components/Element.astro'
|
|
4
4
|
import type { GlobalProps } from 'fulldev-ui/types/global-props'
|
|
5
|
+
import { formatPrice } from 'fulldev-ui/utils/cart'
|
|
5
6
|
|
|
6
7
|
interface Props extends GlobalProps, HTMLAttributes<'div'> {
|
|
7
8
|
size?: 'sm' | 'md' | 'lg' | undefined
|
|
@@ -13,17 +14,12 @@ interface Props extends GlobalProps, HTMLAttributes<'div'> {
|
|
|
13
14
|
const { value, ...rest } = Astro.props
|
|
14
15
|
---
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
>
|
|
23
|
-
€{value?.toFixed(2).replace('.', ',')}
|
|
24
|
-
</Element>
|
|
25
|
-
)
|
|
26
|
-
}
|
|
17
|
+
<Element
|
|
18
|
+
class:list="price"
|
|
19
|
+
{...rest}
|
|
20
|
+
>
|
|
21
|
+
{value && <Fragment set:html={formatPrice(value)} />}
|
|
22
|
+
</Element>
|
|
27
23
|
|
|
28
24
|
<style is:global lang="scss">
|
|
29
25
|
@layer fulldev {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
import Pagefind from 'astro-pagefind/components/Search'
|
|
3
2
|
import Dialog from 'fulldev-ui/components/Dialog.astro'
|
|
4
3
|
|
|
5
4
|
const { variant = 'secondary', ...rest } = Astro.props
|
|
@@ -11,9 +10,7 @@ const { variant = 'secondary', ...rest } = Astro.props
|
|
|
11
10
|
icon="search"
|
|
12
11
|
{variant}
|
|
13
12
|
{...rest}
|
|
14
|
-
|
|
15
|
-
<Pagefind uiOptions={{ showImages: false }} />
|
|
16
|
-
</Dialog>
|
|
13
|
+
/>
|
|
17
14
|
|
|
18
15
|
<style is:global lang="scss">
|
|
19
16
|
:root {
|
|
@@ -148,11 +148,12 @@ const Component =
|
|
|
148
148
|
--inset-right: var(--gutter);
|
|
149
149
|
--inset-bottom: var(--spacer);
|
|
150
150
|
|
|
151
|
+
display: flex;
|
|
151
152
|
position: relative;
|
|
153
|
+
flex-direction: column;
|
|
152
154
|
align-items: flex-start;
|
|
153
155
|
gap: var(--space-6) var(--space-7);
|
|
154
156
|
padding: var(--spacer) var(--gutter);
|
|
155
|
-
overflow: auto;
|
|
156
157
|
|
|
157
158
|
.segment {
|
|
158
159
|
display: flex;
|