Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit e398f7c

Browse files
authored
feat: some changes for retrofunding app (#120)
* chore: added briefcase, collection and home icons * chore: added retrofunding logos and export gitcoin-ui/logos * chore: moved colors to /theme and export gitcoin-ui/theme * chore: implemented CreateButton * chore: implemented Typography component * chore: refactored SideNavItem to have items as optional * chore: refactored Navbar to have text as optional
1 parent 9b95216 commit e398f7c

23 files changed

+189
-18
lines changed

package.json

+10
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@
4343
"import": "./dist/icons.js",
4444
"require": "./dist/icons.js"
4545
},
46+
"./logos": {
47+
"types": "./dist/logos.d.ts",
48+
"import": "./dist/logos.js",
49+
"require": "./dist/logos.js"
50+
},
4651
"./lib": {
4752
"types": "./dist/lib.d.ts",
4853
"import": "./dist/lib.js",
@@ -58,6 +63,11 @@
5863
"import": "./dist/types.js",
5964
"require": "./dist/types.js"
6065
},
66+
"./theme": {
67+
"types": "./dist/theme.d.ts",
68+
"import": "./dist/theme.js",
69+
"require": "./dist/theme.js"
70+
},
6171
"./application": {
6272
"types": "./dist/application.d.ts",
6373
"import": "./dist/application.js",

src/assets/icons/heroicons.ts

+19-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Status Icons
22
import { InformationCircleIcon } from "@heroicons/react/outline";
33
import {
4+
BriefcaseIcon,
45
CalendarIcon,
56
CashIcon,
67
CheckCircleIcon as CheckSolidIcon,
@@ -9,9 +10,11 @@ import {
910
ChevronRightIcon,
1011
ClipboardListIcon,
1112
ClockIcon,
13+
CollectionIcon,
1214
DocumentDuplicateIcon,
1315
ExclamationCircleIcon,
1416
GlobeAltIcon as GlobeIcon,
17+
HomeIcon,
1518
LinkIcon,
1619
PencilIcon,
1720
QuestionMarkCircleIcon as SolidQuestionMarkCircleIcon,
@@ -25,19 +28,22 @@ import {
2528
} from "@heroicons/react/solid";
2629

2730
enum HeroiconsType {
31+
BRIEFCASE = "briefcase",
2832
CALENDAR = "calendar",
2933
CASH = "cash",
3034
CHECK = "check",
3135
CHEVRON_LEFT = "chevron-left",
3236
CLIPBOARD_LIST = "clipboardList",
3337
CLOCK = "clock",
38+
COLLECTION = "collection",
3439
DOCUMENT_DUPLICATE = "document-duplicate",
35-
PENCIL = "pencil",
3640
EXCLAMATION_CIRCLE = "exclamation-circle",
37-
LINK = "link",
38-
PLUS = "plus",
3941
GLOBE = "globe",
42+
HOME = "home",
4043
INFORMATION_CIRCLE = "informationCircle",
44+
LINK = "link",
45+
PENCIL = "pencil",
46+
PLUS = "plus",
4147
SOLID_CHECK = "solid-check",
4248
SOLID_QUESTION_MARK_CIRCLE = "questionMarkCircle",
4349
SOLID_X = "solid-x",
@@ -49,18 +55,21 @@ enum HeroiconsType {
4955
}
5056

5157
const heroiconsComponents: Record<HeroiconsType, React.FC<React.SVGProps<SVGSVGElement>>> = {
58+
briefcase: BriefcaseIcon,
5259
calendar: CalendarIcon,
5360
cash: CashIcon,
5461
check: CheckIcon,
5562
"chevron-left": ChevronLeftIcon,
5663
clipboardList: ClipboardListIcon,
5764
clock: ClockIcon,
65+
collection: CollectionIcon,
5866
"document-duplicate": DocumentDuplicateIcon,
59-
pencil: PencilIcon,
6067
"exclamation-circle": ExclamationCircleIcon,
61-
informationCircle: InformationCircleIcon,
6268
globe: GlobeIcon,
69+
informationCircle: InformationCircleIcon,
70+
home: HomeIcon,
6371
link: LinkIcon,
72+
pencil: PencilIcon,
6473
plus: PlusIcon,
6574
questionMarkCircle: SolidQuestionMarkCircleIcon,
6675
"solid-check": CheckSolidIcon,
@@ -77,18 +86,22 @@ const heroIcons = Object.keys(heroiconsComponents).sort((a, b) =>
7786
) as HeroiconsType[];
7887

7988
export {
89+
BriefcaseIcon,
8090
CalendarIcon,
8191
CheckSolidIcon,
8292
CheckIcon,
8393
ChevronLeftIcon,
8494
ChevronRightIcon,
8595
ClipboardListIcon,
8696
ClockIcon,
97+
CollectionIcon,
8798
DocumentDuplicateIcon,
8899
ExclamationCircleIcon,
89-
InformationCircleIcon,
90100
GlobeIcon,
101+
HomeIcon,
102+
InformationCircleIcon,
91103
LinkIcon,
104+
PencilIcon,
92105
PlusIcon,
93106
SolidQuestionMarkCircleIcon,
94107
SparklesIcon,

src/assets/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export * from "./icons";
22
export * from "./images";
3+
export * from "./logos";

src/assets/logos/index.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export * from "./builder";
2+
export * from "./explorer";
3+
export * from "./gitcoin";
4+
export * from "./grantsStack";
5+
export * from "./manager";
6+
export * from "./retrofunding";
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1+
import RetrofundingLogoLockup from "./retrofundingLockup.svg?react";
12
import RetrofundingLogoWordmark from "./retrofundingWordmark.svg?react";
23
import RetrofundingVoteLogoWordmark from "./voteWordmark.svg?react";
34

4-
export { RetrofundingLogoWordmark, RetrofundingVoteLogoWordmark };
5+
export { RetrofundingLogoLockup, RetrofundingLogoWordmark, RetrofundingVoteLogoWordmark };
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { action } from "@storybook/addon-actions";
2+
import { Meta, StoryObj } from "@storybook/react";
3+
4+
import { CreateButton } from "./CreateButton";
5+
6+
const onButtonClick = action("Button clicked!");
7+
8+
const meta: Meta<typeof CreateButton> = {
9+
title: "Features/RetroFunding/Components/CreateButton",
10+
component: CreateButton,
11+
args: {
12+
children: "Create new program",
13+
onClick: () => onButtonClick("button clicked"),
14+
},
15+
argTypes: {
16+
variant: {
17+
control: {
18+
type: "select",
19+
options: ["program", "round"],
20+
},
21+
},
22+
className: {
23+
control: "text",
24+
},
25+
},
26+
} satisfies Meta<typeof CreateButton>;
27+
28+
export default meta;
29+
30+
type Story = StoryObj<typeof CreateButton>;
31+
32+
export const Default: Story = {
33+
args: {
34+
onClick: () => onButtonClick("program button clicked"),
35+
},
36+
};
37+
38+
export const Round: Story = {
39+
args: {
40+
variant: "round",
41+
children: "Create new round",
42+
onClick: () => onButtonClick("round button clicked"),
43+
},
44+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
"use client";
2+
3+
import { tv, VariantProps } from "tailwind-variants";
4+
5+
import { cn } from "@/lib";
6+
import { Icon, IconType } from "@/primitives/Icon";
7+
8+
const variants = tv({
9+
base: "flex h-20 w-full items-center gap-2 rounded-2xl p-6 font-ui-sans text-2xl font-medium",
10+
variants: {
11+
variant: {
12+
program: "bg-moss-50",
13+
round: "bg-purple-50",
14+
},
15+
},
16+
defaultVariants: {
17+
variant: "program",
18+
},
19+
});
20+
21+
export interface CreateButtonProps extends VariantProps<typeof variants> {
22+
className?: string;
23+
children: string;
24+
onClick?: () => void;
25+
}
26+
27+
export const CreateButton = ({
28+
variant,
29+
children = "Create new program",
30+
onClick,
31+
className,
32+
}: CreateButtonProps) => {
33+
const styles = variants({ variant });
34+
return (
35+
<button className={cn(styles, className)} onClick={onClick} value={children}>
36+
<Icon type={IconType.PLUS} />
37+
{children}
38+
</button>
39+
);
40+
};

src/components/CreateButton/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./CreateButton";

src/components/SideNav/SideNav.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ export const SideNav = ({
3939

4040
return (
4141
<div className={cn("relative flex flex-col gap-4", className)}>
42-
{items.map((item, index) => {
42+
{items?.map((item, index) => {
4343
const isActive = item.id === activeId;
4444

4545
return (
4646
<div key={`sidenav-item-${index}`}>
47-
{item.items.length > 0 ? (
47+
{item.items && item.items.length > 0 ? (
4848
<AccordionItem
4949
item={item}
5050
onClick={onClick}

src/components/SideNav/types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ export interface SideNavItem {
99
iconType?: IconType;
1010
id?: string;
1111
isSeparator?: boolean;
12-
items: SideNavItem[];
12+
items?: SideNavItem[];
1313
}
1414

1515
export interface InternalSideNavProps {
16-
items: SideNavItem[];
16+
items?: SideNavItem[];
1717
onClick: (id: string | undefined) => void;
1818
activeId?: string;
1919
className?: string;

src/docs/colors.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Meta, ColorPalette, ColorItem, Title } from "@storybook/blocks";
22

3-
import { grantsStackUIKit, grantsStackDesignSystem } from "@/tokens/colors";
3+
import { grantsStackUIKit, grantsStackDesignSystem } from "@/theme/colors";
44

55
<Meta title="Styles/Colors" />
66

src/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ export * from "./primitives/StatCard";
2020
export * from "./primitives/StatCardGroup";
2121
export * from "./primitives/TextArea";
2222
export * from "./primitives/Toast";
23+
export * from "./primitives/Typography";
2324
export * from "./primitives/VerticalTabs";
2425
export * from "./primitives/Switch";
2526
export * from "./primitives/Checkbox";
2627

28+
export * from "./components/CreateButton";
2729
export * from "./components/IconLabel";
2830
export * from "./components/ProgressModal";
2931
export * from "./components/RadioGroupList";

0 commit comments

Comments
 (0)