fulldev-ui 0.3.0-beta.2 → 0.3.2

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.
Files changed (88) hide show
  1. package/.astro/settings.json +1 -1
  2. package/package.json +10 -5
  3. package/src/components/_Block.astro +0 -5
  4. package/src/components/_Component.astro +10 -8
  5. package/src/components/_archive/Body.astro +2 -2
  6. package/src/components/_archive/Nav.astro +12 -0
  7. package/src/components/_todo/Form.astro +1 -1
  8. package/src/components/_todo/Prose.astro +7 -7
  9. package/src/components/base/Badge.astro +20 -16
  10. package/src/components/base/Button.astro +21 -34
  11. package/src/components/base/Icon.astro +3 -2
  12. package/src/components/base/Image.astro +116 -42
  13. package/src/components/base/Logo.astro +1 -1
  14. package/src/components/base/Rating.astro +27 -25
  15. package/src/components/base/checkbox/Checkbox.astro +52 -0
  16. package/src/components/base/checkbox/CheckboxElement.astro +31 -0
  17. package/src/components/base/input/Input.astro +79 -0
  18. package/src/components/base/input/InputElement.astro +60 -0
  19. package/src/components/base/radio/Radio.astro +66 -0
  20. package/src/components/base/radio/RadioElement.astro +34 -0
  21. package/src/components/base/select/Select.astro +90 -0
  22. package/src/components/base/select/SelectElement.astro +56 -0
  23. package/src/components/base/select/SelectOption.astro +32 -0
  24. package/src/components/base/switch/Switch.astro +55 -0
  25. package/src/components/base/{Switch.astro → switch/SwitchElement.astro} +15 -13
  26. package/src/components/base/table/Table.astro +55 -0
  27. package/src/components/base/table/TableBody.astro +39 -0
  28. package/src/components/base/table/TableCell.astro +30 -0
  29. package/src/components/base/table/TableFooter.astro +48 -0
  30. package/src/components/base/table/TableHead.astro +31 -0
  31. package/src/components/base/table/TableHeader.astro +44 -0
  32. package/src/components/base/table/TableRow.astro +46 -0
  33. package/src/components/base/textarea/Textarea.astro +79 -0
  34. package/src/components/base/textarea/TextareaElement.astro +61 -0
  35. package/src/components/segment/Card.astro +28 -4
  36. package/src/components/segment/Footer.astro +88 -0
  37. package/src/components/segment/Header.astro +43 -13
  38. package/src/components/segment/Section.astro +60 -25
  39. package/src/components/segment/_regels.md +32 -0
  40. package/src/components/structure/Bento.astro +38 -0
  41. package/src/components/{segment → structure}/Box.astro +2 -12
  42. package/src/components/structure/Carousel.astro +55 -0
  43. package/src/components/structure/Column.astro +46 -0
  44. package/src/components/structure/Grid.astro +33 -0
  45. package/src/components/structure/Masonry.astro +42 -0
  46. package/src/components/structure/Row.astro +44 -0
  47. package/src/components/structure/Split.astro +54 -0
  48. package/src/components/structure/Spread.astro +45 -0
  49. package/src/components/structure/Wrap.astro +44 -0
  50. package/src/components/typography/Heading.astro +37 -28
  51. package/src/components/typography/Label.astro +4 -8
  52. package/src/components/typography/Link.astro +40 -12
  53. package/src/components/typography/List.astro +12 -13
  54. package/src/components/typography/ListItem.astro +11 -10
  55. package/src/components/typography/Paragraph.astro +4 -9
  56. package/src/components/typography/Tagline.astro +11 -10
  57. package/src/components/typography/Text.astro +5 -9
  58. package/src/css/color.scss +289 -0
  59. package/src/css/size.scss +293 -0
  60. package/src/css/space.scss +94 -0
  61. package/src/css/styles.css +1 -2
  62. package/src/index.ts +29 -11
  63. package/src/integration/tailwind.ts +34 -0
  64. package/src/integration/unocss.ts +38 -0
  65. package/src/schemas/collection.ts +2 -0
  66. package/src/components/_archive/Row.astro +0 -26
  67. package/src/components/_todo/Footer.astro +0 -66
  68. package/src/components/_todo/todo.md +0 -10
  69. package/src/components/base/Checkbox.astro +0 -41
  70. package/src/components/base/Input.astro +0 -59
  71. package/src/components/base/Radio.astro +0 -39
  72. package/src/components/base/Select.astro +0 -69
  73. package/src/components/base/SelectOption.astro +0 -27
  74. package/src/components/base/Textarea.astro +0 -34
  75. package/src/components/base/todo.md +0 -7
  76. package/src/components/segment/Deck.astro +0 -40
  77. package/src/components/segment/Group.astro +0 -29
  78. package/src/components/typography/todo.md +0 -3
  79. package/src/css/color.css +0 -88
  80. package/src/css/props/align.scss +0 -20
  81. package/src/css/props/frame.scss +0 -153
  82. package/src/css/props/mask +0 -1
  83. package/src/css/props/position.scss +0 -33
  84. package/src/css/props/ratio +0 -1
  85. package/src/css/props/structure.scss +0 -228
  86. package/src/css/props/variant.scss +0 -130
  87. package/src/css/radix.css +0 -281
  88. package/src/css/size.css +0 -334
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "_variables": {
3
- "lastUpdateCheck": 1718391483085
3
+ "lastUpdateCheck": 1719579657106
4
4
  }
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fulldev-ui",
3
- "version": "0.3.0-beta.2",
3
+ "version": "0.3.2",
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",
@@ -23,22 +23,27 @@
23
23
  "type": "module",
