@grantbii/design-system 1.0.43 → 1.0.44
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/Button.d.ts +3 -2
- package/core/atoms/Button.js +2 -6
- package/core/atoms/LinkButton.d.ts +1 -0
- package/core/atoms/LinkButton.js +2 -6
- package/core/atoms/shared.d.ts +3 -2
- package/core/atoms/shared.js +5 -3
- package/package.json +1 -1
- package/stories/atoms/Button.stories.d.ts +1 -0
- package/stories/atoms/Button.stories.js +4 -1
- package/stories/atoms/LinkButton.stories.d.ts +1 -0
- package/stories/atoms/LinkButton.stories.js +4 -1
- package/tsconfig.tsbuildinfo +1 -1
package/core/atoms/Button.d.ts
CHANGED
|
@@ -2,13 +2,14 @@ import { ComponentType, MouseEventHandler } from "react";
|
|
|
2
2
|
import { Icons } from "../foundations";
|
|
3
3
|
type ButtonProps = {
|
|
4
4
|
text: string;
|
|
5
|
-
disabled?: boolean;
|
|
6
5
|
onClick: MouseEventHandler<HTMLButtonElement>;
|
|
6
|
+
disabled?: boolean;
|
|
7
7
|
type?: "button" | "submit" | "reset";
|
|
8
8
|
LeftIcon?: ComponentType<Icons.IconProps>;
|
|
9
9
|
RightIcon?: ComponentType<Icons.IconProps>;
|
|
10
|
+
underline?: boolean;
|
|
10
11
|
backgroundColor?: string;
|
|
11
12
|
color?: string;
|
|
12
13
|
};
|
|
13
|
-
declare const Button: ({ text, onClick, disabled, LeftIcon, RightIcon, backgroundColor, color, type, }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare const Button: ({ text, onClick, disabled, LeftIcon, RightIcon, underline, backgroundColor, color, type, }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
export default Button;
|
package/core/atoms/Button.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
const Button = ({ text, onClick, disabled, LeftIcon, RightIcon, backgroundColor, color, type = "button", }) => (_jsx("button", { type: type, onClick: onClick, disabled: disabled, children: _jsxs(BaseButton, { "$backgroundColor": backgroundColor, "$color": color, children: [LeftIcon ? _jsx(LeftIcon, { color: color, size: 20 }) : _jsx(_Fragment, {}), _jsx("p", { children: text }), RightIcon ? _jsx(RightIcon, { color: color, size: 20 }) : _jsx(_Fragment, {})] }) }));
|
|
2
|
+
import { BaseButton } from "./shared";
|
|
3
|
+
const Button = ({ text, onClick, disabled, LeftIcon, RightIcon, underline, backgroundColor, color, type = "button", }) => (_jsx("button", { type: type, onClick: onClick, disabled: disabled, children: _jsxs(BaseButton, { "$underline": underline, "$backgroundColor": backgroundColor, "$color": color, children: [LeftIcon ? _jsx(LeftIcon, { color: color, size: 20 }) : _jsx(_Fragment, {}), _jsx("p", { children: text }), RightIcon ? _jsx(RightIcon, { color: color, size: 20 }) : _jsx(_Fragment, {})] }) }));
|
|
5
4
|
export default Button;
|
|
6
|
-
const BaseButton = styled.div `
|
|
7
|
-
${ButtonStyle}
|
|
8
|
-
`;
|
package/core/atoms/LinkButton.js
CHANGED
|
@@ -11,14 +11,10 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import Link from "next/link";
|
|
14
|
-
import
|
|
15
|
-
import { ButtonStyle } from "./shared";
|
|
14
|
+
import { BaseButton } from "./shared";
|
|
16
15
|
const LinkButton = (_a) => {
|
|
17
16
|
var { href, target, disabled } = _a, contentProps = __rest(_a, ["href", "target", "disabled"]);
|
|
18
17
|
return disabled ? (_jsx(Content, Object.assign({}, contentProps))) : (_jsx(Link, { href: href, target: target, children: _jsx(Content, Object.assign({}, contentProps)) }));
|
|
19
18
|
};
|
|
20
19
|
export default LinkButton;
|
|
21
|
-
const Content = ({ text, LeftIcon, RightIcon, backgroundColor, color, }) => (_jsxs(
|
|
22
|
-
const BaseLinkButton = styled.div `
|
|
23
|
-
${ButtonStyle}
|
|
24
|
-
`;
|
|
20
|
+
const Content = ({ text, LeftIcon, RightIcon, underline, backgroundColor, color, }) => (_jsxs(BaseButton, { "$underline": underline, "$backgroundColor": backgroundColor, "$color": color, children: [LeftIcon ? _jsx(LeftIcon, { color: color, size: 20 }) : _jsx(_Fragment, {}), _jsx("p", { children: text }), RightIcon ? _jsx(RightIcon, { color: color, size: 20 }) : _jsx(_Fragment, {})] }));
|
package/core/atoms/shared.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const BaseButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
2
|
+
$underline?: boolean;
|
|
2
3
|
$backgroundColor?: string;
|
|
3
4
|
$color?: string;
|
|
4
|
-
}
|
|
5
|
+
}>> & string;
|
package/core/atoms/shared.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import styled from "styled-components";
|
|
2
2
|
import { Colors } from "../foundations";
|
|
3
|
-
export const
|
|
3
|
+
export const BaseButton = styled.div `
|
|
4
4
|
display: flex;
|
|
5
5
|
justify-content: center;
|
|
6
6
|
align-items: center;
|
|
@@ -12,6 +12,8 @@ export const ButtonStyle = css `
|
|
|
12
12
|
font-weight: 500;
|
|
13
13
|
font-size: 14px;
|
|
14
14
|
|
|
15
|
+
text-decoration: ${({ $underline = false }) => $underline ? "underline" : "none"};
|
|
16
|
+
|
|
15
17
|
color: ${({ $color = Colors.typography.whiteHigh }) => $color};
|
|
16
|
-
background-color: ${({ $backgroundColor = Colors.main.grantbiiBlue }) => $backgroundColor};
|
|
18
|
+
background-color: ${({ $underline = false, $backgroundColor = Colors.main.grantbiiBlue, }) => ($underline ? "transparent" : $backgroundColor)};
|
|
17
19
|
`;
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Button, Icons } from "@/.";
|
|
1
|
+
import { Button, Colors, Icons } from "@/.";
|
|
2
2
|
const meta = {
|
|
3
3
|
title: "Atoms/Button",
|
|
4
4
|
component: Button,
|
|
@@ -24,3 +24,6 @@ export const RightIcon = {
|
|
|
24
24
|
export const BothIcons = {
|
|
25
25
|
args: Object.assign(Object.assign({}, baseArgs), { LeftIcon: Icons.SmileyXEyesIcon, RightIcon: Icons.SmileyMeltingIcon }),
|
|
26
26
|
};
|
|
27
|
+
export const Underline = {
|
|
28
|
+
args: Object.assign(Object.assign({}, baseArgs), { underline: true, color: Colors.typography.blackMedium }),
|
|
29
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Icons, LinkButton } from "@/.";
|
|
1
|
+
import { Colors, Icons, LinkButton } from "@/.";
|
|
2
2
|
const meta = {
|
|
3
3
|
title: "Atoms/LinkButton",
|
|
4
4
|
component: LinkButton,
|
|
@@ -25,3 +25,6 @@ export const RightIcon = {
|
|
|
25
25
|
export const BothIcons = {
|
|
26
26
|
args: Object.assign(Object.assign({}, baseArgs), { LeftIcon: Icons.SmileyXEyesIcon, RightIcon: Icons.SmileyMeltingIcon }),
|
|
27
27
|
};
|
|
28
|
+
export const Underline = {
|
|
29
|
+
args: Object.assign(Object.assign({}, baseArgs), { underline: true, color: Colors.typography.blackMedium }),
|
|
30
|
+
};
|