spoko-design-system 0.0.7 → 0.0.9

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/README.md CHANGED
@@ -46,6 +46,7 @@ Most of the components from this repository can be seen in my projects:
46
46
  - 🗒 [astrojs/mdx](https://github.com/withastro/astro/tree/main/packages/integrations/mdx/) - markdown support
47
47
  - 📦 [astro-compress](https://github.com/astro-community/AstroCompress) - compression utilities to your Astro project
48
48
  - 🖨 Static-site generation (SSG)
49
+ - 🎡 [Swiper](https://github.com/nolimits4web/swiper) - modern mobile touch slider with hardware accelerated transitions and amazing native behavior
49
50
  - 🌠 [View Transitions API](https://docs.astro.build/en/guides/view-transitions/#full-site-view-transitions-spa-mode) - [View Transition API](https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition) - makes it easy to change the DOM in a single step, while creating an animated transition between the two states. It's available in Chrome 111+ ([more details](https://developer.chrome.com/docs/web-platform/view-transitions?hl=en))
50
51
  - ☁️ Deploy on Netlify
51
52
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spoko-design-system",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "astro dev",
@@ -77,7 +77,8 @@
77
77
  "sass": "^1.70.0",
78
78
  "unocss": "^0.57.7",
79
79
  "vite": "^5.0.12",
80
- "vue": "^3.4.15"
80
+ "vue": "^3.4.15",
81
+ "swiper": "^11.0.5"
81
82
  },
82
83
  "devDependencies": {
83
84
  "@unocss/transformer-variant-group": "^0.58.4",
@@ -0,0 +1,26 @@
1
+ ---
2
+ export const productObject = {
3
+ name: "Combi-instrument MFA+",
4
+ url: "https://google.com",
5
+ number: "6R0920870F",
6
+ photo:
7
+ "https://img.freepik.com/darmowe-wektory/tlo-retro-modeli-geometrycznych_52683-17902.jpg?w=1380&t=st=1706311337",
8
+ };
9
+ ---
10
+
11
+ <swiper-container
12
+ class="max-w-full w-full flex overflow-hidden"
13
+ grid-rows="1"
14
+ mousewheel-force-to-axis="true"
15
+ navigation="true"
16
+ pagination-type="fraction"
17
+ scrollbar="false"
18
+ slides-per-view="auto"
19
+ space-between="0"
20
+ >
21
+ <swiper-slide class="bg-blue-50 p-12 border-1 min-w-full">A</swiper-slide>
22
+ <swiper-slide class="bg-blue-100 p-12 border-1 min-w-full">B</swiper-slide>
23
+ <swiper-slide class="bg-blue-200 p-12 border-1 min-w-full">C</swiper-slide>
24
+ <swiper-slide class="bg-blue-300 p-12 border-1 min-w-full">D</swiper-slide>
25
+ <swiper-slide class="bg-blue-400 p-12 border-1 min-w-full">A</swiper-slide>
26
+ </swiper-container>
@@ -9,12 +9,12 @@
9
9
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
10
10
  <link rel="alternate icon" type="image/x-icon" href="/favicon.ico" />
11
11
 
12
- <link rel="sitemap" href="/sitemap.xml" />
12
+ <link rel="sitemap" href="/sitemap-index.xml" />
13
13
 
14
14
  <!-- Preload Fonts -->
15
- <link rel="preconnect" href="https://fonts.googleapis.com" />
15
+ <!-- <link rel="preconnect" href="https://fonts.googleapis.com" />
16
16
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
17
- <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital@0;1&display=swap" rel="stylesheet" />
17
+ <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital@0;1&display=swap" rel="stylesheet" /> -->
18
18
 
19
19
  <!-- Scrollable a11y code helper -->
20
20
  <script src="/make-scrollable-code-focusable.js" is:inline></script>
@@ -61,8 +61,7 @@ import Search from "astro-pagefind/components/Search";
61
61
 
62
62
  &.search-container {
63
63
  box-sizing: border-box;
64
- @apply h-10;
65
- @apply h-10 border-0 border-gray-800 rounded-3xl;
64
+ @apply h-10 border-0 border-gray-800 rounded-3xl hidden md:block;
66
65
  }
67
66
  .pagefind-ui {
68
67
 
@@ -0,0 +1,48 @@
1
+ ---
2
+ import ProductTile from "../components/ProductTile.astro";
3
+ export const productObject = {
4
+ name: "Combi-instrument MFA+",
5
+ url: "https://google.com",
6
+ number: "6R0920870F",
7
+ photo:
8
+ "https://img.freepik.com/darmowe-wektory/tlo-retro-modeli-geometrycznych_52683-17902.jpg?w=1380&t=st=1706311337",
9
+ };
10
+ ---
11
+
12
+ <div class="bg-white rounded-lg p-4 w-full">
13
+ <swiper-container
14
+ class="flex w-full max-w-full"
15
+ grid-rows="1"
16
+ mousewheel-force-to-axis="true"
17
+ navigation="false"
18
+ scrollbar="false"
19
+ slides-per-view="auto"
20
+ space-between="0"
21
+ >
22
+ <swiper-slide
23
+ class="carousel-product-tile"
24
+ >
25
+ <ProductTile productObject={productObject} />
26
+ </swiper-slide>
27
+ <swiper-slide
28
+ class="carousel-product-tile"
29
+ >
30
+ <ProductTile productObject={productObject} />
31
+ </swiper-slide>
32
+ <swiper-slide
33
+ class="carousel-product-tile"
34
+ >
35
+ <ProductTile productObject={productObject} />
36
+ </swiper-slide>
37
+ <swiper-slide
38
+ class="carousel-product-tile"
39
+ >
40
+ <ProductTile productObject={productObject} />
41
+ </swiper-slide>
42
+ <swiper-slide
43
+ class="carousel-product-tile"
44
+ >
45
+ <ProductTile productObject={productObject} />
46
+ </swiper-slide>
47
+ </swiper-container>
48
+ </div>
@@ -1,6 +1,5 @@
1
1
  ---
2
2
  const { productObject, locale, index } = Astro.props;
3
- import i18next, { t } from "i18next";
4
3
  import Image from "./Image.astro"
5
4
  import ProductNumber from "./ProductNumber.astro"
6
5
 
@@ -9,7 +8,6 @@ import ProductNumber from "./ProductNumber.astro"
9
8
  { productObject &&
10
9
  (
11
10
 
12
- <div class="flex flex-wrap sm:flex-nowrap content-between w-64 md:(w-96 min-w-96) ml-1 lg:ml-1.5 relative bg-white mb-4 underline-on-hover">
13
11
  <!-- product image -->
14
12
  <div class="img--4/3 img--small">
15
13
  { productObject.photo !== null ?
@@ -46,7 +44,5 @@ import ProductNumber from "./ProductNumber.astro"
46
44
  }
47
45
  </div>
48
46
 
49
- </div>
50
-
51
47
  )}
52
48
 
@@ -0,0 +1,42 @@
1
+ import Image from "./Image.astro";
2
+ import ProductNumber from "./ProductNumber.astro";
3
+
4
+ <Fragment>
5
+ {productObject &&
6
+ (
7
+
8
+ <Fragment><div class="flex flex-wrap sm:flex-nowrap content-between w-64 min-w-64 md:(w-96 min-w-96) ml-1 lg:ml-1.5 relative bg-white mb-4 underline-on-hover">
9
+ {/** product image */}
10
+ <div class="img--4/3 img--small">
11
+ {productObject.photo !== null ?
12
+ <Fragment><Image imageObject={{
13
+ src: 'https://img.freepik.com/darmowe-wektory/tlo-retro-modeli-geometrycznych_52683-17902.jpg?w=1380&t=st=1706311337',
14
+ alt: 'Image Alt',
15
+ height: '180',
16
+ width: '240',
17
+ class: 'img--overlay object-cover'
18
+ }} /></Fragment>
19
+ :
20
+ <Fragment><img src="/1x1.png" class="bg-gray-100/70" alt={productObject.name} /></Fragment>}
21
+ </div>
22
+
23
+ {/** product deails */}
24
+ <div class="sm:pl-4 flex flex-col">
25
+ <a class="font-light leading-none mb-2 pr-4 line-clamp-2 h-[2em] before:(content-empty absolute left-0 right-4 h-full top-0)" href={productObject.url} itemprop="url" title={productObject.number}>
26
+ {productObject.name}
27
+ </a>
28
+
29
+ <ProductNumber productNumber={productObject.number} copyDisabled={true} />
30
+
31
+ {index !== null &&
32
+ (<Fragment><meta itemprop="position" content={String(index)} /></Fragment>
33
+ ,
34
+ <Fragment><meta itemprop="name" content={productObject.name} /></Fragment>)}
35
+ </div>
36
+
37
+ </div></Fragment>
38
+
39
+ )}
40
+
41
+
42
+ </Fragment>;
package/src/config.ts CHANGED
@@ -27,6 +27,7 @@ export const SIDEBAR = [
27
27
  { text: "Breadcrumbs", link: "/components/breadcrumbs" },
28
28
  { text: "Buttons", link: "/components/buttons" },
29
29
  { text: "Card", link: "/components/card" },
30
+ { text: "Carousel", link: "/components/carousel" },
30
31
  { text: "Copyright", link: "/components/copyright" },
31
32
  { text: "HandDrive", link: "/components/hand-drive" },
32
33
  { text: "Headline", link: "/components/headline" },
@@ -15,6 +15,13 @@ const { content = {} } = Astro.props;
15
15
  const currentPage = Astro.url.pathname;
16
16
  const canonicalURL = new URL(Astro.url.pathname, Astro.site).toString();
17
17
  ---
18
+ <script>
19
+ // Swiper Element
20
+ import { register } from "swiper/element/bundle";
21
+ document.addEventListener("astro:page-load", () => {
22
+ register();
23
+ });
24
+ </script>
18
25
 
19
26
  <html dir={content.dir ?? 'ltr'} lang={content.lang ?? 'en-us'} class="initial">
20
27
  <head>
@@ -0,0 +1,62 @@
1
+ ---
2
+ title: "Carousel"
3
+ layout: "../../layouts/MainLayout.astro"
4
+ ---
5
+ import Carousel from '../../components/Carousel.astro'
6
+ import ProductCarousel from '../../components/ProductCarousel.astro'
7
+
8
+ # Carousel
9
+
10
+ Carousel - modern carousel based on Swiper Element (Web Component)
11
+
12
+ <div class="component-preview">
13
+ <Carousel />
14
+ </div>
15
+
16
+ ```js
17
+ <swiper-container
18
+ class="max-w-full w-full flex overflow-hidden"
19
+ grid-rows="1"
20
+ mousewheel-force-to-axis="true"
21
+ navigation="true"
22
+ pagination-type="fraction"
23
+ scrollbar="false"
24
+ slides-per-view="auto"
25
+ space-between="0"
26
+ >
27
+ <swiper-slide class="bg-blue-50 p-12 border-1 min-w-full">A</swiper-slide>
28
+ <swiper-slide class="bg-blue-100 p-12 border-1 min-w-full">B</swiper-slide>
29
+ <swiper-slide class="bg-blue-200 p-12 border-1 min-w-full">C</swiper-slide>
30
+ <swiper-slide class="bg-blue-300 p-12 border-1 min-w-full">D</swiper-slide>
31
+ <swiper-slide class="bg-blue-400 p-12 border-1 min-w-full">A</swiper-slide>
32
+ </swiper-container>
33
+ ```
34
+ #
35
+
36
+ Find the code for this page in the `src/pages/components/carousel.mdx` file.
37
+
38
+
39
+ ## Product Carousel
40
+ <div class="component-preview">
41
+ <ProductCarousel />
42
+ </div>
43
+ ```html
44
+ <div class="bg-white rounded-lg p-4 w-full">
45
+ <swiper-container
46
+ class="flex w-full max-w-full"
47
+ grid-rows="1"
48
+ mousewheel-force-to-axis="true"
49
+ navigation="false"
50
+ scrollbar="false"
51
+ slides-per-view="auto"
52
+ space-between="0"
53
+ >
54
+ <swiper-slide
55
+ class="carousel-product-tile"
56
+ >
57
+ <ProductTile productObject={productObject} />
58
+ </swiper-slide>
59
+ ...
60
+ </swiper-container>
61
+ </div>
62
+ ```
@@ -15,15 +15,27 @@ export const productObject = {
15
15
 
16
16
  ProductTile - product link component which can be used for carousels, section with related products, recently added etc.
17
17
 
18
+ It requires a container with a specific width - it's best to set it directly in the carousel's `<swiper-slide>` tag.
19
+ #
20
+
18
21
  <div class="component-preview">
19
22
  <div class="flex flex-wrap bg-white w-full p-4 pb-0">
20
23
 
21
- <ProductTile productObject={productObject} />
22
- <ProductTile productObject={productObject} />
23
- <ProductTile productObject={productObject} />
24
- <ProductTile productObject={productObject} />
25
- <ProductTile productObjec={productObject}t />
26
- <ProductTile productObject={productObject} />
24
+ <div class="flex flex-wrap sm:flex-nowrap content-between w-64 min-w-64 md:(w-96 min-w-96) ml-1 lg:ml-1.5 relative bg-white mb-4 underline-on-hover">
25
+ <ProductTile productObject={productObject} />
26
+ </div>
27
+ <div class="flex flex-wrap sm:flex-nowrap content-between w-64 min-w-64 md:(w-96 min-w-96) ml-1 lg:ml-1.5 relative bg-white mb-4 underline-on-hover">
28
+ <ProductTile productObject={productObject} />
29
+ </div>
30
+ <div class="flex flex-wrap sm:flex-nowrap content-between w-64 min-w-64 md:(w-96 min-w-96) ml-1 lg:ml-1.5 relative bg-white mb-4 underline-on-hover">
31
+ <ProductTile productObject={productObject} />
32
+ </div>
33
+ <div class="flex flex-wrap sm:flex-nowrap content-between w-64 min-w-64 md:(w-96 min-w-96) ml-1 lg:ml-1.5 relative bg-white mb-4 underline-on-hover">
34
+ <ProductTile productObject={productObject} />
35
+ </div>
36
+ <div class="flex flex-wrap sm:flex-nowrap content-between w-64 min-w-64 md:(w-96 min-w-96) ml-1 lg:ml-1.5 relative bg-white mb-4 underline-on-hover">
37
+ <ProductTile productObject={productObject} />
38
+ </div>
27
39
  </div>
28
40
  </div>
29
41
 
@@ -41,6 +41,8 @@ export const tableDataSecondary = [
41
41
 
42
42
  # Table
43
43
 
44
+ Simple table based on JSON data object.
45
+
44
46
  <div class="component-preview">
45
47
  <MainTable data={tableData}></MainTable>
46
48
  </div>
@@ -5,4 +5,6 @@ layout: ../../layouts/MainLayout.astro
5
5
  import MainColors from '../../components/MainColors.vue';
6
6
 
7
7
  <h1>Colors</h1>
8
- <MainColors />
8
+ <p>Base colors.</p>
9
+
10
+ <MainColors class="mt-8" />
@@ -10,7 +10,7 @@ import Button from "../components/Button.vue";
10
10
  const navItems = [
11
11
  {
12
12
  title: "Core",
13
- description: "Base colors, typography, shadows, and more.",
13
+ description: "Base colors, typography, shadows etc.",
14
14
  url: "/core/introduction",
15
15
  icon: "ant-design:cluster-outlined"
16
16
  },
@@ -49,18 +49,19 @@ const navItems = [
49
49
  </Button>
50
50
  </Jumbatron>
51
51
  <nav>
52
- <ul class="flex gap-4 max-w-5xl mx-auto text-left mt-12">
52
+ <ul class="px-4 flex-col flex flex-wrap md:flex-nowrap gap-4 max-w-5xl mx-auto text-left mt-12 md:(px-0 flex-row) ">
53
53
  {
54
54
  navItems.map(({ title, description, url, icon }) => (
55
55
  <a
56
56
  href={url}
57
- class="flex flex-col bg-white rounded-md hover:-translate-y-1 hover:shadow-lg transition-all flex-1 items-center py-10 px-4 text-center"
57
+ title={description}
58
+ class="flex w-full flex-wrap bg-white rounded-md hover:-translate-y-1 hover:shadow-lg transition-all flex-1 items-center py-10 px-4 md:(flex-col w-auto flex-nowrap text-center)"
58
59
  >
59
- <Headline as="h2" textSize="2xl">
60
- <Icon name={icon} aria-hidden="true" class="text-blue-wrc mr-2" />
60
+ <Headline as="h2" textSize="2xl" underline={false}>
61
+ <Icon name={icon} aria-hidden="true" class="text-blue-b mr-2" />
61
62
  {title}
62
63
  </Headline>
63
- <p class="text-slate-500">{description}</p>
64
+ <p class="text-slate-500 w-full">{description}</p>
64
65
  </a>
65
66
  ))
66
67
  }
@@ -34,7 +34,7 @@
34
34
  }
35
35
 
36
36
  .component-preview {
37
- @apply bg-blue-600 bg-opacity-5 px-0 py-4 mx-0 flex items-center sm:(p-8);
37
+ @apply bg-blue-600 bg-opacity-5 px-4 py-4 mx-0 flex items-center overflow-x-auto sm:(p-8);
38
38
  gap: 1rem;
39
39
  border-radius: 0.33rem;
40
40
  border: 1px solid theme("colors.slate.200");
package/uno.config.ts CHANGED
@@ -41,7 +41,7 @@ export default defineConfig({
41
41
  ['img--small', 'w-60 sm:(w-22) xl:(w-30)'],
42
42
  ['img--medium', 'w-60'],
43
43
  ['underline-on-hover', 'relative flex w-full bg-white pb-1 dark:bg-blue-901 after:absolute after:bg-lightBlue-500 after:w-[calc(100%-1rem)] after:left-0 after:h-px after:top-[calc(100%-1px)] after:bottom-1 after:content-empty after:scale-x-0 after:transition-transform-300 after:origin-top-right hover:after:origin-top-left hover:after:scale-x-100'],
44
-
44
+ ['carousel-product-tile', 'flex flex-wrap sm:flex-nowrap content-between w-64 min-w-64 lg:(w-28.57% min-w-28.57%) 2xl:(w-24.09% min-w-24.09%) relative'],
45
45
  ['btn-primary', 'bg-lightBlue-500 border border-transparent font-medium hover:bg-lightBlue-600 inline-flex items-center justify-center shadow text-base text-white'],
46
46
  ['btn-primary-outline', 'border-lightBlue-500 border font-medium inline-flex items-center justify-center shadow text-base text-lightBlue-500 transition-all hover:(bg-lightBlue-500 text-white)'],
47
47
  ['btn-secondary', 'bg-gray-500 border border-transparent font-medium hover:bg-gray-600 inline-flex items-center justify-center shadow text-base text-white'],