@grantbii/design-system 1.0.33 → 1.0.35
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 +3 -14
- package/core/atoms/LinkButton.d.ts +2 -1
- package/core/atoms/LinkButton.js +19 -15
- package/core/atoms/shared.d.ts +4 -0
- package/core/atoms/shared.js +17 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/core/atoms/Button.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { JSX, MouseEventHandler } from "react";
|
|
2
2
|
type ButtonProps = {
|
|
3
3
|
text: string;
|
|
4
|
-
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
onClick: MouseEventHandler<HTMLButtonElement>;
|
|
5
6
|
type?: "button" | "submit" | "reset";
|
|
6
7
|
leftIcon?: JSX.Element;
|
|
7
8
|
rightIcon?: JSX.Element;
|
|
8
9
|
backgroundColor?: string;
|
|
9
10
|
color?: string;
|
|
10
11
|
};
|
|
11
|
-
declare const Button: ({ text, onClick, leftIcon, rightIcon, backgroundColor, color, type, }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare const Button: ({ text, onClick, disabled, leftIcon, rightIcon, backgroundColor, color, type, }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export default Button;
|
package/core/atoms/Button.js
CHANGED
|
@@ -1,19 +1,8 @@
|
|
|
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 {
|
|
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, {})] }) }));
|
|
3
|
+
import { ButtonStyle } from "./shared";
|
|
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 ? leftIcon : _jsx(_Fragment, {}), _jsx("p", { children: text }), rightIcon ? rightIcon : _jsx(_Fragment, {})] }) }));
|
|
5
5
|
export default Button;
|
|
6
6
|
const BaseButton = styled.div `
|
|
7
|
-
|
|
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};
|
|
7
|
+
${ButtonStyle}
|
|
19
8
|
`;
|
|
@@ -2,11 +2,12 @@ import { HTMLAttributeAnchorTarget, JSX } from "react";
|
|
|
2
2
|
type LinkButtonProps = {
|
|
3
3
|
text: string;
|
|
4
4
|
href: string;
|
|
5
|
+
disabled?: boolean;
|
|
5
6
|
target?: HTMLAttributeAnchorTarget;
|
|
6
7
|
leftIcon?: JSX.Element;
|
|
7
8
|
rightIcon?: JSX.Element;
|
|
8
9
|
backgroundColor?: string;
|
|
9
10
|
color?: string;
|
|
10
11
|
};
|
|
11
|
-
declare const LinkButton: ({
|
|
12
|
+
declare const LinkButton: ({ href, target, disabled, ...contentProps }: LinkButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export default LinkButton;
|
package/core/atoms/LinkButton.js
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
13
|
import Link from "next/link";
|
|
3
14
|
import styled from "styled-components";
|
|
4
|
-
import {
|
|
5
|
-
const LinkButton = (
|
|
15
|
+
import { ButtonStyle } from "./shared";
|
|
16
|
+
const LinkButton = (_a) => {
|
|
17
|
+
var { href, target, disabled } = _a, contentProps = __rest(_a, ["href", "target", "disabled"]);
|
|
18
|
+
return disabled ? (_jsx(Content, Object.assign({}, contentProps))) : (_jsx(Link, { href: href, target: target, children: _jsx(Content, Object.assign({}, contentProps)) }));
|
|
19
|
+
};
|
|
6
20
|
export default LinkButton;
|
|
21
|
+
const Content = ({ text, leftIcon, rightIcon, backgroundColor, color, }) => (_jsxs(BaseLinkButton, { "$backgroundColor": backgroundColor, "$color": color, children: [leftIcon ? leftIcon : _jsx(_Fragment, {}), _jsx("p", { children: text }), rightIcon ? rightIcon : _jsx(_Fragment, {})] }));
|
|
7
22
|
const BaseLinkButton = styled.div `
|
|
8
|
-
|
|
9
|
-
align-items: center;
|
|
10
|
-
gap: 10px;
|
|
11
|
-
|
|
12
|
-
padding: 10px 16px;
|
|
13
|
-
border-radius: 4px;
|
|
14
|
-
|
|
15
|
-
font-weight: 500;
|
|
16
|
-
font-size: 14px;
|
|
17
|
-
|
|
18
|
-
color: ${({ $color = Colors.typography.whiteHigh }) => $color};
|
|
19
|
-
background-color: ${({ $backgroundColor = Colors.main.grantbiiBlue }) => $backgroundColor};
|
|
23
|
+
${ButtonStyle}
|
|
20
24
|
`;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { css } from "styled-components";
|
|
2
|
+
import { Colors } from "../foundations";
|
|
3
|
+
export const ButtonStyle = css `
|
|
4
|
+
display: flex;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
align-items: center;
|
|
7
|
+
gap: 10px;
|
|
8
|
+
|
|
9
|
+
padding: 10px 16px;
|
|
10
|
+
border-radius: 4px;
|
|
11
|
+
|
|
12
|
+
font-weight: 500;
|
|
13
|
+
font-size: 14px;
|
|
14
|
+
|
|
15
|
+
color: ${({ $color = Colors.typography.whiteHigh }) => $color};
|
|
16
|
+
background-color: ${({ $backgroundColor = Colors.main.grantbiiBlue }) => $backgroundColor};
|
|
17
|
+
`;
|