-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pass ProjectCard component a size prop (#6030)
* create four sizes in each ProjectCard Story * handle responsive context in TopProjects
- Loading branch information
1 parent
3bc4629
commit c70531f
Showing
6 changed files
with
122 additions
and
110 deletions.
There are no files selected for viewing
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
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
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
130 changes: 66 additions & 64 deletions
130
packages/lib-user/src/components/shared/ProjectCard/ProjectCard.stories.js
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 |
---|---|---|
@@ -1,90 +1,92 @@ | ||
import { Box } from 'grommet' | ||
import ProjectCard from './ProjectCard.js' | ||
|
||
// TODO: refactor with PROJECTS from panoptes.mock.js | ||
// import { PROJECTS } from '../../../../test/mocks/panoptes.mock.js' | ||
import { PROJECTS } from '../../../../test/mocks/panoptes/projects.js' | ||
|
||
export default { | ||
title: 'Components/shared/ProjectCard', | ||
component: ProjectCard, | ||
decorators: [ComponentDecorator] | ||
} | ||
function ComponentDecorator (Story) { | ||
return ( | ||
<Box | ||
background={{ | ||
dark: 'dark-3', | ||
light: 'neutral-6' | ||
}} | ||
fill | ||
pad='30px' | ||
> | ||
<Story /> | ||
</Box> | ||
) | ||
component: ProjectCard | ||
} | ||
|
||
export const NfnCaliFlowers = { | ||
args: { | ||
description: 'Using digital images to investigate phenological change in a biodiversity hotspot', | ||
displayName: `Notes from Nature - Capturing California's Flowers`, | ||
href: 'https://www.zooniverse.org/projects/md68135/notes-from-nature-capturing-californias-flowers', | ||
imageSrc: 'https://panoptes-uploads.zooniverse.org/project_avatar/0c4cfec1-a15b-468e-9f57-e9133993532d.jpeg' | ||
} | ||
displayName: PROJECTS[0].display_name, | ||
imageSrc: PROJECTS[0].avatar_src, | ||
...PROJECTS[0] | ||
}, | ||
render: args => ( | ||
<Box gap='medium' pad='medium' direction='row'> | ||
<ProjectCard size='xlarge' {...args} /> | ||
<ProjectCard size='large' {...args} /> | ||
<ProjectCard size='medium' {...args} /> | ||
<ProjectCard size='small' {...args} /> | ||
</Box> | ||
) | ||
} | ||
|
||
/* This code looks repetitive instead of mapping over PROJECTS, | ||
but Storybook requires named exports, so each project | ||
is explicitely written out below */ | ||
|
||
export const NestQuestGo = { | ||
args: { | ||
description: 'Help us understand the historical nesting patterns of these beloved bluebirds!', | ||
displayName: 'NEST QUEST GO: EASTERN BLUEBIRDS', | ||
href: 'https://www.zooniverse.org/projects/brbcornell/nest-quest-go-eastern-bluebirds', | ||
imageSrc: 'https://panoptes-uploads.zooniverse.org/project_avatar/d93adaec-c45e-45c8-a88a-ad68bf90020b.jpeg' | ||
} | ||
displayName: PROJECTS[1].display_name, | ||
imageSrc: PROJECTS[1].avatar_src, | ||
...PROJECTS[1] | ||
}, | ||
render: args => ( | ||
<Box gap='medium' pad='medium' direction='row'> | ||
<ProjectCard size='xlarge' {...args} /> | ||
<ProjectCard size='large' {...args} /> | ||
<ProjectCard size='medium' {...args} /> | ||
<ProjectCard size='small' {...args} /> | ||
</Box> | ||
) | ||
} | ||
|
||
export const PlanetHuntersTess = { | ||
args: { | ||
description: 'Join the Search for Undiscovered Worlds', | ||
displayName: 'Planet Hunters TESS', | ||
href: 'https://www.zooniverse.org/projects/nora-dot-eisner/planet-hunters-tess', | ||
imageSrc: 'https://panoptes-uploads.zooniverse.org/project_avatar/442e8392-6c46-4481-8ba3-11c6613fba56.jpeg' | ||
} | ||
displayName: PROJECTS[2].display_name, | ||
imageSrc: PROJECTS[2].avatar_src, | ||
...PROJECTS[2] | ||
}, | ||
render: args => ( | ||
<Box gap='medium' pad='medium' direction='row'> | ||
<ProjectCard size='xlarge' {...args} /> | ||
<ProjectCard size='large' {...args} /> | ||
<ProjectCard size='medium' {...args} /> | ||
<ProjectCard size='small' {...args} /> | ||
</Box> | ||
) | ||
} | ||
|
||
export const CorrespondingWithQuakers = { | ||
args: { | ||
description: 'Investigating race, gender, class, and religion in 18th- and 19th-Century Irish Quaker Documents', | ||
displayName: 'Corresponding with Quakers', | ||
href: 'https://www.zooniverse.org/projects/rachaelsking/corresponding-with-quakers', | ||
imageSrc: 'https://panoptes-uploads.zooniverse.org/project_avatar/252e7e80-949b-4324-8af4-8d3ad7aafbde.jpeg' | ||
} | ||
displayName: PROJECTS[3].display_name, | ||
imageSrc: PROJECTS[3].avatar_src, | ||
...PROJECTS[3] | ||
}, | ||
render: args => ( | ||
<Box gap='medium' pad='medium' direction='row'> | ||
<ProjectCard size='xlarge' {...args} /> | ||
<ProjectCard size='large' {...args} /> | ||
<ProjectCard size='medium' {...args} /> | ||
<ProjectCard size='small' {...args} /> | ||
</Box> | ||
) | ||
} | ||
|
||
export const WildwatchKenya = { | ||
args: { | ||
description: 'We need your help to count, identify, and track the giraffes and other wildlife living in our field conservation sites in northern Kenya! We need your help to count, identify, and track the giraffes and other wildlife living in our field conservation sites in northern Kenya!', | ||
displayName: 'Wildwatch Kenya is a short project name compared to the longest live project at 80', | ||
href: 'https://www.zooniverse.org/projects/sandiegozooglobal/wildwatch-kenya', | ||
imageSrc: 'https://panoptes-uploads.zooniverse.org/project_avatar/5dc89775-a658-4d3a-8295-4d48903e142d.jpeg' | ||
} | ||
} | ||
|
||
export const NfnCaliFlowersSmall = { | ||
args: { | ||
description: 'Using digital images to investigate phenological change in a biodiversity hotspot', | ||
displayName: `Notes from Nature - Capturing California's Flowers`, | ||
href: 'https://www.zooniverse.org/projects/md68135/notes-from-nature-capturing-californias-flowers', | ||
imageSrc: 'https://panoptes-uploads.zooniverse.org/project_avatar/0c4cfec1-a15b-468e-9f57-e9133993532d.jpeg', | ||
small: true | ||
} | ||
} | ||
|
||
export const WildwatchKenyaSmall = { | ||
args: { | ||
description: 'We need your help to count, identify, and track the giraffes and other wildlife living in our field conservation sites in northern Kenya! We need your help to count, identify, and track the giraffes and other wildlife living in our field conservation sites in northern Kenya!', | ||
displayName: 'Wildwatch Kenya is a short project name compared to the longest live project at 80', | ||
href: 'https://www.zooniverse.org/projects/sandiegozooglobal/wildwatch-kenya', | ||
imageSrc: 'https://panoptes-uploads.zooniverse.org/project_avatar/5dc89775-a658-4d3a-8295-4d48903e142d.jpeg', | ||
small: true | ||
} | ||
displayName: PROJECTS[4].display_name, | ||
imageSrc: PROJECTS[4].avatar_src, | ||
...PROJECTS[4] | ||
}, | ||
render: args => ( | ||
<Box gap='medium' pad='medium' direction='row'> | ||
<ProjectCard size='xlarge' {...args} /> | ||
<ProjectCard size='large' {...args} /> | ||
<ProjectCard size='medium' {...args} /> | ||
<ProjectCard size='small' {...args} /> | ||
</Box> | ||
) | ||
} |