@grantbii/design-system 1.0.27 → 1.0.29

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.
@@ -3,8 +3,9 @@ type BadgeProps = {
3
3
  text: string;
4
4
  icon?: JSX.Element;
5
5
  onClickClose?: MouseEventHandler<HTMLButtonElement>;
6
+ textWidthPixels?: number;
6
7
  backgroundColor?: string;
7
8
  color?: string;
8
9
  };
9
- declare const Badge: ({ icon, text, onClickClose, backgroundColor, color, }: BadgeProps) => import("react/jsx-runtime").JSX.Element;
10
+ declare const Badge: ({ icon, text, onClickClose, textWidthPixels, backgroundColor, color, }: BadgeProps) => import("react/jsx-runtime").JSX.Element;
10
11
  export default Badge;
@@ -0,0 +1,28 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import styled from "styled-components";
3
+ import { Colors, Icons } from "../../index";
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
+ export default Badge;
6
+ const BaseBadge = styled.div `
7
+ display: flex;
8
+ align-items: center;
9
+ gap: 10px;
10
+
11
+ padding: 5px 16px;
12
+ border-radius: 130px;
13
+
14
+ color: ${({ $color = Colors.typography.blackHigh }) => $color};
15
+ background-color: ${({ $backgroundColor = Colors.neutral.grey3 }) => $backgroundColor};
16
+ `;
17
+ const BadgeText = styled.p `
18
+ width: ${({ $widthPixels }) => ($widthPixels ? `${$widthPixels}px` : "auto")};
19
+ overflow-x: hidden;
20
+ white-space: nowrap;
21
+ text-overflow: ellipsis;
22
+
23
+ font-weight: 500;
24
+ font-size: 14px;
25
+ `;
26
+ const Button = styled.button `
27
+ display: flex;
28
+ `;
@@ -0,0 +1,12 @@
1
+ import { HTMLAttributeAnchorTarget, JSX } from "react";
2
+ type LinkButtonProps = {
3
+ text: string;
4
+ href: string;
5
+ target?: HTMLAttributeAnchorTarget;
6
+ leftIcon?: JSX.Element;
7
+ rightIcon?: JSX.Element;
8
+ backgroundColor?: string;
9
+ color?: string;
10
+ };
11
+ declare const LinkButton: ({ text, href, target, leftIcon, rightIcon, backgroundColor, color, }: LinkButtonProps) => import("react/jsx-runtime").JSX.Element;
12
+ export default LinkButton;
@@ -0,0 +1,19 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Colors } from "@/.";
3
+ import Link from "next/link";
4
+ import styled from "styled-components";
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
+ export default LinkButton;
7
+ const BaseLinkButton = styled.div `
8
+ display: flex;
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
+ `;
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { createGlobalStyle } from "styled-components";
3
3
  import "../../public/fonts/satoshi/css/satoshi.css";
