Skip to content

Commit 7584575

Browse files
committed
chore(new-components): new componens from branding
1 parent 4b7fdaf commit 7584575

File tree

9 files changed

+148
-6
lines changed

9 files changed

+148
-6
lines changed

src/components/button/Button.stories.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,14 @@ Disabled.args = {
3131
label: "Disabled Button",
3232
disabled: true,
3333
};
34+
export const PillButton = Template.bind({});
35+
PillButton.args = {
36+
label: "Learn",
37+
variant:"navigation",
38+
};
39+
40+
export const Rebrand = Template.bind({});
41+
Rebrand.args = {
42+
label: "Clear Filters",
43+
variant:"rebrand",
44+
};

src/components/button/Button.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import React from "react";
44
export interface ButtonProps {
55
label: string;
66
onClick?: () => void;
7-
variant?: "primary" | "secondary";
7+
variant?: "primary" | "secondary" | "navigation" | "rebrand";
88
size?: "small" | "medium" | "large";
99
disabled?: boolean;
10+
className?:string;
1011
}
1112

1213
export const Button: React.FC<ButtonProps> = ({
@@ -15,11 +16,17 @@ export const Button: React.FC<ButtonProps> = ({
1516
variant = "primary",
1617
size = "medium",
1718
disabled = false,
19+
className:customClass,
1820
}) => {
19-
const baseStyles = "font-bold py-2 px-4 rounded";
21+
const baseStyles = "font-bold";
2022
const variantStyles = {
21-
primary: "bg-blue-500 hover:bg-blue-700 text-white",
22-
secondary: "bg-gray-300 hover:bg-gray-400 text-gray-800",
23+
primary: "bg-blue-500 hover:bg-blue-700 py-2 px-4 text-white",
24+
secondary: "bg-gray-300 hover:bg-gray-400 py-2 px-4 text-gray-800",
25+
navigation: `border-brand-gray-100/60 rounded-lg bg-transparent border py-1 px-2 text-brand-gray-100/60
26+
hover:bg-brand-gray-200/20 active:bg-brand-gray-100/60 active:text-brand-gray-400 active:border-0
27+
`,
28+
rebrand:"bg-brand-orange-100 text-brand-light-100 px-2 py-2.5 rounded-lg font-bold hover:bg-brand-dark-100 w-full",
29+
custom:`${customClass}`
2330
};
2431
const sizeStyles = {
2532
small: "text-sm",
@@ -40,3 +47,4 @@ export const Button: React.FC<ButtonProps> = ({
4047
</button>
4148
);
4249
};
50+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// src/components/Button/Button.stories.tsx
2+
3+
import React from "react";
4+
import { StoryFn, Meta } from "@storybook/react";
5+
import { LeavesProps, Leaf } from "./Leaves";
6+
7+
export default {
8+
title: "Components/Leaves",
9+
component: Leaf,
10+
argTypes: {
11+
variant: {
12+
control: { type: "select", options: [1,2,3] },
13+
},
14+
selected: {
15+
control: "boolean",
16+
},
17+
onClick: { action: "clicked" },
18+
},
19+
} as Meta;
20+
21+
const Template: StoryFn<LeavesProps> = (args) => <Leaf {...args} />;
22+
23+
export const OneLeaf = Template.bind({});
24+
OneLeaf.args = {
25+
leavesCount:1,
26+
};
27+
28+
export const TwoLeaf = Template.bind({});
29+
TwoLeaf.args = {
30+
leavesCount:1,
31+
selected:true
32+
};

src/components/button/Leaves.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// src/components/Button/Leaves.tsx
2+
3+
import LeafIcon from "../../icons/LeafIcon";
4+
import React from "react";
5+
6+
export interface LeavesProps {
7+
onClick?: () => void;
8+
disabled?: boolean;
9+
withBorder?: boolean;
10+
leavesCount: number;
11+
selected?: boolean;
12+
}
13+
14+
export const Leaf: React.FC<LeavesProps> = ({ leavesCount = 1, selected=false }) => {
15+
const baseStyles = `rounded-md border border-brand-green w-max py-1 px-2 flex gap-1 hover:bg-brand-green/30 active:bg-brand-green active:text-white`
16+
const allStyles = `
17+
${baseStyles}
18+
${selected ? "bg-brand-green text-white": " text-brand-green"}
19+
`.trim();
20+
21+
return <div className={allStyles} role="button" tabIndex={0}>
22+
{Array.from({length:leavesCount}).map((_,i)=>
23+
<LeafIcon key={i} />
24+
)}
25+
</div>;
26+
};
27+

src/components/button/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export * from "./Button";
2+
export * from "./Leaves";

src/components/card/BDPCard.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// src/components/card/BDPCard.tsx
2+
3+
import React from "react";
4+
export interface CardProps {
5+
difficulty?: "easy" | "medium" | "hard";
6+
byBDP?: boolean;
7+
onClick: ()=> void;
8+
link:string;
9+
}
10+
11+
export const BDPCard: React.FC<CardProps> = ({
12+
difficulty="easy",
13+
onClick,
14+
link
15+
}) => {
16+
const baseStyles = "min-h";
17+
18+
const className = `
19+
${baseStyles}
20+
`.trim();
21+
22+
return (
23+
<a href={link} className={className} onClick={onClick}>
24+
25+
</a>
26+
);
27+
};

src/components/select/useSelectNavigate.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useEffect, useRef, useState } from "react";
22
import { isInViewport } from "../../utils/navigation";
33

4-
type ChekboxNavigateProps = {
4+
type CheckboxNavigateProps = {
55
checkboxContainer: React.MutableRefObject<HTMLDivElement> | null;
66
searchEl: React.MutableRefObject<HTMLInputElement> | null;
77
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -12,7 +12,7 @@ const useCheckboxNavigate = ({
1212
checkboxContainer,
1313
searchEl,
1414
options,
15-
}: ChekboxNavigateProps) => {
15+
}: CheckboxNavigateProps) => {
1616
const checkboxNavIndex = useRef<number>(null);
1717

1818
const [currentNavigateCheckbox, setcurrentNavigateCheckbox] = useState("");

src/icons/LeafIcon.tsx

Lines changed: 18 additions & 0 deletions
Large diffs are not rendered by default.

tailwind.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,24 @@ module.exports = {
3030
},
3131
otherLight: "var(--other-light-text)",
3232
},
33+
brand:{
34+
light:{
35+
100:"#F6F0E6",
36+
},
37+
orange:{
38+
100:"#EB5234",
39+
},
40+
gray:{
41+
100:"#201E1E",
42+
200:"#F6F0E6",
43+
300:"#A9A49B",
44+
400:"#F6F0E6",
45+
},
46+
green:"#0E9158",
47+
dark:{
48+
100:"#201E1E"
49+
}
50+
}
3351
},
3452
},
3553
},

0 commit comments

Comments
 (0)