fulldev-ui 0.5.0-beta.6 → 0.5.0-beta.8

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/astro.config.ts CHANGED
@@ -25,6 +25,8 @@ export default defineConfig({
25
25
  company: 'Fulldev UI',
26
26
  favicon: 'src/images/favicon.svg',
27
27
  css: '/src/css/custom.css',
28
+ basePreset: 'base',
29
+ injectRoutes: true,
28
30
  colors: {
29
31
  theme: 'dark',
30
32
  light: {
@@ -38,7 +40,6 @@ export default defineConfig({
38
40
  brand: '#F50',
39
41
  },
40
42
  },
41
- injectRoutes: true,
42
43
  }),
43
44
  ],
44
45
  redirects: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fulldev-ui",
3
- "version": "0.5.0-beta.6",
3
+ "version": "0.5.0-beta.8",
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",
@@ -1,21 +1,40 @@
1
1
  ---
2
- import { getEntry } from 'astro:content'
3
2
  import Prose from 'fulldev-ui/components/experimental/Prose.astro'
4
3
  import Section from 'fulldev-ui/components/Section.astro'
4
+ import Toc from 'fulldev-ui/components/Toc.astro'
5
5
 
6
- const { ...rest } = Astro.props
7
-
8
- const slug = Astro.url.pathname.replace(/^\/|\/$/g, '') || 'index'
9
- const currentEntry = await getEntry('pages', slug)
10
- const render = currentEntry && (await currentEntry.render())
11
- const { Content } = render || {}
6
+ const { toc = 'Op deze pagina', render } = Astro.props
7
+ const { Content } = (render && (await render())) || {}
12
8
  ---
13
9
 
14
- <Section
15
- style={{ '--screen': '768px' }}
16
- {...rest}
17
- >
18
- <Prose id="prose">
10
+ <Section class:list="article">
11
+ <Prose>
19
12
  {Content && <Content />}
13
+ <slot />
20
14
  </Prose>
15
+ <Toc
16
+ {render}
17
+ heading={toc}
18
+ />
21
19
  </Section>
20
+
21
+ <style is:global lang="scss">
22
+ .article {
23
+ display: flex;
24
+ position: relative;
25
+ flex-grow: 1;
26
+ flex-direction: row;
27
+ align-items: start;
28
+ height: 100%;
29
+
30
+ &:first-child {
31
+ padding-top: var(--space-6);
32
+ }
33
+
34
+ .prose {
35
+ margin-right: auto;
36
+ margin-left: auto;
37
+ max-width: 768px;
38
+ }
39
+ }
40
+ </style>
@@ -27,7 +27,7 @@ const {
27
27
  ...rest
28
28
  } = Astro.props
29
29
 
30
- const slug = Astro.url.pathname.replace(/^\/|\/$/g, '') || 'index'
30
+ const slug = Astro.params.page || 'index'
31
31
  const src = `/src/images/${images?.[0].id}`
32
32
  ---
33
33
 
@@ -10,11 +10,13 @@ const {
10
10
  icon = 'shopping-cart',
11
11
  color = 'brand',
12
12
  id = 'cart',
13
+ if: ifProp,
13
14
  ...rest
14
15
  } = Astro.props
15
16
  ---
16
17
 
17
18
  <Drawer
19
+ if={ifProp}
18
20
  class:list="cart"
19
21
  {icon}
20
22
  {color}
@@ -5,6 +5,7 @@ import Element from 'fulldev-ui/components/Element.astro'
5
5
  import Logo from 'fulldev-ui/components/experimental/Logo.astro'
6
6
  import Menu from 'fulldev-ui/components/Menu.astro'
7
7
  import type { GlobalProps } from 'fulldev-ui/types/global-props'
8
+ import Buttons from './Buttons.astro'
8
9
  import Heading from './Heading.astro'
9
10
 
10
11
  interface Props extends GlobalProps, HTMLAttributes<'aside'> {
@@ -15,6 +16,7 @@ interface Props extends GlobalProps, HTMLAttributes<'aside'> {
15
16
  logo?: ComponentProps<typeof Logo> | undefined
16
17
  company?: ComponentProps<typeof Logo>['company']
17
18
  menu?: ComponentProps<typeof Menu>['groups']
19
+ buttons?: ComponentProps<typeof Buttons>['buttons']
18
20
  }
19
21
 
20
22
  const {
@@ -24,15 +26,21 @@ const {
24
26
  color,
25
27
  variant,
26
28
  text,
29
+ buttons,
27
30
  heading,
28
31
  logo,
29
32
  company,
30
33
  menu,
34
+ if: ifProp,
31
35
  ...rest
32
36
  } = Astro.props
37
+
38
+ const buttonsGroup = { heading: '', buttons: buttons }
39
+ const mergedMenu = [buttonsGroup, ...(menu || [])] as typeof menu
33
40
  ---
34
41
 
35
42
  <Button
43
+ if={ifProp}
36
44
  variant="secondary"
37
45
  class:list={['drawer-button', `${id}-button`]}
38
46
  onclick={`document.getElementById('${id}').showModal()`}
@@ -43,6 +51,7 @@ const {
43
51
  />
44
52
 
45
53
  <Element
54
+ if={ifProp}
46
55
  onclick={`event.target === this && this.close()`}
47
56
  class:list="drawer"
48
57
  as="dialog"
@@ -72,7 +81,7 @@ const {
72
81
  <slot name="header" />
73
82
  </Element>
74
83
  <Element class:list="drawer-content">
75
- <Menu groups={menu} />
84
+ <Menu groups={mergedMenu} />
76
85
  <slot />
77
86
  </Element>
78
87
  <Element
@@ -115,7 +115,6 @@ const {
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;
@@ -56,11 +56,15 @@ const {
56
56
  <Drawer
57
57
  icon="menu-2"
58
58
  id="menu"
59
- {menu}
60
59
  {logo}
61
60
  {company}
61
+ {buttons}
62
+ {menu}
63
+ />
64
+ <Cart
65
+ if={cart}
66
+ heading={cart}
62
67
  />
63
- <Cart heading={cart} />
64
68
  </Element>
65
69
 
66
70
  <style lang="scss" is:global>
@@ -42,7 +42,6 @@ const image = images[src as keyof typeof images]
42
42
  image && (
43
43
  <AstroImage
44
44
  class:list={['image', position && `position-${position}`]}
45
- style={{ '--screen': '100vw' }}
46
45
  alt={alt || getAltBySrc()}
47
46
  src={image ? image() : src}
48
47
  width={width}
@@ -154,7 +154,6 @@ const Component =
154
154
  align-items: flex-start;
155
155
  gap: var(--space-6) var(--space-7);
156
156
  padding: var(--spacer) var(--gutter);
157
- overflow: auto;
158
157
 
159
158
  .segment {
160
159
  display: flex;
@@ -91,7 +91,7 @@ const {
91
91
  top: 0;
92
92
  flex: 1;
93
93
  flex-direction: column;
94
- padding: var(--space-6) var(--gutter);
94
+ padding: var(--space-md-6) var(--gutter);
95
95
  width: 100%;
96
96
  overflow-y: auto;
97
97
  }
@@ -20,7 +20,7 @@ const filteredHeadings = headings?.filter(
20
20
  ---
21
21
 
22
22
  <Element
23
- if={filteredHeadings?.length > 0}
23
+ if={filteredHeadings?.length > 1}
24
24
  class:list="toc"
25
25
  {size}
26
26
  {...rest}
@@ -49,17 +49,14 @@ const filteredHeadings = headings?.filter(
49
49
  @media (min-width: 1024px) {
50
50
  display: flex;
51
51
  position: sticky;
52
- top: var(--header-height, 0px);
52
+ top: calc(var(--header-height, 0px) + var(--space-6));
53
53
  bottom: 0;
54
54
  flex-shrink: 0;
55
55
  flex-direction: column;
56
56
  justify-content: flex-start;
57
57
  gap: var(--space-4);
58
58
  z-index: 10;
59
- padding: var(--space-md-6) var(--gutter);
60
- width: calc(var(--space-7) * 4);
61
- height: calc(100vh - var(--header-height, 0px));
62
- overflow-y: auto;
59
+ min-width: calc(var(--space-7) * 3);
63
60
 
64
61
  .depth-3 {
65
62
  padding-left: var(--space-4);
@@ -3,7 +3,7 @@ import Table from 'fulldev-ui/components/Table.astro'
3
3
  import { readFileSync } from 'node:fs'
4
4
  import { pascal } from 'radash'
5
5
 
6
- const slug = Astro.url.pathname.replace(/\/$/, '').split('/').pop() || ''
6
+ const slug = Astro.params.page || 'index'
7
7
  const componentName = pascal(slug)
8
8
 
9
9
  const allComponents = import.meta.glob('/src/**/*.astro', { eager: true })
@@ -10,9 +10,8 @@ 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
- header: true
14
13
  navigation:
15
- cart: Winkelwagen
14
+ header: true
16
15
  company: Fulldev UI
17
16
  buttons:
18
17
  - text: Docs
@@ -1,5 +1,6 @@
1
1
  component: DocsLayout
2
2
 
3
- sidebar: true
4
- header: false
5
- toc: 'On this page'
3
+ navigation:
4
+ sidebar: true
5
+ header: false
6
+ toc: 'On this page'
@@ -2,14 +2,13 @@
2
2
  import type { ComponentProps } from 'astro/types'
3
3
  import Button from 'fulldev-ui/components/Button.astro'
4
4
  import Element from 'fulldev-ui/components/Element.astro'
5
- import Prose from 'fulldev-ui/components/experimental/Prose.astro'
6
5
  import Layout from 'fulldev-ui/layouts/Layout.astro'
7
6
  import { crush } from 'radash'
7
+ import PostLayout from './PostLayout.astro'
8
8
 
9
9
  type Props = ComponentProps<typeof Layout>
10
10
 
11
- const { render, slug, navigation, ...rest } = Astro.props
12
- const { Content } = await render()
11
+ const { slug, navigation } = Astro.props
13
12
 
14
13
  const flatButtons = crush((navigation as any)?.buttons ?? {})
15
14
  const slugs = Object.entries(flatButtons)
@@ -21,45 +20,34 @@ const prevSlug = slugs[slugIndex - 1]
21
20
  const nextSlug = slugs[slugIndex + 1]
22
21
  ---
23
22
 
24
- <Layout
23
+ <PostLayout
25
24
  class:list="docs-layout"
26
- {render}
27
- {slug}
28
- {navigation}
29
- {...rest}
25
+ {...Astro.props}
30
26
  >
31
- <Prose>
32
- {Content && <Content />}
33
- <Element class:list={['prev-next', { 'next-only': !prevSlug }]}>
34
- <Button
35
- if={prevSlug}
36
- slug={prevSlug}
37
- icon="arrow-left"
38
- variant="secondary"
39
- />
40
- <Button
41
- if={nextSlug}
42
- slug={nextSlug}
43
- icon="arrow-right"
44
- variant="secondary"
45
- reverse={true}
46
- />
47
- </Element>
48
- </Prose>
49
- </Layout>
27
+ <Element
28
+ class:list={['prev-next', { 'next-only': !prevSlug }]}
29
+ slot="prose"
30
+ >
31
+ <Button
32
+ if={prevSlug}
33
+ slug={prevSlug}
34
+ icon="arrow-left"
35
+ variant="secondary"
36
+ />
37
+ <Button
38
+ if={nextSlug}
39
+ slug={nextSlug}
40
+ icon="arrow-right"
41
+ variant="secondary"
42
+ reverse={true}
43
+ />
44
+ </Element>
45
+ </PostLayout>
50
46
 
51
47
  <style lang="scss" is:global>
52
48
  @layer fulldev {
53
49
  .docs-layout {
54
50
  .prose {
55
- --screen: 768px;
56
- padding: var(--space-6) var(--gutter);
57
- color: var(--color-12);
58
-
59
- > h1 + p {
60
- color: var(--color-11);
61
- }
62
-
63
51
  > a,
64
52
  > p > a {
65
53
  color: var(--brand-11);
@@ -10,7 +10,6 @@ import Header from 'fulldev-ui/components/Header.astro'
10
10
  import Section from 'fulldev-ui/components/Section.astro'
11
11
  import Sections from 'fulldev-ui/components/sections.astro'
12
12
  import Sidebar from 'fulldev-ui/components/Sidebar.astro'
13
- import Toc from 'fulldev-ui/components/Toc.astro'
14
13
  import type { GlobalProps } from 'fulldev-ui/types/global-props'
15
14
 
16
15
  type Props = GlobalProps &
@@ -69,19 +68,20 @@ const {
69
68
  </slot>
70
69
  <slot name="header">
71
70
  <Header
72
- class:list={{
73
- 'for-sidebar': sidebar,
74
- }}
75
- if={navigation || header}
76
- {...navigation}
71
+ {...navigation?.header === true ? navigation : {}}
77
72
  {...header}
78
73
  />
79
74
  </slot>
80
75
  <div class="core">
81
76
  <slot name="sidebar">
82
77
  <Sidebar
83
- if={sidebar}
84
- {...navigation}
78
+ {...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}
85
85
  {...sidebar}
86
86
  />
87
87
  </slot>
@@ -92,12 +92,6 @@ const {
92
92
  <Sections {sections} />
93
93
  </slot>
94
94
  </main>
95
- <slot name="toc">
96
- <Toc
97
- heading={toc}
98
- {render}
99
- />
100
- </slot>
101
95
  </div>
102
96
  <slot name="footer">
103
97
  <Footer {...footer} />
@@ -116,7 +110,6 @@ const {
116
110
  }
117
111
 
118
112
  body {
119
- --screen: 100vw;
120
113
  display: flex;
121
114
  flex-direction: column;
122
115
  background-color: var(--base-background);
@@ -148,7 +141,6 @@ const {
148
141
  background-color: var(--color-background);
149
142
  width: 100%;
150
143
  max-width: 100vw;
151
- overflow-x: hidden;
152
144
  }
153
145
  }
154
146
  }
@@ -11,7 +11,7 @@ import { getReferenceChildren } from 'fulldev-ui/utils/getReferenceChildren'
11
11
 
12
12
  type Props = ComponentProps<typeof Layout>
13
13
 
14
- const { slug, sections, title, description } = Astro.props
14
+ const { slug, sections, title, description, render } = Astro.props
15
15
 
16
16
  const folderChildren = await getFolderChildren(slug)
17
17
  const referenceChildren = await getReferenceChildren(slug)
@@ -33,7 +33,10 @@ const referenceChildren = await getReferenceChildren(slug)
33
33
  cards={referenceChildren}
34
34
  structure="grid"
35
35
  />
36
- <Article style={{ '--screen': '768px' }} />
36
+ <Article
37
+ {render}
38
+ toc={false}
39
+ />
37
40
  <Sections {sections} />
38
41
  <slot />
39
42
  </Layout>
@@ -3,22 +3,19 @@ import type { ComponentProps } from 'astro/types'
3
3
  import Article from 'fulldev-ui/blocks/Article.astro'
4
4
  import Sections from 'fulldev-ui/components/sections.astro'
5
5
  import Layout from 'fulldev-ui/layouts/Layout.astro'
6
- import Excerpt from '../blocks/Excerpt.astro'
7
6
 
8
7
  type Props = ComponentProps<typeof Layout>
9
8
 
10
- const { sections, title, description, ...rest } = Astro.props
9
+ const { sections, render, toc } = Astro.props
11
10
  ---
12
11
 
13
12
  <Layout {...Astro.props}>
14
- <Excerpt
15
- heading={title}
16
- align="start"
17
- text={description}
18
- style={{ '--screen': '768px' }}
19
- {...rest}
20
- />
21
- <Article />
13
+ <Article
14
+ {render}
15
+ {toc}
16
+ >
17
+ <slot name="prose" />
18
+ </Article>
22
19
  <Sections {sections} />
23
20
  <slot />
24
21
  </Layout>
@@ -80,8 +80,8 @@ export const page = z
80
80
  section,
81
81
  sections,
82
82
  footer,
83
- header: z.boolean().or(header),
84
- sidebar: z.boolean().or(sidebar),
83
+ header: header,
84
+ sidebar: sidebar,
85
85
  navigation,
86
86
  toc,
87
87
  price,
@@ -1,4 +1,8 @@
1
+ import { z } from 'astro:content'
1
2
  import header from '../components/header'
2
3
  import sidebar from '../components/sidebar'
3
4
 
4
- export default sidebar.merge(header)
5
+ export default sidebar.merge(header).extend({
6
+ header: z.boolean().optional(),
7
+ sidebar: z.boolean().optional(),
8
+ })