-
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.
refactor: setup project tab selection component
- Loading branch information
Showing
7 changed files
with
143 additions
and
79 deletions.
There are no files selected for viewing
45 changes: 0 additions & 45 deletions
45
src/grants/components/grantee-project/project-selection-client-wrapper.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
23 changes: 23 additions & 0 deletions
23
src/grants/components/grantee-project/project-selections.tsx
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,23 @@ | ||
import { ProjectSelection } from './project-selection'; | ||
|
||
interface SelectionsProps { | ||
baseHref: string; | ||
projects: string[]; | ||
} | ||
|
||
export const ProjectSelections = ({ baseHref, projects }: SelectionsProps) => { | ||
if (projects.length === 0) return null; | ||
|
||
return ( | ||
<div className="flex w-full gap-4 bg-white/5 p-4"> | ||
{projects.map((projectId) => ( | ||
<ProjectSelection | ||
key={projectId} | ||
firstId={projects[0]} | ||
projectId={projectId} | ||
baseHref={baseHref} | ||
/> | ||
))} | ||
</div> | ||
); | ||
}; |
91 changes: 91 additions & 0 deletions
91
src/grants/components/grantee-project/project-tab-selection.stories.tsx
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,91 @@ | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { faker } from '@faker-js/faker'; | ||
|
||
import { MockQueryResult } from '@/shared/testutils/misc'; | ||
|
||
import { mockGranteeProjectQuery } from '@/grants/testutils/mock-grantee-project-query'; | ||
|
||
import { ProjectTabSelection } from './project-tab-selection'; | ||
|
||
faker.seed(420); | ||
|
||
const meta: Meta<typeof ProjectTabSelection> = { | ||
title: 'grants/components/grantee-project/project-tab-selections', | ||
component: ProjectTabSelection, | ||
decorators: [ | ||
(Story) => { | ||
const baseHref = '/grants/grant-1/grantees/grantee-1/projects'; | ||
const defaultId = 'project-1'; | ||
|
||
return ( | ||
<div className="flex w-full justify-center"> | ||
<Story args={{ baseHref, defaultId }} /> | ||
</div> | ||
); | ||
}, | ||
], | ||
parameters: { | ||
nextjs: { | ||
navigation: { | ||
segments: [['projectId', 'project-1']], | ||
}, | ||
}, | ||
msw: { | ||
handlers: [mockGranteeProjectQuery(MockQueryResult.SUCCESS)], | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof ProjectTabSelection>; | ||
|
||
export const OverallSummary: Story = { | ||
parameters: { | ||
nextjs: { | ||
navigation: { | ||
segments: [['tab', 'summary']], | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export const ImpactMetrics: Story = { | ||
parameters: { | ||
nextjs: { | ||
navigation: { | ||
segments: [['tab', 'impact-metrics']], | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export const GithubMetrics: Story = { | ||
parameters: { | ||
nextjs: { | ||
navigation: { | ||
segments: [['tab', 'github-metrics']], | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export const CodeMetrics: Story = { | ||
parameters: { | ||
nextjs: { | ||
navigation: { | ||
segments: [['tab', 'code-metrics']], | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export const ContractAddress: Story = { | ||
parameters: { | ||
nextjs: { | ||
navigation: { | ||
segments: [['tab', 'contract-address']], | ||
}, | ||
}, | ||
}, | ||
}; |
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