4
- import * as Colors from "../atoms/colors";
4
+ import * as Colors from "../foundation/colors";
5
5
  const GlobalStyle = createGlobalStyle `
6
6
  html,
7
7
  body {
package/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  export * as Icons from "@phosphor-icons/react";
2
2
  export * as Flags from "country-flag-icons/react/3x2";
3
3
  export { default as BrandLogo } from "./core/atoms/BrandLogo";
4
- export * as Colors from "./core/atoms/colors";
4
+ export { default as LinkButton } from "./core/atoms/LinkButton";
5
+ export * as Colors from "./core/foundation/colors";
5
6
  export { default as GlobalStyle } from "./core/global/GlobalStyle";
6
7
  export { default as StyledComponentsRegistry } from "./core/integrations/StyledComponentsRegistry";
7
- export { default as Badge } from "./core/molecules/Badge";
8
+ export { default as Badge } from "./core/atoms/Badge";
package/index.js CHANGED
@@ -1,7 +1,8 @@
1
1
  export * as Icons from "@phosphor-icons/react";
2
2
  export * as Flags from "country-flag-icons/react/3x2";
3
3
  export { default as BrandLogo } from "./core/atoms/BrandLogo";
4
- export * as Colors from "./core/atoms/colors";
4
+ export { default as LinkButton } from "./core/atoms/LinkButton";
5
+ export * as Colors from "./core/foundation/colors";
5
6
  export { default as GlobalStyle } from "./core/global/GlobalStyle";
6
7
  export { default as StyledComponentsRegistry } from "./core/integrations/StyledComponentsRegistry";
7
- export { default as Badge } from "./core/molecules/Badge";
8
+ export { default as Badge } from "./core/atoms/Badge";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grantbii/design-system",
3
- "version": "1.0.27",
3
+ "version": "1.0.29",
4
4
  "description": "Grantbii's Design System",
5
5
  "homepage": "https://design.grantbii.com",
6
6
  "repository": {
@@ -7,4 +7,5 @@ type Story = StoryObj<typeof meta>;
7
7
  export declare const Default: Story;
8
8
  export declare const Icon: Story;
9
9
  export declare const Close: Story;
10
+ export declare const Long: Story;
10
11
  export declare const Everything: Story;
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Badge, Icons } from "@/.";
3
+ const meta = {
4
+ title: "Atoms/Badge",
5
+ component: Badge,
6
+ tags: ["autodocs"],
7
+ parameters: {
8
+ layout: "centered",
9
+ },
10
+ };
11
+ export default meta;
12
+ const DEFAULT_TEXT = "Badge";
13
+ const LONG_TEXT = "the quick brown fox jumps over the lazy dog";
14
+ const ICON = _jsx(Icons.SmileyXEyesIcon, { size: 20 });
15
+ const ON_CLICK_CLOSE = () => alert("You have closed the badge!");
16
+ export const Default = {
17
+ args: {
18
+ text: DEFAULT_TEXT,
19
+ },
20
+ };
21
+ export const Icon = {
22
+ args: {
23
+ icon: ICON,
24
+ text: DEFAULT_TEXT,
25
+ },
26
+ };
27
+ export const Close = {
28
+ args: {
29
+ text: DEFAULT_TEXT,
30
+ onClickClose: ON_CLICK_CLOSE,
31
+ },
32
+ };
33
+ export const Long = {
34
+ args: {
35
+ text: LONG_TEXT,
36
+ textWidthPixels: 160,
37
+ },
38
+ };
39
+ export const Everything = {
40
+ args: {
41
+ icon: ICON,
42
+ text: LONG_TEXT,
43
+ textWidthPixels: 160,
44
+ onClickClose: ON_CLICK_CLOSE,
45
+ },
46
+ };
@@ -1,6 +1,6 @@
1
1
  import { BrandLogo } from "@/.";
2
2
  const meta = {
3
- title: "Design System/Atoms/Brand Logo",
3
+ title: "Atoms/Brand Logo",
4
4
  component: BrandLogo,
5
5
  tags: ["autodocs"],
6
6
  parameters: {
@@ -0,0 +1,8 @@
1
+ import { LinkButton } from "@/.";
2
+ import type { StoryObj } from "@storybook/nextjs-vite";
3
+ import { Meta } from "@storybook/nextjs-vite";
4
+ declare const meta: Meta<typeof LinkButton>;
5
+ export default meta;
6
+ type Story = StoryObj<typeof meta>;
7
+ export declare const Default: Story;
8
+ export declare const Icon: Story;
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Icons, LinkButton } from "@/.";
3
+ const meta = {
4
+ title: "Atoms/LinkButton",
5
+ component: LinkButton,
6
+ tags: ["autodocs"],
7
+ parameters: {
8
+ layout: "centered",
9
+ },
10
+ };
11
+ export default meta;
12
+ export const Default = {
13
+ args: {
14
+ text: "Link",
15
+ href: "https://grantbii.com",
16
+ target: "_blank",
17
+ },
18
+ };
19
+ export const Icon = {
20
+ args: {
21
+ text: "Link",
22
+ href: "https://grantbii.com",
23
+ target: "_blank",
24
+ leftIcon: _jsx(Icons.SmileyXEyesIcon, { size: 20 }),
25
+ rightIcon: _jsx(Icons.SmileyMeltingIcon, { size: 20 }),
26
+ },
27
+ };