Skip to content

Commit 4c30989

Browse files
committed
feat(card): bdp card addition
1 parent c29d589 commit 4c30989

File tree

17 files changed

+205
-29
lines changed

17 files changed

+205
-29
lines changed

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
assets/images

.storybook/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { StorybookConfig } from "@storybook/react-webpack5";
22

33
const config: StorybookConfig = {
4+
staticDirs: ['../src/assets/images'],
45
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
56
addons: [
67
"@storybook/addon-webpack5-compiler-swc",
8.13 KB
Loading

src/assets/images/whitepaper.png

7.23 KB
Loading

src/components/badge/ByBdp.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from "react";
2+
import { Pangolins } from "../../icons";
3+
4+
interface IByBDPBadge {
5+
className?: string;
6+
}
7+
export const ByBDPBadge = () => {
8+
return (
9+
<div className="shadow-by-bdp text-brand-dark-100 border border-[#A9A49B] w-fit flex gap-1 p-1 rounded-md items-center bg-[#F6F0E6]">
10+
<Pangolins />
11+
<span className="font-quicksand font-bold text-[11px] ">By BDP</span>
12+
</div>
13+
);
14+
};

src/components/badge/index.tsx

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

src/components/button/Button.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ Disabled.args = {
3434
export const PillButton = Template.bind({});
3535
PillButton.args = {
3636
label: "Learn",
37-
variant:"navigation",
37+
variant: "navigation",
3838
};
3939

4040
export const Rebrand = Template.bind({});
4141
Rebrand.args = {
4242
label: "Clear Filters",
43-
variant:"rebrand",
43+
variant: "rebrand",
4444
};

src/components/button/Button.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export interface ButtonProps {
77
variant?: "primary" | "secondary" | "navigation" | "rebrand";
88
size?: "small" | "medium" | "large";
99
disabled?: boolean;
10-
className?:string;
10+
className?: string;
1111
}
1212

1313
export const Button: React.FC<ButtonProps> = ({
@@ -16,7 +16,7 @@ export const Button: React.FC<ButtonProps> = ({
1616
variant = "primary",
1717
size = "medium",
1818
disabled = false,
19-
className:customClass,
19+
className: customClass,
2020
}) => {
2121
const baseStyles = "font-bold";
2222
const variantStyles = {
@@ -25,8 +25,9 @@ export const Button: React.FC<ButtonProps> = ({
2525
navigation: `border-brand-gray-100/60 rounded-lg bg-transparent border py-1 px-2 text-brand-gray-100/60
2626
hover:bg-brand-gray-200/20 active:bg-brand-gray-100/60 active:text-brand-gray-400 active:border-0
2727
`,
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}`
28+
rebrand:
29+
"bg-brand-orange-100 text-brand-light-100 px-2 py-2.5 rounded-lg font-bold hover:bg-brand-dark-100 w-full",
30+
custom: `${customClass}`,
3031
};
3132
const sizeStyles = {
3233
small: "text-sm",
@@ -47,4 +48,3 @@ export const Button: React.FC<ButtonProps> = ({
4748
</button>
4849
);
4950
};
50-

src/components/button/Leaves.stories.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default {
99
component: Leaf,
1010
argTypes: {
1111
variant: {
12-
control: { type: "select", options: [1,2,3] },
12+
control: { type: "select", options: [1, 2, 3] },
1313
},
1414
selected: {
1515
control: "boolean",
@@ -22,11 +22,11 @@ const Template: StoryFn<LeavesProps> = (args) => <Leaf {...args} />;
2222

2323
export const OneLeaf = Template.bind({});
2424
OneLeaf.args = {
25-
leavesCount:1,
25+
leavesCount: 1,
2626
};
2727

2828
export const TwoLeaf = Template.bind({});
2929
TwoLeaf.args = {
30-
leavesCount:1,
31-
selected:true
30+
leavesCount: 1,
31+
selected: true,
3232
};

src/components/button/Leaves.tsx

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,45 @@ import LeafIcon from "../../icons/LeafIcon";
44
import React from "react";
55

66
export interface LeavesProps {
7+
leavesCount: number;
78
onClick?: () => void;
89
disabled?: boolean;
910
withBorder?: boolean;
10-
leavesCount: number;
1111
selected?: boolean;
12+
showLeftOvers?: boolean;
1213
}
1314

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 = `
15+
export const Leaf: React.FC<LeavesProps> = ({
16+
leavesCount = 1,
17+
selected = false,
18+
withBorder,
19+
showLeftOvers,
20+
}) => {
21+
const baseStyles = `rounded-md w-max py-1 px-2 flex gap-1 `;
22+
const allStyles = `
1723
${baseStyles}
18-
${selected ? "bg-brand-green text-white": " text-brand-green"}
24+
${selected ? "bg-brand-green text-white" : " text-brand-green"}
25+
${withBorder ? "border border-brand-green" : "border-0"}
26+
${showLeftOvers ? "bg-none! hover:bg-none" : "hover:bg-brand-green/30 active:bg-brand-green active:text-white"}
1927
`.trim();
2028

21-
return <div className={allStyles} role="button" tabIndex={0}>
22-
{Array.from({length:leavesCount}).map((_,i)=>
23-
<LeafIcon key={i} />
24-
)}
25-
</div>;
26-
};
29+
const leaves = showLeftOvers
30+
? Array.from({ length: 3 }).map((_, i) => ({
31+
active: i + 1 <= leavesCount,
32+
}))
33+
: [];
34+
return (
35+
<div className={allStyles} role="button" tabIndex={0}>
36+
{!showLeftOvers &&
37+
Array.from({ length: leavesCount }).map((_, i) => <LeafIcon key={i} />)}
2738

39+
{showLeftOvers &&
40+
leaves.map((leave, i) => (
41+
<LeafIcon
42+
key={i}
43+
className={`${leave.active ? "text-brand-green" : "text-[#A9A49B99]"}`}
44+
/>
45+
))}
46+
</div>
47+
);
48+
};

0 commit comments

Comments
 (0)