-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(design-system-components): Added new items to the design compone…
…nts library Added the Badge design component Added the Toast design component
- Loading branch information
1 parent
93d616a
commit b514777
Showing
61 changed files
with
1,342 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
apps/web/shell/app/(components)/cookie-policy-banner.client.tsx
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
apps/web/shell/app/(components)/cookie-policy-banner.server.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Git LFS file not shown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<!-- .storybook/manager-head.html --> | ||
|
||
<link rel="icon" type="image/png" sizes="16x16" href="../../../assets/favicons/favicon-16x16.png"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,7 @@ | |
background: #a36de9; /* Gecko Browsers */ | ||
color: #fff; /* Gecko Browsers */ | ||
} | ||
|
||
:host { | ||
background: #18181B; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import type { ComponentStory } from "@storybook/react"; | ||
import { Badge } from "./Badge"; | ||
import { BadgeBorderThickness, BadgeVariants } from "./Badge.types"; | ||
|
||
export default { | ||
title: "General/Badge", | ||
component: Badge, | ||
}; | ||
|
||
const Template: ComponentStory<typeof Badge> = args => ( | ||
<Badge {...args}>Updated</Badge> | ||
); | ||
|
||
export const Primary = Template.bind({}); | ||
Primary.args = { variant: BadgeVariants.PRIMARY }; | ||
|
||
export const Secondary = Template.bind({}); | ||
Secondary.args = { variant: BadgeVariants.SECONDARY }; | ||
|
||
export const Tertiary = Template.bind({}); | ||
Tertiary.args = { variant: BadgeVariants.TERTIARY }; | ||
|
||
export const Quaternary = Template.bind({}); | ||
Quaternary.args = { variant: BadgeVariants.QUATERNARY }; | ||
|
||
export const Inverse = Template.bind({}); | ||
Inverse.args = { variant: BadgeVariants.INVERSE }; | ||
|
||
export const Warning = Template.bind({}); | ||
Warning.args = { variant: BadgeVariants.WARNING }; | ||
|
||
export const Error = Template.bind({}); | ||
Error.args = { variant: BadgeVariants.ERROR }; | ||
|
||
export const Info = Template.bind({}); | ||
Info.args = { variant: BadgeVariants.INFO }; | ||
|
||
export const Success = Template.bind({}); | ||
Success.args = { variant: BadgeVariants.SUCCESS }; | ||
|
||
export const Gradient = Template.bind({}); | ||
Gradient.args = { variant: BadgeVariants.GRADIENT }; | ||
|
||
export const NoBorder = Template.bind({}); | ||
NoBorder.args = { | ||
variant: BadgeVariants.SECONDARY, | ||
borderThickness: BadgeBorderThickness.NONE, | ||
}; | ||
|
||
export const ThinBorder = Template.bind({}); | ||
ThinBorder.args = { | ||
variant: BadgeVariants.SECONDARY, | ||
borderThickness: BadgeBorderThickness.THIN, | ||
}; | ||
|
||
export const NormalBorder = Template.bind({}); | ||
NormalBorder.args = { | ||
variant: BadgeVariants.SECONDARY, | ||
borderThickness: BadgeBorderThickness.NORMAL, | ||
}; | ||
|
||
export const ThickBorder = Template.bind({}); | ||
ThickBorder.args = { | ||
variant: BadgeVariants.SECONDARY, | ||
borderThickness: BadgeBorderThickness.THICK, | ||
}; | ||
|
||
export const CustomBorderColor = Template.bind({}); | ||
CustomBorderColor.args = { | ||
variant: BadgeVariants.SECONDARY, | ||
borderThickness: BadgeBorderThickness.NORMAL, | ||
borderColorClassName: "border-slate-300", | ||
}; | ||
|
||
export const OnClickAnimate = Template.bind({}); | ||
OnClickAnimate.args = { variant: BadgeVariants.SECONDARY, onClick: () => {} }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
"use client"; | ||
|
||
import clsx from "clsx"; | ||
import { MouseEventHandler, useRef } from "react"; | ||
import { PropsWithBase } from "../types"; | ||
import { useRipple } from "../utilities"; | ||
import { isFunction } from "@open-system/core-utilities" | ||
import { BadgeVariants, BadgeBorderThickness } from "./Badge.types"; | ||
import "../../styles/components.css"; | ||
|
||
export type BadgeProps = PropsWithBase<{ | ||
/** | ||
* The variant style of the Badge | ||
*/ | ||
variant?: BadgeVariants | string; | ||
|
||
/** | ||
* Event handler for Badge click event | ||
*/ | ||
onClick?: MouseEventHandler; | ||
|
||
/** | ||
* The thickness of the border around the badge | ||
*/ | ||
borderThickness?: BadgeBorderThickness | string; | ||
|
||
/** | ||
* The CSS/Tailwind utility class name to override to color the border | ||
*/ | ||
borderColorClassName?: string; | ||
}>; | ||
|
||
/** | ||
* The base Badge component used by the Open System repository | ||
*/ | ||
export const Badge = ({ | ||
className, | ||
children, | ||
borderColorClassName, | ||
variant = BadgeVariants.SECONDARY, | ||
borderThickness = BadgeBorderThickness.NORMAL, | ||
onClick, | ||
}: BadgeProps) => { | ||
const ref = useRef<HTMLDivElement>(null); | ||
useRipple(ref); | ||
|
||
return ( | ||
<div className={clsx({"group badge": isFunction(onClick)}, | ||
"relative overflow-hidden h-fit w-fit rounded-full")}> | ||
<div | ||
ref={ref} | ||
onClick={onClick} | ||
className={clsx({"badge-inner group-active:scale-95": isFunction(onClick)}, | ||
{"border-[0px]": borderThickness === BadgeBorderThickness.NONE}, | ||
{"border-[1px]": borderThickness === BadgeBorderThickness.THIN}, | ||
{"border-[3px]": borderThickness === BadgeBorderThickness.NORMAL}, | ||
{"border-[4px]": borderThickness === BadgeBorderThickness.THICK}, | ||
"h-fit w-fit rounded-full pt-0.5 pb-1 px-5 overflow-hidden duration-100 transition-all", | ||
{ | ||
"border-primary": variant === BadgeVariants.PRIMARY, | ||
}, | ||
{ | ||
"border-secondary": variant === BadgeVariants.SECONDARY, | ||
}, | ||
{ | ||
"border-tertiary": variant === BadgeVariants.TERTIARY, | ||
}, | ||
{ | ||
"border-secondary": variant === BadgeVariants.QUATERNARY, | ||
}, | ||
{ | ||
"border-inverse": variant === BadgeVariants.INVERSE, | ||
}, | ||
{ | ||
"border-warning": variant === BadgeVariants.WARNING, | ||
}, | ||
{ | ||
"border-error": variant === BadgeVariants.ERROR, | ||
}, | ||
{ | ||
"border-info": variant === BadgeVariants.INFO, | ||
}, | ||
{ | ||
"border-success": variant === BadgeVariants.SUCCESS, | ||
}, | ||
{ | ||
"border-gradient": variant === BadgeVariants.GRADIENT, | ||
}, | ||
borderColorClassName | ||
)}> | ||
{children ? ( | ||
typeof children === "string" ? ( | ||
<label | ||
className={clsx( | ||
"font-label-3 text-md font-bold", | ||
{ | ||
"text-primary": variant === BadgeVariants.PRIMARY, | ||
}, | ||
{ | ||
"text-secondary": variant === BadgeVariants.SECONDARY, | ||
}, | ||
{ | ||
"text-tertiary": variant === BadgeVariants.TERTIARY, | ||
}, | ||
{ | ||
"text-secondary": variant === BadgeVariants.QUATERNARY, | ||
}, | ||
{ | ||
"text-inverse": variant === BadgeVariants.INVERSE, | ||
}, | ||
{ | ||
"text-warning": variant === BadgeVariants.WARNING, | ||
}, | ||
{ | ||
"text-error": variant === BadgeVariants.ERROR, | ||
}, | ||
{ | ||
"text-info": variant === BadgeVariants.INFO, | ||
}, | ||
{ | ||
"text-success": variant === BadgeVariants.SUCCESS, | ||
}, | ||
{ | ||
"text-gradient": variant === BadgeVariants.GRADIENT, | ||
} | ||
)}> | ||
{children} | ||
</label> | ||
) : ( | ||
children | ||
) | ||
) : ( | ||
"" | ||
)} | ||
</div> | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.