24
24
  "exports": {
25
25
  ".": "./src/index.ts",
26
- "./color": "./src/css/color.css",
27
- "./radix": "./src/css/radix.css",
28
- "./integration": "./src/integration/integration.ts"
26
+ "./color": "./src/css/color.scss",
27
+ "./integration": "./src/integration/integration.ts",
28
+ "./tailwind": "./src/integration/tailwind.ts",
29
+ "./unocss": "./src/integration/unocss.ts"
29
30
  },
30
31
  "devDependencies": {
31
32
  "@astrojs/check": "^0.5.9",
32
33
  "@types/flat": "^5.0.5",
33
- "astro": "^4.5.5"
34
+ "astro": "^4.5.5",
35
+ "unocss": "^0.61.0"
34
36
  },
35
37
  "dependencies": {
36
38
  "@iconify-json/tabler": "^1.1.109",
37
39
  "astro-seo": "^0.8.3",
38
40
  "flat": "^6.0.1",
41
+ "html-element-attributes": "^3.4.0",
39
42
  "radash": "^12.1.0",
40
43
  "remeda": "1.61.0",
41
44
  "sass": "^1.77.0",
45
+ "tailwindcss": "^3.4.4",
46
+ "tailwindcss-themer": "^4.0.0",
42
47
  "typescript": "^5.4.3",
43
48
  "vite-plugin-virtual": "^0.3.0"
44
49
  }
@@ -15,11 +15,6 @@ const Component = components.find((component) => {
15
15
  const componentName = fileName?.split('.')[0]
16
16
  return componentName === _block
17
17
  })?.default
18
-
19
- console.log({
20
- _block,
21
- Component,
22
- })
23
18
  ---
24
19
 
25
20
  {Component && <Component {...rest} />}
@@ -5,15 +5,18 @@ type Props<As extends HTMLTag> = {
5
5
  as?: As
6
6
  slot?: any
7
7
  if?: 'content' | any
8
+ wrapper?: any
8
9
  [key: string | number | symbol]: any
9
10
  }
10
11
 
