@grantbii/design-system 1.0.31 → 1.0.33
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/core/atoms/Badge.js +1 -1
- package/core/atoms/Button.d.ts +12 -0
- package/core/atoms/Button.js +19 -0
- package/core/atoms/LinkButton.js +1 -1
- package/core/atoms/index.d.ts +4 -0
- package/core/atoms/index.js +4 -0
- package/core/foundations/breakpoints.d.ts +1 -0
- package/core/foundations/breakpoints.js +1 -0
- package/core/foundations/index.d.ts +4 -0
- package/core/foundations/index.js +4 -0
- package/core/global/GlobalStyle.js +10 -1
- package/core/integrations/index.d.ts +1 -0
- package/core/integrations/index.js +1 -0
- package/index.d.ts +3 -7
- package/index.js +3 -7
- package/package.json +6 -6
- package/stories/atoms/Badge.stories.d.ts +1 -1
- package/stories/atoms/Badge.stories.js +14 -14
- package/stories/atoms/Button.stories.d.ts +11 -0
- package/stories/atoms/Button.stories.js +30 -0
- package/stories/atoms/LinkButton.stories.d.ts +1 -1
- package/stories/atoms/LinkButton.stories.js +10 -25
- package/tsconfig.tsbuildinfo +1 -1
- /package/core/{foundation → foundations}/colors.d.ts +0 -0
- /package/core/{foundation → foundations}/colors.js +0 -0
package/core/atoms/Badge.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import styled from "styled-components";
|
|
3
|
-
import { Colors, Icons } from "
|
|
3
|
+
import { Colors, Icons } from "../foundations";
|
|
4
4
|
const Badge = ({ icon, text, onClickClose, textWidthPixels, backgroundColor, color, }) => (_jsxs(BaseBadge, { "$backgroundColor": backgroundColor, "$color": color, children: [icon ? icon : _jsx(_Fragment, {}), _jsx(BadgeText, { "$widthPixels": textWidthPixels, children: text }), onClickClose ? (_jsx(Button, { type: "button", onClick: onClickClose, children: _jsx(Icons.XIcon, { size: 12 }) })) : (_jsx(_Fragment, {}))] }));
|
|
5
5
|
export default Badge;
|
|
6
6
|
const BaseBadge = styled.div `
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { JSX, MouseEventHandler } from "react";
|
|
2
|
+
type ButtonProps = {
|
|
3
|
+
text: string;
|
|
4
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
5
|
+
type?: "button" | "submit" | "reset";
|
|
6
|
+
leftIcon?: JSX.Element;
|
|
7
|
+
rightIcon?: JSX.Element;
|
|
8
|
+
backgroundColor?: string;
|
|
9
|
+
color?: string;
|
|
10
|
+
};
|
|
11
|
+
declare const Button: ({ text, onClick, leftIcon, rightIcon, backgroundColor, color, type, }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default Button;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import { Colors } from "../foundations";
|
|
4
|
+
const Button = ({ text, onClick, leftIcon, rightIcon, backgroundColor, color, type = "button", }) => (_jsx("button", { type: type, onClick: onClick, children: _jsxs(BaseButton, { "$backgroundColor": backgroundColor, "$color": color, children: [leftIcon ? leftIcon : _jsx(_Fragment, {}), _jsx("p", { children: text }), rightIcon ? rightIcon : _jsx(_Fragment, {})] }) }));
|
|
5
|
+
export default Button;
|
|
6
|
+
const BaseButton = styled.div `
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
gap: 10px;
|
|
10
|
+
|
|
11
|
+
padding: 10px 16px;
|
|
12
|
+
border-radius: 4px;
|
|
13
|
+
|
|
14
|
+
font-weight: 500;
|
|
15
|
+
font-size: 14px;
|
|
16
|
+
|
|
17
|
+
color: ${({ $color = Colors.typography.whiteHigh }) => $color};
|
|
18
|
+
background-color: ${({ $backgroundColor = Colors.main.grantbiiBlue }) => $backgroundColor};
|
|
19
|
+
`;
|
package/core/atoms/LinkButton.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import Link from "next/link";
|
|
3
3
|
import styled from "styled-components";
|
|
4
|
-
import { Colors } from "
|
|
4
|
+
import { Colors } from "../foundations";
|
|
5
5
|
const LinkButton = ({ text, href, target, leftIcon, rightIcon, backgroundColor, color, }) => (_jsx(Link, { href: href, target: target, children: _jsxs(BaseLinkButton, { "$backgroundColor": backgroundColor, "$color": color, children: [leftIcon ? leftIcon : _jsx(_Fragment, {}), _jsx("p", { children: text }), rightIcon ? rightIcon : _jsx(_Fragment, {})] }) }));
|
|
6
6
|
export default LinkButton;
|
|
7
7
|
const BaseLinkButton = styled.div `
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LAPTOP_WIDTH_PIXELS = 1024;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const LAPTOP_WIDTH_PIXELS = 1024;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { createGlobalStyle } from "styled-components";
|
|
3
3
|
import "../../public/fonts/satoshi/css/satoshi.css";
|
|
4
|
-
import
|
|
4
|
+
import { LAPTOP_WIDTH_PIXELS } from "../foundations/breakpoints";
|
|
5
|
+
import * as Colors from "../foundations/colors";
|
|
5
6
|
const GlobalStyle = createGlobalStyle `
|
|
6
7
|
html,
|
|
7
8
|
body {
|
|
@@ -61,5 +62,13 @@ const GlobalStyle = createGlobalStyle `
|
|
|
61
62
|
-moz-appearance: textfield;
|
|
62
63
|
appearance: textfield;
|
|
63
64
|
}
|
|
65
|
+
|
|
66
|
+
@media (width < ${LAPTOP_WIDTH_PIXELS}px) {
|
|
67
|
+
font-size: 14px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@media (width >= ${LAPTOP_WIDTH_PIXELS}px) {
|
|
71
|
+
font-size: 16px;
|
|
72
|
+
}
|
|
64
73
|
`;
|
|
65
74
|
export default GlobalStyle;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as StyledComponentsRegistry } from "./StyledComponentsRegistry";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as StyledComponentsRegistry } from "./StyledComponentsRegistry";
|
package/index.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
export *
|
|
2
|
-
export *
|
|
3
|
-
export { default as BrandLogo } from "./core/atoms/BrandLogo";
|
|
4
|
-
export { default as LinkButton } from "./core/atoms/LinkButton";
|
|
5
|
-
export * as Colors from "./core/foundation/colors";
|
|
1
|
+
export * from "./core/atoms";
|
|
2
|
+
export * from "./core/foundations";
|
|
6
3
|
export { default as GlobalStyle } from "./core/global/GlobalStyle";
|
|
7
|
-
export
|
|
8
|
-
export { default as Badge } from "./core/atoms/Badge";
|
|
4
|
+
export * from "./core/integrations";
|
package/index.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
export *
|
|
2
|
-
export *
|
|
3
|
-
export { default as BrandLogo } from "./core/atoms/BrandLogo";
|
|
4
|
-
export { default as LinkButton } from "./core/atoms/LinkButton";
|
|
5
|
-
export * as Colors from "./core/foundation/colors";
|
|
1
|
+
export * from "./core/atoms";
|
|
2
|
+
export * from "./core/foundations";
|
|
6
3
|
export { default as GlobalStyle } from "./core/global/GlobalStyle";
|
|
7
|
-
export
|
|
8
|
-
export { default as Badge } from "./core/atoms/Badge";
|
|
4
|
+
export * from "./core/integrations";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grantbii/design-system",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.33",
|
|
4
4
|
"description": "Grantbii's Design System",
|
|
5
5
|
"homepage": "https://design.grantbii.com",
|
|
6
6
|
"repository": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@chromatic-com/storybook": "^4.0.1",
|
|
30
|
-
"@eslint/
|
|
30
|
+
"@eslint/js": "^9.32.0",
|
|
31
31
|
"@next/eslint-plugin-next": "^15.4.2",
|
|
32
32
|
"@storybook/addon-a11y": "^9.0.17",
|
|
33
33
|
"@storybook/addon-docs": "^9.0.17",
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
"@types/react-dom": "^19",
|
|
40
40
|
"@vitest/browser": "^3.2.4",
|
|
41
41
|
"@vitest/coverage-v8": "^3.2.4",
|
|
42
|
-
"eslint": "^9.
|
|
43
|
-
"eslint-config-next": "15.
|
|
44
|
-
"eslint-plugin-storybook": "^9.0
|
|
42
|
+
"eslint": "^9.32.0",
|
|
43
|
+
"eslint-config-next": "15.4.5",
|
|
44
|
+
"eslint-plugin-storybook": "^9.1.0",
|
|
45
45
|
"husky": "^9.1.7",
|
|
46
46
|
"lint-staged": "^16.1.2",
|
|
47
47
|
"playwright": "^1.54.1",
|
|
48
48
|
"prettier": "^3.6.2",
|
|
49
|
-
"storybook": "^9.0
|
|
49
|
+
"storybook": "^9.1.0",
|
|
50
50
|
"typescript": "^5.8.3",
|
|
51
51
|
"vitest": "^3.2.4"
|
|
52
52
|
},
|
|
@@ -4,7 +4,7 @@ import { Meta } from "@storybook/nextjs-vite";
|
|
|
4
4
|
declare const meta: Meta<typeof Badge>;
|
|
5
5
|
export default meta;
|
|
6
6
|
type Story = StoryObj<typeof meta>;
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const TextOnly: Story;
|
|
8
8
|
export declare const Icon: Story;
|
|
9
9
|
export declare const Closeable: Story;
|
|
10
10
|
export declare const LongText: Story;
|
|
@@ -9,38 +9,38 @@ const meta = {
|
|
|
9
9
|
},
|
|
10
10
|
};
|
|
11
11
|
export default meta;
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
export const
|
|
12
|
+
const defaultText = "Badge";
|
|
13
|
+
const longText = "the quick brown fox jumps over the lazy dog";
|
|
14
|
+
const icon = _jsx(Icons.SmileyXEyesIcon, { size: 20 });
|
|
15
|
+
const onClickClose = () => alert("You have closed the badge.");
|
|
16
|
+
export const TextOnly = {
|
|
17
17
|
args: {
|
|
18
|
-
text:
|
|
18
|
+
text: defaultText,
|
|
19
19
|
},
|
|
20
20
|
};
|
|
21
21
|
export const Icon = {
|
|
22
22
|
args: {
|
|
23
|
-
icon:
|
|
24
|
-
text:
|
|
23
|
+
icon: icon,
|
|
24
|
+
text: defaultText,
|
|
25
25
|
},
|
|
26
26
|
};
|
|
27
27
|
export const Closeable = {
|
|
28
28
|
args: {
|
|
29
|
-
text:
|
|
30
|
-
onClickClose:
|
|
29
|
+
text: defaultText,
|
|
30
|
+
onClickClose: onClickClose,
|
|
31
31
|
},
|
|
32
32
|
};
|
|
33
33
|
export const LongText = {
|
|
34
34
|
args: {
|
|
35
|
-
text:
|
|
35
|
+
text: longText,
|
|
36
36
|
textWidthPixels: 160,
|
|
37
37
|
},
|
|
38
38
|
};
|
|
39
39
|
export const Everything = {
|
|
40
40
|
args: {
|
|
41
|
-
icon:
|
|
42
|
-
text:
|
|
41
|
+
icon: icon,
|
|
42
|
+
text: longText,
|
|
43
43
|
textWidthPixels: 160,
|
|
44
|
-
onClickClose:
|
|
44
|
+
onClickClose: onClickClose,
|
|
45
45
|
},
|
|
46
46
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Button } from "@/.";
|
|
2
|
+
import type { StoryObj } from "@storybook/nextjs-vite";
|
|
3
|
+
import { Meta } from "@storybook/nextjs-vite";
|
|
4
|
+
declare const meta: Meta<typeof Button>;
|
|
5
|
+
export default meta;
|
|
6
|
+
type Story = StoryObj<typeof meta>;
|
|
7
|
+
export declare const TextOnly: Story;
|
|
8
|
+
export declare const LeftIcon: Story;
|
|
9
|
+
export declare const RightIcon: Story;
|
|
10
|
+
export declare const BothIcons: Story;
|
|
11
|
+
export declare const Wide: Story;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Icons } from "@/.";
|
|
3
|
+
const meta = {
|
|
4
|
+
title: "Atoms/Button",
|
|
5
|
+
component: Button,
|
|
6
|
+
tags: ["autodocs"],
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: "centered",
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
const baseArgs = {
|
|
13
|
+
text: "Button",
|
|
14
|
+
onClick: () => alert("You have clicked on the button."),
|
|
15
|
+
};
|
|
16
|
+
export const TextOnly = {
|
|
17
|
+
args: baseArgs,
|
|
18
|
+
};
|
|
19
|
+
export const LeftIcon = {
|
|
20
|
+
args: Object.assign(Object.assign({}, baseArgs), { leftIcon: _jsx(Icons.PlusIcon, { size: 14 }) }),
|
|
21
|
+
};
|
|
22
|
+
export const RightIcon = {
|
|
23
|
+
args: Object.assign(Object.assign({}, baseArgs), { rightIcon: _jsx(Icons.MinusIcon, { size: 14 }) }),
|
|
24
|
+
};
|
|
25
|
+
export const BothIcons = {
|
|
26
|
+
args: Object.assign(Object.assign({}, baseArgs), { leftIcon: _jsx(Icons.SmileyXEyesIcon, { size: 20 }), rightIcon: _jsx(Icons.SmileyMeltingIcon, { size: 20 }) }),
|
|
27
|
+
};
|
|
28
|
+
export const Wide = {
|
|
29
|
+
args: Object.assign({}, baseArgs),
|
|
30
|
+
};
|
|
@@ -4,7 +4,7 @@ import { Meta } from "@storybook/nextjs-vite";
|
|
|
4
4
|
declare const meta: Meta<typeof LinkButton>;
|
|
5
5
|
export default meta;
|
|
6
6
|
type Story = StoryObj<typeof meta>;
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const TextOnly: Story;
|
|
8
8
|
export declare const LeftIcon: Story;
|
|
9
9
|
export declare const RightIcon: Story;
|
|
10
10
|
export declare const BothIcons: Story;
|
|
@@ -9,35 +9,20 @@ const meta = {
|
|
|
9
9
|
},
|
|
10
10
|
};
|
|
11
11
|
export default meta;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
const baseArgs = {
|
|
13
|
+
text: "Link",
|
|
14
|
+
href: "https://grantbii.com",
|
|
15
|
+
target: "_blank",
|
|
16
|
+
};
|
|
17
|
+
export const TextOnly = {
|
|
18
|
+
args: baseArgs,
|
|
18
19
|
};
|
|
19
20
|
export const LeftIcon = {
|
|
20
|
-
args: {
|
|
21
|
-
text: "Link",
|
|
22
|
-
href: "https://grantbii.com",
|
|
23
|
-
target: "_blank",
|
|
24
|
-
leftIcon: _jsx(Icons.PlusIcon, { size: 14 }),
|
|
25
|
-
},
|
|
21
|
+
args: Object.assign(Object.assign({}, baseArgs), { leftIcon: _jsx(Icons.PlusIcon, { size: 14 }) }),
|
|
26
22
|
};
|
|
27
23
|
export const RightIcon = {
|
|
28
|
-
args: {
|
|
29
|
-
text: "Link",
|
|
30
|
-
href: "https://grantbii.com",
|
|
31
|
-
target: "_blank",
|
|
32
|
-
rightIcon: _jsx(Icons.MinusIcon, { size: 14 }),
|
|
33
|
-
},
|
|
24
|
+
args: Object.assign(Object.assign({}, baseArgs), { rightIcon: _jsx(Icons.MinusIcon, { size: 14 }) }),
|
|
34
25
|
};
|
|
35
26
|
export const BothIcons = {
|
|
36
|
-
args: {
|
|
37
|
-
text: "Link",
|
|
38
|
-
href: "https://grantbii.com",
|
|
39
|
-
target: "_blank",
|
|
40
|
-
leftIcon: _jsx(Icons.SmileyXEyesIcon, { size: 20 }),
|
|
41
|
-
rightIcon: _jsx(Icons.SmileyMeltingIcon, { size: 20 }),
|
|
42
|
-
},
|
|
27
|
+
args: Object.assign(Object.assign({}, baseArgs), { leftIcon: _jsx(Icons.SmileyXEyesIcon, { size: 20 }), rightIcon: _jsx(Icons.SmileyMeltingIcon, { size: 20 }) }),
|
|
43
28
|
};
|