fulldev-ui 0.5.0-beta.5 → 0.5.0-beta.6
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 +0 -2
- package/package.json +4 -2
- package/pnpm-lock.yaml +31 -69
- package/src/blocks/Banner.astro +2 -1
- package/src/blocks/Product.astro +11 -21
- package/src/components/Card.astro +1 -1
- package/src/components/Cart.astro +36 -0
- package/src/components/CartForm.astro +121 -0
- package/src/components/CartList.astro +134 -0
- package/src/components/CartSummary.astro +146 -0
- package/src/components/Drawer.astro +31 -7
- package/src/components/Form.astro +49 -0
- package/src/components/Header.astro +2 -9
- package/src/components/Input.astro +6 -0
- package/src/components/Price.astro +7 -11
- package/src/components/Search.astro +1 -4
- package/src/components/experimental/Form.astro +29 -5
- package/src/content/config.ts +2 -1
- package/src/content/pages/base/select.mdx +0 -8
- package/src/content/pages/base/textarea.mdx +0 -5
- package/src/content/presets/docs.yml +0 -1
- package/src/env.d.ts +1 -1
- package/src/layouts/Layout.astro +4 -0
- package/src/schemas/pageSchema.ts +53 -28
- package/src/schemas/presetSchema.ts +3 -0
- package/src/stores/cart.ts +23 -0
- package/src/utils/cart.ts +36 -0
- package/tsconfig.json +1 -3
- /package/src/types/{global-props.d.ts → global-props.ts} +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// import Stripe from 'stripe'
|
|
2
|
+
|
|
3
|
+
// const stripe = new Stripe(import.meta.env.STRIPE_SECRET_KEY)
|
|
4
|
+
|
|
5
|
+
const slugify = (input: string): string => {
|
|
6
|
+
return input
|
|
7
|
+
.toLowerCase()
|
|
8
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
9
|
+
.replace(/^-+|-+$/g, '')
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const generateProductId = (
|
|
13
|
+
slug: string,
|
|
14
|
+
variants?: string[] | undefined
|
|
15
|
+
): string => {
|
|
16
|
+
const slugified = slugify(slug)
|
|
17
|
+
|
|
18
|
+
if (variants && variants.length > 0)
|
|
19
|
+
return `${slugified}--${variants.map((variant) => slugify(variant)).join('--')}`
|
|
20
|
+
|
|
21
|
+
return slugified
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const generateProductName = (
|
|
25
|
+
title: string,
|
|
26
|
+
variants?: string[] | undefined
|
|
27
|
+
): string => {
|
|
28
|
+
if (variants && variants.length > 0)
|
|
29
|
+
return `${title} / ${variants.join(' / ')}`
|
|
30
|
+
|
|
31
|
+
return title
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const formatPrice = (price: number): string => {
|
|
35
|
+
return `€${price?.toFixed(2).replace('.', ',')}`
|
|
36
|
+
}
|
package/tsconfig.json
CHANGED
|
File without changes
|