spoko-design-system 0.5.3 → 0.5.4

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/index.ts CHANGED
@@ -31,7 +31,7 @@ export { default as ProductLink } from './src/components/Product/ProductLink.vue
31
31
  export { default as LanguageSuggestion } from './src/components/LanguageSuggestion.astro';
32
32
  export { default as Input } from './src/components/Input.astro';
33
33
 
34
- export { default as CategoryLink } from './src/components/Category/CategoryLink.vue';
34
+ export { default as PostCategories } from './src/components/Post/PostCategories.vue';
35
35
  export { default as CategorySidebarToggler } from './src/components/Category/CategorySidebarToggler.vue';
36
36
  export { default as SubCategoryLink } from './src/components/Category/SubCategoryLink.vue';
37
37
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spoko-design-system",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "private": false,
5
5
  "main": "./index.ts",
6
6
  "module": "./index.ts",
@@ -1,5 +1,7 @@
1
1
  <script setup lang="ts">
2
- const props = defineProps<{
2
+ import { useAttrs } from 'vue'
3
+
4
+ interface ButtonProps {
3
5
  href?: string;
4
6
  title?: string;
5
7
  primary?: boolean;
@@ -18,7 +20,10 @@ const props = defineProps<{
18
20
  mediumHover?: boolean;
19
21
  darkHover?: boolean;
20
22
  circle?: boolean;
21
- }>();
23
+ [key: string]: any; // To allow additional props
24
+ }
25
+
26
+ const props = defineProps<ButtonProps>();
22
27
 
23
28
  // Check if we should add a default mediumHover for tertiary
24
29
  const shouldAddDefaultMediumHover = props.tertiary || props.tertiaryOutline &&
@@ -47,10 +52,19 @@ const classes = {
47
52
  "btn-medium-hover": props.mediumHover || shouldAddDefaultMediumHover,
48
53
  "btn-dark-hover": props.darkHover
49
54
  };
55
+
56
+
57
+ const attrs = useAttrs();
50
58
  </script>
51
59
 
52
60
  <template>
53
- <component :is="tag" :class="classes" :href="props.href" :title="props.title ? props.title : null">
61
+ <component
62
+ :is="tag"
63
+ :class="classes"
64
+ v-bind="attrs"
65
+ :href="props.href"
66
+ :title="props.title ? props.title : null"
67
+ >
54
68
  <slot></slot>
55
69
  </component>
56
70
  </template>
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  // variants/Post.astro
3
3
  import type { Author, Category } from '../types';
4
- import CategoryLink from "../../CategoryLink.astro";
4
+ import PostCategories from "../../Post/PostCategories.astro";
5
5
  import Date from "../../Date.astro";
6
6
 
7
7
  interface Props {
@@ -34,7 +34,7 @@ const {
34
34
 
35
35
  {hasCategories && (
36
36
  <div class="order-1">
37
- <CategoryLink categories={categories} />
37
+ <PostCategories categories={categories} />
38
38
  </div>
39
39
  )}
40
40
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  import type { Author, Category } from '../types';
3
- import CategoryLink from "../../CategoryLink.astro";
3
+ import PostCategories from "../../Post/PostCategories.astro";
4
4
  import Date from "../../Date.astro";
5
5
  import { Image } from "astro:assets";
6
6
 
@@ -42,7 +42,7 @@ const cleanTitle = stripHtml(title);
42
42
 
43
43
  {hasCategories && (
44
44
  <div class="jumbotron-categories">
45
- <CategoryLink categories={categories} />
45
+ <PostCategories categories={categories} />
46
46
  </div>
47
47
  )}
48
48
 
@@ -0,0 +1,38 @@
1
+ ---
2
+ interface Category {
3
+ id: number;
4
+ name: string;
5
+ slug: string;
6
+ description: string;
7
+ count: number;
8
+ parent: number;
9
+ link: string;
10
+ }
11
+
12
+ interface Props {
13
+ categories: Category[];
14
+ }
15
+
16
+ const { categories } = Astro.props;
17
+ ---
18
+
19
+ <div class="text-brand-secondary uppercase text-base z-3 relative w-full">
20
+ {
21
+ categories && categories.length > 0
22
+ ? categories.map((category, index) => (
23
+ <>
24
+ {index > 0 && (
25
+ <span class="w-px h-2.5 bg-gray-300 mx-2.5 inline-block relative" />
26
+ )}
27
+ <a
28
+ class="term-link text-sm sm:text-base hover:text-light-blue-400
29
+ "
30
+ href={category.link}
31
+ >
32
+ {category.name}
33
+ </a>
34
+ </>
35
+ ))
36
+ : null
37
+ }
38
+ </div>
@@ -0,0 +1,39 @@
1
+ <script setup lang="ts">
2
+ interface Category {
3
+ id: number;
4
+ name: string;
5
+ slug: string;
6
+ description: string;
7
+ link: string;
8
+ }
9
+
10
+ interface Props {
11
+ category: Category;
12
+ active?: boolean;
13
+ }
14
+
15
+ const props = withDefaults(defineProps<Props>(), {
16
+ active: false
17
+ });
18
+ </script>
19
+
20
+ <template>
21
+ <a
22
+ :href="props.category.link"
23
+ class="category-link"
24
+ :class="{ 'active': props.active }"
25
+ :title="props.category.description || props.category.name"
26
+ >
27
+ {{ props.category.name }}
28
+ </a>
29
+ </template>
30
+
31
+ <style>
32
+ .category-link {
33
+ @apply text-sm sm:text-base text-accent-lightest uppercase hover:text-blue-500 transition-colors;
34
+ }
35
+
36
+ .category-link.active {
37
+ @apply text-blue-500;
38
+ }
39
+ </style>
@@ -17,7 +17,7 @@ interface Props {
17
17
  }
18
18
 
19
19
  const { image, title, categories, date, author } = Astro.props;
20
- import CategoryLink from "./CategoryLink.astro";
20
+ import PostCategories from "./Post/PostCategories.astro";
21
21
  import Date from "./Date.astro";
22
22
  ---
23
23
 
@@ -33,7 +33,7 @@ import Date from "./Date.astro";
33
33
  >
34
34
  {title}
35
35
  </h1>
36
- <CategoryLink categories={categories} />
36
+ <PostCategories categories={categories} />
37
37
  <div class="order-3 flex items-center text-gray-1 00">
38
38
  {
39
39
  author && (
@@ -234,8 +234,8 @@ Designed for blog posts and articles, featuring a full-width image overlay with
234
234
  title="Blog Post Title"
235
235
  image="https://img.freepik.com/free-photo/nature-beauty-tropical-rainforest-adventure-tranquility-freshness-generated-by-artificial-intellingence_25030-62539.jpg?size=1920&ext=jpg"
236
236
  categories={[
237
- { name: 'Technology', uri: '#' },
238
- { name: 'Design', uri: '#' }
237
+ { name: 'Technology', link: '#' },
238
+ { name: 'Design', link: '#' }
239
239
  ]}
240
240
  author={{
241
241
  firstName: "John",
@@ -251,8 +251,8 @@ Designed for blog posts and articles, featuring a full-width image overlay with
251
251
  title="Blog Post Title"
252
252
  image="https://img.freepik.com/free-photo/nature-beauty-tropical-rainforest-adventure-tranquility-freshness-generated-by-artificial-intellingence_25030-62539.jpg?size=1920&ext=jpg"
253
253
  categories={[
254
- { name: 'Technology', uri: '#' },
255
- { name: 'Design', uri: '#' }
254
+ { name: 'Technology', link: '#' },
255
+ { name: 'Design', link: '#' }
256
256
  ]}
257
257
  author={{
258
258
  firstName: "John",
@@ -271,8 +271,8 @@ A two-column layout variant for posts where image and content need equal emphasi
271
271
  title="<b>Formatted</b> Blog Post Title <small>Lorem Ipsum</small>"
272
272
  image="http://localhost:1234/_image?href=https%3A%2F%2Fimg.freepik.com%2Ffree-photo%2Fnature-beauty-tropical-rainforest-adventure-tranquility-freshness-generated-by-artificial-intellingence_25030-62539.jpg%3Fsize%3D960%26ext%3Djpg&w=1200&h=675&f=webp"
273
273
  categories={[
274
- { name: 'Technology', uri: '#' },
275
- { name: 'Design', uri: '#' }
274
+ { name: 'Technology', link: '#' },
275
+ { name: 'Design', link: '#' }
276
276
  ]}
277
277
  author={{
278
278
  firstName: "John",
@@ -288,8 +288,8 @@ A two-column layout variant for posts where image and content need equal emphasi
288
288
  title="<b>Formatted</b> Blog Post Title <small>Lorem Ipsum</small>"
289
289
  image="path/to/image.jpg"
290
290
  categories={[
291
- { name: 'Technology', uri: '#' },
292
- { name: 'Design', uri: '#' }
291
+ { name: 'Technology', link: '#' },
292
+ { name: 'Design', link: '#' }
293
293
  ]}
294
294
  author={{
295
295
  firstName: "John",
@@ -91,10 +91,10 @@ const navItems = [
91
91
  <div>
92
92
  <Headline underline as="div" class="mx-auto text-gray-900" textSize="3xl">Download:</Headline>
93
93
  <div class="grid grid-flow-col gap-4 auto-cols-max text-6xl mb-12">
94
- <a href="https://www.npmjs.com/package/spoko-design-system" rel="noopener" title="npm page" class="hover:text-light-blue-400">
94
+ <a href="https://www.npmjs.com/package/spoko-design-system" rel="noopener" title="npm page" class="hover:text-accent-lightest">
95
95
  <Icon name="mdi:npm"/>
96
96
  </a>
97
- <a href="https://github.com/polo-blue/sds" rel="noopener" title="Github Page" class="hover:text-light-blue-400">
97
+ <a href="https://github.com/polo-blue/sds" rel="noopener" title="Github Page" class="hover:text-accent-lightest">
98
98
  <Icon name="mdi:github"/>
99
99
  </a>
100
100
  </div>
@@ -1,23 +0,0 @@
1
- <script setup lang="ts">
2
- const props = defineProps({
3
- text: {
4
- type: String,
5
- default: null,
6
- required: true,
7
- },
8
- active: {
9
- type: Boolean,
10
- default: false,
11
- required: true,
12
- },
13
- })
14
- </script>
15
-
16
- <template>
17
- <a
18
- class="category-link"
19
- :class="!props.active ? '' : 'active'"
20
- >
21
- {{ props.text }}
22
- </a>
23
- </template>
@@ -1,18 +0,0 @@
1
- ---
2
- const { categories } = Astro.props;
3
- ---
4
-
5
- <div class="text-light-blue-400 uppercase text-base z-3 relative w-full">
6
- {
7
- categories
8
- ? categories.map((category) => (
9
- <a
10
- class="term-link text-sm sm:text-base not-first:(before:content-empty) before:(w-px h-2.5 bg-gray-300 mx-2.5 inline-block relative)"
11
- href={category.uri}
12
- >
13
- {category.name}
14
- </a>
15
- ))
16
- : null
17
- }
18
- </div>