Add pill component
This commit is contained in:
20
lib/component/pill/DangerPill.tsx
Normal file
20
lib/component/pill/DangerPill.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { PillProps } from "$/types/PillTypes";
|
||||
import clsx from "clsx";
|
||||
import Pill from "./Pill";
|
||||
|
||||
|
||||
export default function DangerPill({
|
||||
className,
|
||||
...props
|
||||
}: Readonly<PillProps>){
|
||||
return (
|
||||
<Pill
|
||||
data-testid="mattrixwv-danger-pill"
|
||||
className={clsx(
|
||||
className,
|
||||
"bg-danger text-white"
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
20
lib/component/pill/DarkPill.tsx
Normal file
20
lib/component/pill/DarkPill.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { PillProps } from "$/types/PillTypes";
|
||||
import clsx from "clsx";
|
||||
import Pill from "./Pill";
|
||||
|
||||
|
||||
export default function DarkPill({
|
||||
className,
|
||||
...props
|
||||
}: Readonly<PillProps>){
|
||||
return (
|
||||
<Pill
|
||||
data-testid="mattrixwv-dark-pill"
|
||||
className={clsx(
|
||||
className,
|
||||
"bg-dark text-white"
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
20
lib/component/pill/InfoPill.tsx
Normal file
20
lib/component/pill/InfoPill.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { PillProps } from "$/types/PillTypes";
|
||||
import clsx from "clsx";
|
||||
import Pill from "./Pill";
|
||||
|
||||
|
||||
export default function InfoPill({
|
||||
className,
|
||||
...props
|
||||
}: Readonly<PillProps>){
|
||||
return (
|
||||
<Pill
|
||||
data-testid="mattrixwv-info-pill"
|
||||
className={clsx(
|
||||
className,
|
||||
"bg-info text-black"
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
20
lib/component/pill/LightPill.tsx
Normal file
20
lib/component/pill/LightPill.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { PillProps } from "$/types/PillTypes";
|
||||
import clsx from "clsx";
|
||||
import Pill from "./Pill";
|
||||
|
||||
|
||||
export default function LightPill({
|
||||
className,
|
||||
...props
|
||||
}: Readonly<PillProps>){
|
||||
return (
|
||||
<Pill
|
||||
data-testid="mattrixwv-light-pill"
|
||||
className={clsx(
|
||||
className,
|
||||
"bg-light text-black"
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
20
lib/component/pill/MoltenPill.tsx
Normal file
20
lib/component/pill/MoltenPill.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { PillProps } from "$/types/PillTypes";
|
||||
import clsx from "clsx";
|
||||
import Pill from "./Pill";
|
||||
|
||||
|
||||
export default function MoltenPill({
|
||||
className,
|
||||
...props
|
||||
}: Readonly<PillProps>){
|
||||
return (
|
||||
<Pill
|
||||
data-testid="mattrixwv-molten-pill"
|
||||
className={clsx(
|
||||
className,
|
||||
"bg-molten text-black"
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
26
lib/component/pill/Pill.tsx
Normal file
26
lib/component/pill/Pill.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { PillProps } from "$/types/PillTypes";
|
||||
import clsx from "clsx";
|
||||
|
||||
|
||||
export default function Pill({
|
||||
className,
|
||||
rounding = "full",
|
||||
...props
|
||||
}: Readonly<PillProps>){
|
||||
return (
|
||||
<div
|
||||
data-testid="mattrixwv-pill"
|
||||
className={clsx(
|
||||
className,
|
||||
"px-2 text-sm whitespace-nowrap",
|
||||
{
|
||||
"rounded-sm": rounding === "sm",
|
||||
"rounded": rounding === "md",
|
||||
"rounded-lg": rounding === "lg",
|
||||
"rounded-full": rounding === "full"
|
||||
}
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
20
lib/component/pill/PrimaryPill.tsx
Normal file
20
lib/component/pill/PrimaryPill.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { PillProps } from "$/types/PillTypes";
|
||||
import clsx from "clsx";
|
||||
import Pill from "./Pill";
|
||||
|
||||
|
||||
export default function PrimaryPill({
|
||||
className,
|
||||
...props
|
||||
}: Readonly<PillProps>){
|
||||
return (
|
||||
<Pill
|
||||
data-testid="mattrixwv-primary-pill"
|
||||
className={clsx(
|
||||
className,
|
||||
"bg-primary text-white"
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
20
lib/component/pill/SecondaryPill.tsx
Normal file
20
lib/component/pill/SecondaryPill.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { PillProps } from "$/types/PillTypes";
|
||||
import clsx from "clsx";
|
||||
import Pill from "./Pill";
|
||||
|
||||
|
||||
export default function SecondaryPill({
|
||||
className,
|
||||
...props
|
||||
}: Readonly<PillProps>){
|
||||
return (
|
||||
<Pill
|
||||
data-testid="mattrixwv-secondary-pill"
|
||||
className={clsx(
|
||||
className,
|
||||
"bg-secondary text-white"
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
20
lib/component/pill/SuccessPill.tsx
Normal file
20
lib/component/pill/SuccessPill.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { PillProps } from "$/types/PillTypes";
|
||||
import clsx from "clsx";
|
||||
import Pill from "./Pill";
|
||||
|
||||
|
||||
export default function SuccessPill({
|
||||
className,
|
||||
...props
|
||||
}: Readonly<PillProps>){
|
||||
return (
|
||||
<Pill
|
||||
data-testid="mattrixwv-success-pill"
|
||||
className={clsx(
|
||||
className,
|
||||
"bg-success text-black"
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
20
lib/component/pill/TertiaryPill.tsx
Normal file
20
lib/component/pill/TertiaryPill.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { PillProps } from "$/types/PillTypes";
|
||||
import clsx from "clsx";
|
||||
import Pill from "./Pill";
|
||||
|
||||
|
||||
export default function TertiaryPill({
|
||||
className,
|
||||
...props
|
||||
}: Readonly<PillProps>){
|
||||
return (
|
||||
<Pill
|
||||
data-testid="mattrixwv-tertiary-pill"
|
||||
className={clsx(
|
||||
className,
|
||||
"bg-tertiary text-white"
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
20
lib/component/pill/WarningPill.tsx
Normal file
20
lib/component/pill/WarningPill.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { PillProps } from "$/types/PillTypes";
|
||||
import clsx from "clsx";
|
||||
import Pill from "./Pill";
|
||||
|
||||
|
||||
export default function WarningPill({
|
||||
className,
|
||||
...props
|
||||
}: Readonly<PillProps>){
|
||||
return (
|
||||
<Pill
|
||||
data-testid="mattrixwv-warning-pill"
|
||||
className={clsx(
|
||||
className,
|
||||
"bg-warning text-black"
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
9
lib/types/PillTypes.ts
Normal file
9
lib/types/PillTypes.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { ComponentProps } from "react";
|
||||
|
||||
|
||||
export type PillRounding = "none" | "sm" | "md" | "lg" | "full";
|
||||
|
||||
|
||||
export interface PillProps extends ComponentProps<"div"> {
|
||||
rounding?: PillRounding;
|
||||
}
|
||||
Reference in New Issue
Block a user