11
12
  const {
12
13
  as: As = 'div',
13
14
  if: ifProp = 'content',
15
+ wrapper = true,
14
16
  theme,
15
17
  compact,
16
18
  variant,
19
+ underline,
17
20
  density,
18
21
  size,
19
22
  align,
@@ -25,6 +28,7 @@ const {
25
28
  structure,
26
29
  text,
27
30
  html,
31
+ level,
28
32
  ...rest
29
33
  } = Astro.props
30
34
 
@@ -42,10 +46,12 @@ const render =
42
46
  <As
43
47
  class:list={[
44
48
  'full',
49
+ structure,
45
50
  {
46
51
  compact,
47
52
  contrast,
48
53
  [`theme-${theme}`]: theme,
54
+ [`level-${level}`]: level,
49
55
  [`variant-${variant}`]: variant,
50
56
  [`density-${density}`]: density,
51
57
  [`structure-${structure}`]: structure,
@@ -55,6 +61,7 @@ const render =
55
61
  [`frame-${frame}`]: frame,
56
62
  [`ratio-${ratio}`]: ratio,
57
63
  [`color-${color}`]: color,
64
+ [`underline-${underline}`]: underline,
58
65
  },
59
66
  ]}
60
67
  {...rest}
@@ -68,17 +75,12 @@ const render =
68
75
 
69
76
  <style is:global lang="scss">
70
77
  @import '../css/utils.scss';
71
- @import '../css/color.css';
78
+ @import '../css/color.scss';
72
79
  @import '../css/styles.css';
73
- @import '../css/size.css';
74
- @import '../css/props/frame.scss';
75
- @import '../css/props/variant.scss';
76
- @import '../css/props/structure.scss';
77
- @import '../css/props/align.scss';
78
- @import '../css/props/position.scss';
80
+ @import '../css/size.scss';
81
+ @import '../css/space.scss';
79
82
 
80
83
  @include component('full') {
81
- z-index: 0;
82
84
  box-sizing: border-box;
83
85
  }
84
86
  </style>
@@ -29,8 +29,8 @@ const { as = 'body', ...rest } = Astro.props
29
29
  max-width: 100vw;
30
30
  height: 100%;
31
31
  min-height: 100vh;
32
- color: var(--foreground);
33
- font-size: var(--text-body);
32
+ color: var(--text);
33
+ font-size: var(--text-2);
34
34
  font-family: var(--font-family);
35
35
  }
36
36
  </style>
@@ -26,5 +26,17 @@ const { as = 'nav', structure = 'spread', ...rest } = Astro.props
26
26
  @include component('nav') {
27
27
  margin-left: auto;
28
28
  width: max-content;
29
+
30
+ &.align-start {
31
+ align-items: flex-start;
32
+ }
33
+
34
+ &.align-center {
35
+ align-items: center;
36
+ }
37
+
38
+ &.align-end {
39
+ align-items: flex-end;
40
+ }
29
41
  }
30
42
  </style>
@@ -25,6 +25,6 @@ const { as = 'form', structure = 'column', ...rest } = Astro.props
25
25
  @include component('form') {
26
26
  display: flex;
27
27
  width: 100%;
28
- max-width: calc(var(--element-3) * 36);
28
+ max-width: calc(var(--space-4) * 36);
29
29
  }
30
30
  </style>
@@ -32,9 +32,9 @@ const { as = 'div', ...rest } = Astro.props
32
32
 
33
33
  // Tables
