fulldev-ui 0.5.0-beta.14 → 0.5.0-beta.15
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/.env.example +1 -1
- package/package.json +2 -2
- package/src/blocks/Intro.astro +2 -1
- package/src/blocks/Product.astro +5 -3
- package/src/components/Badges.astro +3 -13
- package/src/components/Card.astro +0 -1
- package/src/components/CartSummary.astro +4 -4
- package/src/components/Head.astro +4 -0
- package/src/components/Header.astro +6 -2
- package/src/components/Heading.astro +1 -1
- package/src/components/Label.astro +1 -1
- package/src/components/Menu.astro +5 -4
- package/src/components/Social.astro +1 -0
- package/src/components/Tagline.astro +1 -1
- package/src/components/Text.astro +1 -1
- package/src/components/Toc.astro +7 -0
- package/src/content/presets/base.yml +5 -8
- package/src/integration/index.ts +2 -3
- package/src/layouts/Layout.astro +4 -17
- package/src/layouts/OverviewLayout.astro +1 -1
- package/src/schemas/pageSchema.ts +1 -11
- package/src/utils/getDeepReferenceChildren.ts +14 -0
package/.env.example
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fulldev-ui",
|
|
3
|
-
"version": "0.5.0-beta.
|
|
3
|
+
"version": "0.5.0-beta.15",
|
|
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",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"build:prod": "astro check && astro build",
|
|
26
26
|
"astro": "astro",
|
|
27
27
|
"test": "astro check && astro build && astro preview --host",
|
|
28
|
-
"
|
|
28
|
+
"l": "pnpm link --global"
|
|
29
29
|
},
|
|
30
30
|
"type": "module",
|
|
31
31
|
"exports": {
|
package/src/blocks/Intro.astro
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
import Section from 'fulldev-ui/components/Section.astro'
|
|
3
3
|
|
|
4
|
-
const {
|
|
4
|
+
const { ...rest } = Astro.props
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
<Section
|
|
@@ -9,6 +9,7 @@ const { image, ...rest } = Astro.props
|
|
|
9
9
|
structure="column"
|
|
10
10
|
size="sm"
|
|
11
11
|
level={1}
|
|
12
|
+
position="background"
|
|
12
13
|
{...rest}
|
|
13
14
|
/>
|
|
14
15
|
|
package/src/blocks/Product.astro
CHANGED
|
@@ -29,10 +29,12 @@ const {
|
|
|
29
29
|
} = Astro.props
|
|
30
30
|
|
|
31
31
|
const slug = Astro.url.pathname.replace(/^\/|\/$/g, '') || 'index'
|
|
32
|
-
const
|
|
32
|
+
const imageId = images?.[0]?.id
|
|
33
|
+
const src = `/src/images/${imageId}`
|
|
33
34
|
const allImages = import.meta.glob<{ default: ImageMetadata }>('/src/images/*')
|
|
34
35
|
const foundImage = allImages[src]
|
|
35
|
-
const gotImage =
|
|
36
|
+
const gotImage =
|
|
37
|
+
imageId && (await getImage({ src: foundImage ? foundImage() : src }))
|
|
36
38
|
---
|
|
37
39
|
|
|
38
40
|
<Section
|
|
@@ -64,7 +66,7 @@ const gotImage = await getImage({ src: foundImage ? foundImage() : src })
|
|
|
64
66
|
style={{ marginTop: 'var(--space-5)' }}
|
|
65
67
|
/>
|
|
66
68
|
<CartForm
|
|
67
|
-
image={gotImage
|
|
69
|
+
image={gotImage?.src}
|
|
68
70
|
{title}
|
|
69
71
|
{price}
|
|
70
72
|
{slug}
|
|
@@ -10,17 +10,7 @@ interface Props extends GlobalProps, HTMLAttributes<'div'> {
|
|
|
10
10
|
badges?: ComponentProps<typeof Badge>[] | undefined
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const { variant = '
|
|
14
|
-
|
|
15
|
-
const buttonVariant = (i: number) => {
|
|
16
|
-
if (variant === 'primary' && i === 0) return 'primary'
|
|
17
|
-
else if (variant === 'primary' && i === 1) return 'secondary'
|
|
18
|
-
else if (variant === 'primary' && i > 1) return 'tertiary'
|
|
19
|
-
else if (variant === 'secondary' && i === 0) return 'secondary'
|
|
20
|
-
else if (variant === 'secondary' && i > 0) return 'tertiary'
|
|
21
|
-
else if (variant === 'tertiary') return 'tertiary'
|
|
22
|
-
else return 'tertiary'
|
|
23
|
-
}
|
|
13
|
+
const { variant = 'tertiary', badges, ...rest } = Astro.props
|
|
24
14
|
---
|
|
25
15
|
|
|
26
16
|
<Element
|
|
@@ -28,9 +18,9 @@ const buttonVariant = (i: number) => {
|
|
|
28
18
|
{...rest}
|
|
29
19
|
>
|
|
30
20
|
{
|
|
31
|
-
badges?.map((badge
|
|
21
|
+
badges?.map((badge) => (
|
|
32
22
|
<Badge
|
|
33
|
-
|
|
23
|
+
{variant}
|
|
34
24
|
{...badge}
|
|
35
25
|
/>
|
|
36
26
|
))
|
|
@@ -62,7 +62,7 @@ const { ...rest } = Astro.props
|
|
|
62
62
|
</style>
|
|
63
63
|
|
|
64
64
|
<script>
|
|
65
|
-
import {
|
|
65
|
+
import { STRIPE_RESTRICTED_KEY, URL } from 'astro:env/client'
|
|
66
66
|
import { $cart } from 'fulldev-ui/stores/cart.ts'
|
|
67
67
|
import { formatPrice } from 'fulldev-ui/utils/cart'
|
|
68
68
|
import Stripe from 'stripe'
|
|
@@ -79,8 +79,8 @@ const { ...rest } = Astro.props
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
document.addEventListener('astro:page-load', () => {
|
|
82
|
+
if (!STRIPE_RESTRICTED_KEY) return
|
|
82
83
|
const stripe = new Stripe(STRIPE_RESTRICTED_KEY)
|
|
83
|
-
if (!stripe) return
|
|
84
84
|
setPrice($cart.get())
|
|
85
85
|
|
|
86
86
|
$cart.subscribe((items: any) => {
|
|
@@ -93,7 +93,7 @@ const { ...rest } = Astro.props
|
|
|
93
93
|
const items = $cart.get()
|
|
94
94
|
|
|
95
95
|
const checkoutConfig = {
|
|
96
|
-
success_url: `${
|
|
96
|
+
success_url: `${URL}/checkout`,
|
|
97
97
|
mode: 'payment',
|
|
98
98
|
customer_creation: 'always',
|
|
99
99
|
shipping_address_collection: {
|
|
@@ -129,7 +129,7 @@ const { ...rest } = Astro.props
|
|
|
129
129
|
currency: 'eur',
|
|
130
130
|
product_data: {
|
|
131
131
|
name: item.name,
|
|
132
|
-
images: [
|
|
132
|
+
images: [URL + item.image],
|
|
133
133
|
},
|
|
134
134
|
unit_amount: Math.round(item.price * 100),
|
|
135
135
|
},
|
|
@@ -8,6 +8,7 @@ import type { GlobalProps } from 'fulldev-ui/types/global-props'
|
|
|
8
8
|
import Cart from './Cart.astro'
|
|
9
9
|
import Drawer from './Drawer.astro'
|
|
10
10
|
import type Menu from './Menu.astro'
|
|
11
|
+
import Socials from './Socials.astro'
|
|
11
12
|
|
|
12
13
|
interface Props extends GlobalProps, HTMLAttributes<'header'> {
|
|
13
14
|
logo?: ComponentProps<typeof Logo>
|
|
@@ -19,16 +20,18 @@ interface Props extends GlobalProps, HTMLAttributes<'header'> {
|
|
|
19
20
|
open?: boolean | undefined
|
|
20
21
|
themeselect?: boolean | undefined
|
|
21
22
|
cart?: string | undefined
|
|
23
|
+
socials?: ComponentProps<typeof Socials>['socials']
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
const {
|
|
25
27
|
size = 'sm',
|
|
26
|
-
open
|
|
28
|
+
open,
|
|
27
29
|
logo,
|
|
28
30
|
company,
|
|
29
31
|
buttons,
|
|
30
32
|
search,
|
|
31
33
|
panel,
|
|
34
|
+
socials,
|
|
32
35
|
menu,
|
|
33
36
|
themeselect,
|
|
34
37
|
cart,
|
|
@@ -53,12 +56,13 @@ const {
|
|
|
53
56
|
variant="link"
|
|
54
57
|
/>
|
|
55
58
|
{themeselect && <ThemeSelect />}
|
|
56
|
-
|
|
59
|
+
<Socials {socials} />
|
|
57
60
|
<Cart
|
|
58
61
|
if={cart}
|
|
59
62
|
heading={cart}
|
|
60
63
|
/>
|
|
61
64
|
<Drawer
|
|
65
|
+
class:list={['header-button']}
|
|
62
66
|
icon="menu-2"
|
|
63
67
|
id="menu"
|
|
64
68
|
{logo}
|
|
@@ -9,6 +9,7 @@ interface Props extends GlobalProps, HTMLAttributes<'div'> {
|
|
|
9
9
|
groups?:
|
|
10
10
|
| {
|
|
11
11
|
heading?: ComponentProps<typeof Heading>['text']
|
|
12
|
+
href?: string
|
|
12
13
|
buttons?: ComponentProps<typeof Button>[]
|
|
13
14
|
}[]
|
|
14
15
|
| undefined
|
|
@@ -22,11 +23,11 @@ const { groups, ...rest } = Astro.props
|
|
|
22
23
|
{...rest}
|
|
23
24
|
>
|
|
24
25
|
{
|
|
25
|
-
groups?.map(({ heading, buttons }) => (
|
|
26
|
+
groups?.map(({ heading, href, buttons }) => (
|
|
26
27
|
<Element class:list="menu-group">
|
|
27
28
|
<Heading
|
|
28
29
|
level={6}
|
|
29
|
-
text={heading}
|
|
30
|
+
text={href ? `<a href="${href}">${heading}</a>` : heading}
|
|
30
31
|
/>
|
|
31
32
|
{buttons?.map((button) => (
|
|
32
33
|
<Button
|
|
@@ -44,12 +45,12 @@ const { groups, ...rest } = Astro.props
|
|
|
44
45
|
.menu {
|
|
45
46
|
display: flex;
|
|
46
47
|
flex-direction: column;
|
|
47
|
-
gap: var(--space-
|
|
48
|
+
gap: var(--space-6);
|
|
48
49
|
|
|
49
50
|
.menu-group {
|
|
50
51
|
display: flex;
|
|
51
52
|
flex-direction: column;
|
|
52
|
-
gap: var(--space-4);
|
|
53
|
+
gap: calc(var(--space-4) * 1.2);
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
}
|
|
@@ -16,6 +16,7 @@ const platform = () => {
|
|
|
16
16
|
if (href.includes('tiktok')) return 'brand-tiktok'
|
|
17
17
|
if (href.includes('twitch')) return 'brand-twitch'
|
|
18
18
|
if (href.includes('github')) return 'brand-github'
|
|
19
|
+
if (href.includes('discord')) return 'brand-discord'
|
|
19
20
|
return undefined
|
|
20
21
|
}
|
|
21
22
|
---
|
package/src/components/Toc.astro
CHANGED
|
@@ -57,6 +57,13 @@ const filteredHeadings = headings?.filter(
|
|
|
57
57
|
gap: var(--space-4);
|
|
58
58
|
z-index: 10;
|
|
59
59
|
min-width: calc(var(--space-7) * 3);
|
|
60
|
+
max-width: calc(var(--space-7) * 6);
|
|
61
|
+
|
|
62
|
+
.button {
|
|
63
|
+
line-height: 1.1;
|
|
64
|
+
text-align: left;
|
|
65
|
+
white-space: normal;
|
|
66
|
+
}
|
|
60
67
|
|
|
61
68
|
.depth-3 {
|
|
62
69
|
padding-left: var(--space-4);
|
|
@@ -10,6 +10,7 @@ code:
|
|
|
10
10
|
posthog.init('phc_mVacbe8Xydu0UZlh4bNw5EGisvzyRcpqXEEuEEp5lOY',{api_host:'https://eu.i.posthog.com', person_profiles: 'identified_only' // or 'always' to create profiles for anonymous users as well
|
|
11
11
|
})
|
|
12
12
|
</script>
|
|
13
|
+
|
|
13
14
|
navigation:
|
|
14
15
|
header: true
|
|
15
16
|
company: Fulldev UI
|
|
@@ -21,14 +22,10 @@ navigation:
|
|
|
21
22
|
- text: Blocks
|
|
22
23
|
href: /blocks/banner
|
|
23
24
|
- showcase
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
- href: https://discord.gg/vXZqMbadm8
|
|
29
|
-
target: _blank
|
|
30
|
-
icon: brand-discord
|
|
31
|
-
variant: secondary
|
|
25
|
+
|
|
26
|
+
socials:
|
|
27
|
+
- https://github.com/fulldotdev/ui
|
|
28
|
+
- https://discord.gg/vXZqMbadm8
|
|
32
29
|
menu:
|
|
33
30
|
- heading: Get Started
|
|
34
31
|
buttons:
|
package/src/integration/index.ts
CHANGED
|
@@ -66,7 +66,7 @@ export default function fulldevIntegration(
|
|
|
66
66
|
contentLayer: true,
|
|
67
67
|
env: {
|
|
68
68
|
schema: {
|
|
69
|
-
|
|
69
|
+
URL: envField.string({
|
|
70
70
|
context: 'client',
|
|
71
71
|
access: 'public',
|
|
72
72
|
}),
|
|
@@ -84,8 +84,7 @@ export default function fulldevIntegration(
|
|
|
84
84
|
validateSecrets: true,
|
|
85
85
|
},
|
|
86
86
|
},
|
|
87
|
-
site: loadEnv(process.env.NODE_ENV as any, process.cwd(), '')
|
|
88
|
-
.SITE_URL,
|
|
87
|
+
site: loadEnv(process.env.NODE_ENV as any, process.cwd(), '').URL,
|
|
89
88
|
integrations: [
|
|
90
89
|
sitemap(),
|
|
91
90
|
mdx(),
|
package/src/layouts/Layout.astro
CHANGED
|
@@ -68,7 +68,8 @@ const {
|
|
|
68
68
|
</slot>
|
|
69
69
|
<slot name="header">
|
|
70
70
|
<Header
|
|
71
|
-
{
|
|
71
|
+
open={navigation?.header}
|
|
72
|
+
{...navigation}
|
|
72
73
|
{...header}
|
|
73
74
|
/>
|
|
74
75
|
</slot>
|
|
@@ -76,12 +77,8 @@ const {
|
|
|
76
77
|
<slot name="sidebar">
|
|
77
78
|
<Sidebar
|
|
78
79
|
{...navigation?.sidebar === true ? navigation : {}}
|
|
79
|
-
logo={navigation?.
|
|
80
|
-
|
|
81
|
-
: navigation?.sidebar?.logo}
|
|
82
|
-
company={navigation?.sidebar?.header
|
|
83
|
-
? undefined
|
|
84
|
-
: navigation?.sidebar?.company}
|
|
80
|
+
logo={navigation?.header ? undefined : navigation?.logo}
|
|
81
|
+
company={navigation?.header ? undefined : navigation?.company}
|
|
85
82
|
{...sidebar}
|
|
86
83
|
/>
|
|
87
84
|
</slot>
|
|
@@ -117,16 +114,6 @@ const {
|
|
|
117
114
|
min-height: 100vh;
|
|
118
115
|
color: var(--base-11);
|
|
119
116
|
|
|
120
|
-
.for-sidebar {
|
|
121
|
-
@media (min-width: 1024px) {
|
|
122
|
-
display: none;
|
|
123
|
-
|
|
124
|
-
~ * {
|
|
125
|
-
--header-height: 0px;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
117
|
.core {
|
|
131
118
|
display: flex;
|
|
132
119
|
position: relative;
|
|
@@ -7,7 +7,7 @@ import Products from 'fulldev-ui/blocks/Products.astro'
|
|
|
7
7
|
import Sections from 'fulldev-ui/components/sections.astro'
|
|
8
8
|
import Layout from 'fulldev-ui/layouts/Layout.astro'
|
|
9
9
|
import { getFolderChildren } from 'fulldev-ui/utils/getFolderChildren.ts'
|
|
10
|
-
import { getReferenceChildren } from 'fulldev-ui/utils/getReferenceChildren'
|
|
10
|
+
import { getReferenceChildren } from 'fulldev-ui/utils/getReferenceChildren.ts'
|
|
11
11
|
|
|
12
12
|
type Props = ComponentProps<typeof Layout>
|
|
13
13
|
|
|
@@ -51,16 +51,6 @@ export const presets = z
|
|
|
51
51
|
return mergedData as typeof rest
|
|
52
52
|
})
|
|
53
53
|
|
|
54
|
-
export const basePreset = z
|
|
55
|
-
.object({})
|
|
56
|
-
.passthrough()
|
|
57
|
-
.transform(async (data) => {
|
|
58
|
-
if (!fulldevConfig.basePreset) return data
|
|
59
|
-
const baseEntry = await getEntry('presets', fulldevConfig.basePreset)
|
|
60
|
-
const mergedData = assign(baseEntry?.data ?? {}, data)
|
|
61
|
-
return mergedData as typeof data
|
|
62
|
-
})
|
|
63
|
-
|
|
64
54
|
export const page = z
|
|
65
55
|
.object({
|
|
66
56
|
component,
|
|
@@ -98,4 +88,4 @@ export const page = z
|
|
|
98
88
|
.partial()
|
|
99
89
|
.strict()
|
|
100
90
|
|
|
101
|
-
export default i18n.pipe(
|
|
91
|
+
export default i18n.pipe(presets).pipe(page)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { getCollection, type CollectionEntry } from 'astro:content'
|
|
2
|
+
|
|
3
|
+
// Pages that reference the current page
|
|
4
|
+
export const getDeepReferenceChildren = async (
|
|
5
|
+
slug: CollectionEntry<'pages'>['slug']
|
|
6
|
+
) =>
|
|
7
|
+
(
|
|
8
|
+
await getCollection('pages', (page) =>
|
|
9
|
+
page.data?.parents?.some((p: any) => p.slug.includes(slug))
|
|
10
|
+
)
|
|
11
|
+
)?.map(({ slug, data }) => ({
|
|
12
|
+
...data,
|
|
13
|
+
href: `/${slug}/`,
|
|
14
|
+
}))
|