fulldev-ui 0.5.0-beta.13 → 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 CHANGED
@@ -1,3 +1,3 @@
1
- SITE_URL=https://localhost:4321
1
+ URL=https://localhost:4321
2
2
  STRIPE_SECRET_KEY=
3
3
  STRIPE_RESTRICTED_KEY=
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fulldev-ui",
3
- "version": "0.5.0-beta.13",
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
- "link": "pnpm link --global"
28
+ "l": "pnpm link --global"
29
29
  },
30
30
  "type": "module",
31
31
  "exports": {
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  import Section from 'fulldev-ui/components/Section.astro'
3
3
 
4
- const { image, ...rest } = Astro.props
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
 
@@ -29,10 +29,12 @@ const {
29
29
  } = Astro.props
30
30
 
31
31
  const slug = Astro.url.pathname.replace(/^\/|\/$/g, '') || 'index'
32
- const src = `/src/images/${images?.[0].id}`
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 = await getImage({ src: foundImage ? foundImage() : src })
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.src}
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 = 'secondary', badges, ...rest } = Astro.props
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, i) => (
21
+ badges?.map((badge) => (
32
22
  <Badge
33
- variant={variant === 'link' ? 'link' : buttonVariant(i)}
23
+ {variant}
34
24
  {...badge}
35
25
  />
36
26
  ))
@@ -35,7 +35,6 @@ const page = slug ? (await getEntry('pages', slug)).data : {}
35
35
 
36
36
  const entryProps = {
37
37
  heading: page.title,
38
- text: page.description,
39
38
  href: slug ? `/${slug}/` : undefined,
40
39
  ...page,
41
40
  }
@@ -62,7 +62,7 @@ const { ...rest } = Astro.props
62
62
  </style>
63
63
 
64
64
  <script>
65
- import { SITE_URL, STRIPE_RESTRICTED_KEY } from 'astro:env/client'
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: `${SITE_URL}/checkout`,
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: [SITE_URL + item.image],
132
+ images: [URL + item.image],
133
133
  },
134
134
  unit_amount: Math.round(item.price * 100),
135
135
  },
@@ -40,7 +40,6 @@ const mergedMenu = [buttonsGroup, ...(menu || [])] as typeof menu
40
40
  ---
41
41
 
42
42
  <Button
43
- if={ifProp}
44
43
  variant="secondary"
45
44
  class:list={['drawer-button', `${id}-button`]}
46
45
  onclick={`document.getElementById('${id}').showModal()`}
@@ -51,7 +50,6 @@ const mergedMenu = [buttonsGroup, ...(menu || [])] as typeof menu
51
50
  />
52
51
 
53
52
  <Element
54
- if={ifProp}
55
53
  onclick={`event.target === this && this.close()`}
56
54
  class:list="drawer"
57
55
  as="dialog"
@@ -25,6 +25,10 @@ const mergedImage =
25
25
  name="generator"
26
26
  content={Astro.generator}
27
27
  />
28
+ <link
29
+ rel="canonical"
30
+ href={Astro.url.href.endsWith('/') ? Astro.url.href : Astro.url.href + '/'}
31
+ />
28
32
  <ViewTransitions />
29
33
  <AstroSeo
30
34
  title={mergedTitle ?? ''}
@@ -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 = true,
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,7 +56,13 @@ const {
53
56
  variant="link"
54
57
  />
55
58
  {themeselect && <ThemeSelect />}
59
+ <Socials {socials} />
60
+ <Cart
61
+ if={cart}
62
+ heading={cart}
63
+ />
56
64
  <Drawer
65
+ class:list={['header-button']}
57
66
  icon="menu-2"
58
67
  id="menu"
59
68
  {logo}
@@ -61,10 +70,6 @@ const {
61
70
  {buttons}
62
71
  {menu}
63
72
  />
64
- <Cart
65
- if={cart}
66
- heading={cart}
67
- />
68
73
  </Element>
69
74
 
70
75
  <style lang="scss" is:global>
@@ -28,7 +28,7 @@ const {
28
28
  {...rest}
29
29
  >
30
30
  <slot />
31
- <Fragment set:text={text} />
31
+ <Fragment set:html={text} />
32
32
  </Element>
33
33
 
34
34
  <style is:global lang="scss">
@@ -19,7 +19,7 @@ const { text, ...rest } = Astro.props
19
19
  {...rest}
20
20
  >
21
21
  <slot />
22
- <Fragment set:text={text} />
22
+ <Fragment set:html={text} />
23
23
  </Element>
24
24
 
25
25
  <style is:global lang="scss">
@@ -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-5);
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
  }
@@ -236,6 +236,7 @@ const Component =
236
236
 
237
237
  .segment {
238
238
  flex-direction: row;
239
+ flex-wrap: wrap;
239
240
  justify-content: space-between;
240
241
  width: 100%;
241
242
  }
@@ -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
  ---
@@ -16,7 +16,7 @@ const { text, ...rest } = Astro.props
16
16
  {...rest}
17
17
  >
18
18
  <slot />
19
- <Fragment set:text={text} />
19
+ <Fragment set:html={text} />
20
20
  </Element>
21
21
 
22
22
  <style is:global lang="scss">
@@ -22,7 +22,7 @@ const { color = 'base', text, ...rest } = Astro.props
22
22
  {...rest}
23
23
  >
24
24
  <slot />
25
- <Fragment set:text={text} />
25
+ <Fragment set:html={text} />
26
26
  </Element>
27
27
 
28
28
  <style is:global lang="scss">
@@ -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
- - href: https://github.com/fulldotdev/ui
25
- target: _blank
26
- icon: brand-github
27
- variant: secondary
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:
@@ -66,7 +66,7 @@ export default function fulldevIntegration(
66
66
  contentLayer: true,
67
67
  env: {
68
68
  schema: {
69
- SITE_URL: envField.string({
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(),
@@ -68,7 +68,8 @@ const {
68
68
  </slot>
69
69
  <slot name="header">
70
70
  <Header
71
- {...navigation?.header === true ? navigation : {}}
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?.sidebar?.header
80
- ? undefined
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(basePreset).pipe(presets).pipe(page)
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
+ }))