34
34
  .full.prose {
35
- color: var(--foreground);
35
+ color: var(--text);
36
36
  font-weight: var(--font-weight);
37
- font-size: var(--text-body);
37
+ font-size: var(--text-2);
38
38
  line-height: 1.625;
39
39
  font-family: var(--font-family);
40
40
 
@@ -51,7 +51,7 @@ const { as = 'div', ...rest } = Astro.props
51
51
  h5,
52
52
  h6 {
53
53
  margin: var(--space-2) 0;
54
- font: 600 var(--text-body) 'Saira';
54
+ font: 600 var(--text-2) 'Saira';
55
55
 
56
56
  & + p {
57
57
  color: var(--hue11);
@@ -65,7 +65,7 @@ const { as = 'div', ...rest } = Astro.props
65
65
  }
66
66
 
67
67
  table {
68
- margin: var(--space-4) 0;
68
+ margin: var(--space-5) 0;
69
69
  border: 1px solid var(--border);
70
70
  border-radius: var(--radius-1) !important;
71
71
  border-collapse: collapse;
@@ -77,7 +77,7 @@ const { as = 'div', ...rest } = Astro.props
77
77
  background: var(--raised-background) !important;
78
78
  color: var(--muted-foreground) !important;
79
79
  font-weight: 500 !important;
80
- font-size: var(--text-label) !important;
80
+ font-size: var(--text-1) !important;
81
81
  }
82
82
 
83
83
  td {
@@ -91,14 +91,14 @@ const { as = 'div', ...rest } = Astro.props
91
91
 
92
92
  table a {
93
93
  color: var(--solid) !important;
94
- font-size: var(--text-label) !important;
94
+ font-size: var(--text-1) !important;
95
95
  line-height: 1 !important;
96
96
  white-space: nowrap;
97
97
  }
98
98
 
99
99
  h6 {
100
100
  margin: var(--space-2) 0;
101
- font-size: var(--text-body) !important;
101
+ font-size: var(--text-2) !important;
102
102
  }
103
103
 
104
104
  table a:hover {
@@ -1,25 +1,29 @@
1
1
  ---
2
- import type { ComponentProps, HTMLTag, Polymorphic } from 'astro/types'
2
+ import type { HTMLTag, Polymorphic } from 'astro/types'
3
3
  import Component from '../_Component.astro'
4
4
  import Icon from './Icon.astro'
5
5
 
6
- type Props<As extends HTMLTag = 'div'> = Polymorphic<{ as: As }> &
7
- ComponentProps<typeof Component> & {
8
- html?: string
9
- text?: string
10
- variant?: 'primary' | 'raised' | 'muted' | 'accent' | 'outline'
11
- icon?: ComponentProps<typeof Icon> | ComponentProps<typeof Icon>['name']
12
- }
6
+ type Props<As extends HTMLTag = 'div'> = Polymorphic<{ as: As }> & {
7
+ variant?: 'solid' | 'surface' | 'soft' | 'outline' | 'ghost'
8
+ size?: 'sm' | 'md' | 'lg'
9
+ color?: 'base' | 'brand'
10
+ contrast?: boolean
11
+ compact?: boolean
12
+ html?: string
13
+ text?: string
14
+ icon?: string
15
+ }
13
16
 
14
- const { icon, ...rest } = Astro.props
17
+ const { variant = 'outline', icon, ...rest } = Astro.props
15
18
  ---
16
19
 
17
20
  <Component
18
21
  class:list={['badge']}
22
+ {variant}
19
23
  {...rest}
20
24
  >
21
25
  <slot />
22
- {typeof icon === 'string' ? <Icon name={icon} /> : <Icon {...icon} />}
26
+ <Icon name={icon} />
23
27
  </Component>
24
28
 
25
29
  <style is:global lang="scss">
@@ -33,15 +37,15 @@ const { icon, ...rest } = Astro.props
33
37
  vertical-align: top;
34
38
  gap: var(--space-2);
35
39
  transition: var(--transition);
36
- box-shadow: inset 0 0 0 1px var(--border);
40
+ border: 1px solid var(--border);
37
41
  border-radius: var(--radius-1);
38
42
  background-color: var(--background);
39
- padding-right: var(--element-2);
40
- padding-left: var(--element-2);
41
- height: calc(var(--text-label) + 2 * var(--element-1));
42
- color: var(--foreground);
43
+ padding-right: var(--space-3);
44
+ padding-left: var(--space-3);
45
+ height: calc(var(--text-1) + 2 * var(--space-2));
46
+ color: var(--text);
43
47
  font-weight: var(--button-font-weight);
44
- font-size: var(--text-label);
48
+ font-size: var(--text-1);
45
49
  line-height: 1.625;
46
50
  font-family: var(--button-font-family);
47
51
  text-align: center;
@@ -3,30 +3,23 @@ import type { ComponentProps, HTMLTag, Polymorphic } from 'astro/types'
3
3
  import Component from '../_Component.astro'
4
4
  import Icon from './Icon.astro'
5
5
 
6
- type Props<As extends HTMLTag = 'a'> = Polymorphic<{ as: As }> &
7
- ComponentProps<typeof Component> & {
8
- html?: string
9
- text?: string
10
- variant?: 'solid' | 'soft' | 'surface' | 'outline' | 'ghost' | 'link'
11
- color?: 'base' | 'brand'
12
- icon?: ComponentProps<typeof Icon> | ComponentProps<typeof Icon>['name']
13
- }
6
+ type Props<As extends HTMLTag = 'a'> = Polymorphic<{ as: As }> & {
7
+ size?: 'sm' | 'md' | 'lg'
8
+ color?: 'base' | 'brand'
9
+ contrast?: boolean
10
+ html?: string
11
+ text?: string
12
+ variant?: 'solid' | 'soft' | 'surface' | 'outline' | 'ghost' | 'link'
13
+ icon?: ComponentProps<typeof Icon> | ComponentProps<typeof Icon>['name']
14
+ }
14
15
 
15
- const {
16
- as = 'a',
17
- variant = 'solid',
18
- color = variant === 'solid' ? 'brand' : 'base',
19
- contrast,
20
- icon,
21
- ...rest
22
- } = Astro.props
16
+ const { as = 'a', variant = 'solid', contrast, icon, ...rest } = Astro.props
23
17
  ---
24
18
 
25
19
  <Component
26
20
  class:list={['button']}
27
21
  {as}
28
22
  {variant}
29
- {color}
30
23
  {contrast}
31
24
  {...rest}
32
25
  >
@@ -38,8 +31,6 @@ const {
38
31
  @import '../../css/utils.scss';
39
32
 
40
33
  @include component('button') {
41
- @import '../../css/props/variant.scss';
42
-
43
34
  display: inline-flex;
44
35
  flex-shrink: 0;
45
36
  justify-content: center;
@@ -49,14 +40,15 @@ const {
49
40
  transition: background-color var(--transition);
50
41
  cursor: pointer;
51
42
  outline: none !important;
52
- border: none;
43
+ border: 1px solid var(--border);
53
44
  border-radius: var(--radius-1);
54
- padding-right: var(--element-3);
55
- padding-left: var(--element-3);
56
- height: calc(var(--text-label) + 2 * var(--element-3));
57
- color: var(--foreground);
45
+ background-color: var(--background);
46
+ padding-right: var(--space-4);
47
+ padding-left: var(--space-4);
48
+ height: calc(var(--text-1) + 2 * var(--space-4));
49
+ color: var(--text);
58
50
  font-weight: var(--button-font-weight);
59
- font-size: var(--text-label);
51
+ font-size: var(--text-1);
60
52
  line-height: 1.625;
61
53
  font-family: var(--button-font-family);
62
54
  text-align: center;
@@ -68,10 +60,6 @@ const {
68
60
  outline-offset: 2px;
69
61
  }
70
62
 
71
- &.variant-solid {
72
- color: var(--background);
73
- }
74
-
75
63
  &:disabled {
76
64
  opacity: 0.5;
77
65
  cursor: not-allowed;
@@ -80,14 +68,13 @@ const {
80
68
 
81
69
  &.variant-link {
82
70
  box-shadow: none;
71
+ border-color: transparent;
72
+ background-color: transparent;
83
73
  padding: 0;
74
+ height: auto;
84
75
 
85
76
  &:hover {
86
- text-decoration: underline;
87
- }
88
-
89
- &.contrast {
90
- color: var(--foreground-contrast);
77
+ color: var(--colo-12);
91
78
  }
92
79
  }
93
80
  }
@@ -6,6 +6,7 @@ import Component from '../_Component.astro'
6
6
  type Props<As extends HTMLTag = 'i'> = Polymorphic<{ as: As }> &
7
7
  ComponentProps<typeof Component> & {
8
8
  name?: string
9
+ color?: 'base' | 'brand'
9
10
  }
10
11
 
11
12
  const { as = 'i', name, ...rest } = Astro.props
@@ -43,8 +44,8 @@ const icon = trimmedName
43
44
  align-items: center;
44
45
  width: 1em;
45
46
  height: 1em;
46
- color: var(--foreground);
47
- font-size: var(--text-body);
47
+ color: var(--text);
48
+ font-size: var(--text-2);
48
49
 
49
50
  svg {
50
51
  position: absolute;
@@ -1,11 +1,14 @@
1
1
  ---
2
- import type { ComponentProps } from 'astro/types'
2
+ import type { HTMLAttributes } from 'astro/types'
3
+ import { Image as AstroImage } from 'astro:assets'
3
4
  import { isString } from 'remeda'
4
5
  import Component from '../_Component.astro'
5
6
 
6
- interface Props extends ComponentProps<typeof Component> {
7
- position?: 'background' | 'cover'
7
+ type Props = HTMLAttributes<'img'> & {
8
+ position?: 'background' | 'cover' | 'inset'
8
9
  frame?: 'inset'
10
+ width?: number | 1920
11
+ height?: number | 1920
9
12
  }
10
13
 
11
14
  function getAltBySrc(): string {
@@ -17,53 +20,44 @@ function getAltBySrc(): string {
17
20
  }
18
21
 
19
22
  const {
20
- as = 'img',
21
23
  loading = 'lazy',
22
24
  alt = getAltBySrc(),
23
- src = Astro.props.html,
25
+ src = Astro.props.src,
24
26
  position,
25
27
  frame,
28
+ width,
29
+ height,
26
30
  ...rest
27
31
  } = Astro.props
28
-
29
- // function getSrc() {
30
- // if (src?.startsWith('http')) return src
31
- // // TODO: add eager import
32
- // const images = Astro.glob('/src/assets/**/*.{jpeg,jpg,png,webp,gif}', {
33
- // eager: true,
34
- // })
35
- // const path = ('/src/assets/' + src).replace('//', '/')
36
- // const image = images[path]
37
- // if (!image) console.warn(`Image not found: ${path}`)
38
- // else return image
39
- // }
40
-
41
- // function getSizes() {
42
- // const mapped = Object.entries(sizes).map(([key, value]) => {
43
- // if (key === 'base') return value
44
- // if (key === 'sm') return `(min-width: 640px) ${value}`
45
- // if (key === 'md') return `(min-width: 768px) ${value}`
46
- // if (key === 'lg') return `(min-width: 1024px) ${value}`
47
- // if (key === 'xl') return `(min-width: 1280px) ${value}`
48
- // if (key === '2xl') return `(min-width: 1536px) ${value}`
49
- // })
50
- // const joined = mapped.join(', ')
51
- // return joined
52
- // }
53
32
  ---
54
33
 
55
34
  {
56
35
  src && (
57
- <Component
58
- class:list={['image']}
59
- if={src}
60
- {src}
61
- {alt}
62
- {as}
63
- {frame}
64
- {position}
65
- {...rest}
66
- />
36
+ <>
37
+ {!width && !height && (
38
+ <Component
39
+ class:list={['image']}
40
+ if={src}
41
+ {src}
42
+ {alt}
43
+ as="img"
44
+ {frame}
45
+ {position}
46
+ {...rest}
47
+ />
48
+ )}
49
+ {width && height && (
50
+ <AstroImage
51
+ class:list={['image']}
52
+ {src}
53
+ {alt}
54
+ width={width}
55
+ height={height}
56
+ loading="eager"
57
+ {...rest}
58
+ />
59
+ )}
60
+ </>
67
61
  )
68
62
  }
69
63
 
@@ -72,10 +66,8 @@ const {
72
66
 
73
67
  @include component('image') {
74
68
  display: block;
75
- border-radius: var(--radius-1);
76
69
  width: 100%;
77
70
  height: auto;
78
- object-fit: cover;
79
71
 
80
72
  &.mask-sm {
81
73
  -webkit-mask-image: linear-gradient(to top, transparent 0%, black 30%);
@@ -86,5 +78,87 @@ const {
86
78
  -webkit-mask-image: linear-gradient(to top, transparent 0%, black 100%);
87
79
  mask-image: linear-gradient(to top, transparent 0%, black 100%);
88
80
  }
81
+
82
+ &.position-background {
83
+ position: absolute;
84
+ top: 0;
85
+ right: 0;
86
+ bottom: 0;
87
+ left: 0;
88
+ z-index: -1;
89
+ margin: 0 !important;
90
+ border-radius: 0;
91
+ width: 100%;
92
+ height: 100%;
93
+ max-height: 100%;
94
+ object-fit: cover;
95
+ }
96
+
97
+ &.position-cover {
98
+ width: 100%;
99
+ height: 100%;
100
+ object-fit: cover;
101
+ }
102
+
103
+ &.position-container {
104
+ width: 100%;
105
+ height: 100%;
106
+ object-fit: contain;
107
+ object-position: center;
108
+ }
109
+
110
+ &.position-inset {
111
+ object-fit: cover;
112
+
113
+ &:is(.structure-column > &) {
114
+ margin-right: calc(var(--inner-x) * -1);
115
+ margin-left: calc(var(--inner-x) * -1);
116
+ width: calc(100% + var(--inner-x) * 2);
117
+
118
+ &.image:first-child {
119
+ margin-top: calc(var(--inner-y) * -1);
120
+ height: calc(100% + var(--inner-y) * 1);
121
+ }
122
+
123
+ &.image:last-child {
124
+ margin-bottom: calc(var(--inner-y) * -1);
125
+ height: calc(100% + var(--inner-y) * 1);
126
+ }
127
+ }
128
+
129
+ &:is(.structure-split > &) {
130
+ @media (max-width: 1023.999px) {
131
+ margin-right: calc(var(--inner-x) * -1);
132
+ margin-left: calc(var(--inner-x) * -1);
133
+ width: calc(100% + var(--inner-x) * 2);
134
+
135
+ &.image:first-child {
136
+ margin-top: calc(var(--inner-y) * -1);
137
+ height: calc(100% + var(--inner-y) * 1);
138
+ }
139
+
140
+ &.image:last-child {
141
+ margin-bottom: calc(var(--inner-y) * -1);
142
+ height: calc(100% + var(--inner-y) * 1);
143
+ }
144
+ }
145
+
146
+ @media (min-width: 1024px) {
147
+ margin-top: calc(var(--inner-y) * -1);
148
+ margin-bottom: calc(var(--inner-y) * -1);
149
+ height: calc(100% + var(--inner-y) * 2);
150
+
151
+ &.image:first-child {
152
+ margin-left: calc(var(--inner-x) * -1);
153
+ width: calc(100% + var(--inner-x) * 1);
154
+ }
155
+
156
+ &.image:last-child {
157
+ margin-right: calc(var(--inner-x) * -1);
158
+ width: calc(100% + var(--inner-x) * 1);
159
+ }
160
+ }
161
+ }
162
+ }
89
163
  }
90
164
  </style>
@@ -27,7 +27,7 @@ const { as = 'a', href = '/', src, ...rest } = Astro.props
27
27
  .image {
28
28
  display: block !important;
29
29
  width: auto !important;
30
- height: var(--space-5) !important;
30
+ height: var(--space-6) !important;
31
31
  object-fit: contain !important;
32
32
  color: var(--12) !important;
33
33
  }
@@ -5,44 +5,46 @@ import Icon from './Icon.astro'
5
5
 
6
6
  type Props<As extends HTMLTag = 'div'> = Polymorphic<{ as: As }> &
7
7
  ComponentProps<typeof Component> & {
8
- value?: number | string
8
+ color?: 'base' | 'brand'
9
+ value?: number
10
+ size?: string
11
+ compact?: boolean
9
12
  }
10
13
 
11
- const { value = Astro.props.html, ...rest } = Astro.props
14
+ const { size, compact, value = 5, ...rest } = Astro.props
15
+
16
+ const getIcon = (count: number) => {
17
+ const difference = value - count
18
+ if (difference >= -0.25) return 'star-filled'
19
+ if (difference >= -0.75) return 'star-half-filled'
20
+ return 'star'
21
+ }
12
22
  ---
13
23
 
14
24
  <Component
15
25
  class:list={['rating']}
16
26
  {...rest}
17
27
  >
18
- {value && [1, 2, 3, 4, 5].map(() => <Icon name="star-filled" />)}
28
+ {
29
+ [1, 2, 3, 4, 5].map((_, i) => (
30
+ <>
31
+ <Icon
32
+ size={size}
33
+ compact={compact}
34
+ name={getIcon(i + 1)}
35
+ class:list={'rating-icon-solid'}
36
+ />
37
+ </>
38
+ ))
39
+ }
19
40
  </Component>
20
41
 
21
42
  <style is:global lang="scss">
22
43
  @import '../../css/utils.scss';
23
44
 
24
45
  @include component('rating') {
25
- display: flex;
26
- gap: 0.75rem;
27
- padding-left: 5px;
28
-
29
- &.center {
30
- padding-left: 0 !important;
31
- }
32
-
33
- i {
34
- --un-icon: url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M0 0h24v24H0z'/%3E%3Cpath fill='currentColor' d='m8.243 7.34l-6.38.925l-.113.023a1 1 0 0 0-.44 1.684l4.622 4.499l-1.09 6.355l-.013.11a1 1 0 0 0 1.464.944l5.706-3l5.693 3l.1.046a1 1 0 0 0 1.352-1.1l-1.091-6.355l4.624-4.5l.078-.085a1 1 0 0 0-.633-1.62l-6.38-.926l-2.852-5.78a1 1 0 0 0-1.794 0z'/%3E%3C/g%3E%3C/svg%3E");
35
- -webkit-mask: var(--un-icon) no-repeat;
36
- mask: var(--un-icon) no-repeat;
37
- -webkit-mask-size: 100% 100%;
38
- mask-size: 100% 100%;
39
- margin-left: -0.4em;
40
- background-color: currentColor;
41
- width: 1em;
42
- width: 1.25em;
43
- height: 1em;
44
- height: 1.25em;
45
- color: var(--foreground);
46
- }
46
+ display: inline-flex;
47
+ position: relative;
48
+ gap: var(--space-2);
47
49
  }
48
50
  </style>