@nicolassancho/storybook-core 3.3.0 → 3.4.0
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 +6 -6
- package/dist/components/Atoms/Icon/iconsMap.d.ts +2 -0
- package/dist/components/Atoms/Icon/iconsMap.js +3 -1
- package/dist/components/Organisms/Footer/Footer.d.ts +41 -0
- package/dist/components/Organisms/Footer/Footer.js +24 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,12 +31,12 @@ documented in Storybook. It is published to npm as `@nicolassancho/storybook-cor
|
|
|
31
31
|
|
|
32
32
|
## Components
|
|
33
33
|
|
|
34
|
-
| Layer | Components
|
|
35
|
-
| --------- |
|
|
36
|
-
| Atoms | Button, Icon, Image, Label, RadioButton, SearchInput, Spinner, Text |
|
|
37
|
-
| Molecules | Breadcrumbs, CartIcon, ProductCard, ProductDetails, RadioGroup
|
|
38
|
-
| Organisms | Header, ProductGrid
|
|
39
|
-
| Layouts | Grid
|
|
34
|
+
| Layer | Components |
|
|
35
|
+
| --------- | ------------------------------------------------------------------------- |
|
|
36
|
+
| Atoms | Button, Chip, Icon, Image, Label, RadioButton, SearchInput, Spinner, Text |
|
|
37
|
+
| Molecules | Breadcrumbs, CartIcon, ProductCard, ProductDetails, RadioGroup |
|
|
38
|
+
| Organisms | Footer, Header, ProductGrid |
|
|
39
|
+
| Layouts | Grid |
|
|
40
40
|
|
|
41
41
|
The palette and the contrast of each text color are documented under **Foundations / Colors** in
|
|
42
42
|
Storybook.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Home, ShoppingCart, ArrowDown, ArrowLeft, AlertOctagon, AlertTriangle,
|
|
1
|
+
import { Home, ShoppingCart, ArrowDown, ArrowLeft, AlertOctagon, AlertTriangle, Sun, Moon,
|
|
2
2
|
// Import other icons as needed
|
|
3
3
|
} from "react-feather";
|
|
4
4
|
export const IconsMap = {
|
|
@@ -8,5 +8,7 @@ export const IconsMap = {
|
|
|
8
8
|
ArrowLeft,
|
|
9
9
|
AlertOctagon,
|
|
10
10
|
AlertTriangle,
|
|
11
|
+
Sun,
|
|
12
|
+
Moon,
|
|
11
13
|
// Add other icons here
|
|
12
14
|
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface FooterColumn {
|
|
3
|
+
/** Column heading, rendered as an `<h2>`. */
|
|
4
|
+
title: string;
|
|
5
|
+
links: {
|
|
6
|
+
label: string;
|
|
7
|
+
href: string;
|
|
8
|
+
}[];
|
|
9
|
+
}
|
|
10
|
+
export interface FooterProps {
|
|
11
|
+
/**
|
|
12
|
+
* Groups of links. They all sit inside one `<nav>` landmark (see `navLabel`), each under its
|
|
13
|
+
* own heading. Without columns no navigation is rendered.
|
|
14
|
+
*/
|
|
15
|
+
columns?: FooterColumn[];
|
|
16
|
+
/** Brand block shown before the columns, such as a logo and a short description. */
|
|
17
|
+
brand?: React.ReactNode;
|
|
18
|
+
/** Legal line shown under a divider, such as the copyright. */
|
|
19
|
+
legal?: React.ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Component used to render each link. Receives `href`, `className` and `children`, so a
|
|
22
|
+
* framework link (e.g. `next/link`) can be passed directly. Defaults to a plain `<a>`.
|
|
23
|
+
* Define it outside the render function: an inline definition remounts the links.
|
|
24
|
+
*/
|
|
25
|
+
LinkComponent?: React.ElementType<{
|
|
26
|
+
href: string;
|
|
27
|
+
children: React.ReactNode;
|
|
28
|
+
className?: string;
|
|
29
|
+
}>;
|
|
30
|
+
/**
|
|
31
|
+
* Accessible name of the navigation landmark. Change it when the page has another navigation
|
|
32
|
+
* with the same name, or to translate it.
|
|
33
|
+
*/
|
|
34
|
+
navLabel?: string;
|
|
35
|
+
className?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Page footer: a `contentinfo` landmark with an optional brand block, link columns and a legal
|
|
39
|
+
* line. It holds no state, so it renders from a Server Component.
|
|
40
|
+
*/
|
|
41
|
+
export declare const Footer: React.FC<FooterProps>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { tv } from "tailwind-variants";
|
|
3
|
+
import { Text } from "../../Atoms/Text/Text";
|
|
4
|
+
const footerStyles = tv({
|
|
5
|
+
base: "w-full border-t border-neutral-200 bg-surface",
|
|
6
|
+
slots: {
|
|
7
|
+
inner: "flex flex-col gap-8 px-4 py-10",
|
|
8
|
+
top: "flex flex-col gap-8 md:flex-row md:justify-between",
|
|
9
|
+
brand: "md:max-w-xs",
|
|
10
|
+
columns: "flex flex-wrap gap-x-12 gap-y-8",
|
|
11
|
+
list: "mt-3 flex flex-col gap-2",
|
|
12
|
+
link: "rounded-sm text-sm text-neutral-600 underline-offset-4 hover:text-neutral-900 hover:underline focus:outline-hidden focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-surface",
|
|
13
|
+
legal: "border-t border-neutral-200 pt-6 text-sm text-neutral-600",
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* Page footer: a `contentinfo` landmark with an optional brand block, link columns and a legal
|
|
18
|
+
* line. It holds no state, so it renders from a Server Component.
|
|
19
|
+
*/
|
|
20
|
+
export const Footer = ({ columns = [], brand, legal, LinkComponent = "a", navLabel = "Footer", className, }) => {
|
|
21
|
+
const styles = footerStyles();
|
|
22
|
+
const hasColumns = columns.length > 0;
|
|
23
|
+
return (_jsx("footer", { className: styles.base({ className }), children: _jsxs("div", { className: styles.inner(), children: [(brand || hasColumns) && (_jsxs("div", { className: styles.top(), children: [brand && _jsx("div", { className: styles.brand(), children: brand }), hasColumns && (_jsx("nav", { "aria-label": navLabel, className: styles.columns(), children: columns.map(({ title, links }) => (_jsxs("div", { children: [_jsx(Text, { as: "h2", size: "small", weight: "semibold", color: "darker", children: title }), _jsx("ul", { className: styles.list(), children: links.map(({ label, href }) => (_jsx("li", { children: _jsx(LinkComponent, { href: href, className: styles.link(), children: label }) }, `${label}-${href}`))) })] }, title))) }))] })), legal && _jsx("div", { className: styles.legal(), children: legal })] }) }));
|
|
24
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -13,5 +13,6 @@ export * from "./components/Molecules/CartIcon/CartIcon";
|
|
|
13
13
|
export * from "./components/Molecules/ProductCard/ProductCard";
|
|
14
14
|
export * from "./components/Molecules/ProductDetails/ProductDetails";
|
|
15
15
|
export * from "./components/Molecules/RadioGroup/RadioGroup";
|
|
16
|
+
export * from "./components/Organisms/Footer/Footer";
|
|
16
17
|
export * from "./components/Organisms/Header/Header";
|
|
17
18
|
export * from "./components/Organisms/ProductGrid/ProductGrid";
|
package/dist/index.js
CHANGED
|
@@ -17,5 +17,6 @@ export * from "./components/Molecules/ProductCard/ProductCard";
|
|
|
17
17
|
export * from "./components/Molecules/ProductDetails/ProductDetails";
|
|
18
18
|
export * from "./components/Molecules/RadioGroup/RadioGroup";
|
|
19
19
|
// Organisms
|
|
20
|
+
export * from "./components/Organisms/Footer/Footer";
|
|
20
21
|
export * from "./components/Organisms/Header/Header";
|
|
21
22
|
export * from "./components/Organisms/ProductGrid/ProductGrid";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nicolassancho/storybook-core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "Accessible React + Tailwind component library built with tailwind-variants and documented in Storybook.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|