-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add landing page #170
Merged
Merged
add landing page #170
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
c437407
apply className prop to table cells with values of length 1
kne42 dafcddf
add custom tailwind classes to set a gradient with background image
kne42 dcfaffe
add base styling for landing page header
kne42 cd05e12
style CTA section
kne42 b26c26d
add dataset contributors and header image attribution
kne42 fab34a7
fetch data for landing page
kne42 bf457fd
move some strings to i18n
kne42 d9799a7
add links to landing page header
kne42 8fdadfa
use Number.toLocaleString to render numbers with commas
kne42 3268ac3
update header image
kne42 6806e38
refactor to use i18n
kne42 338cf8b
add key to list
kne42 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
frontend/packages/data-portal/app/components/Index/IndexCTA.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,62 @@ | ||
import { Button } from '@czi-sds/components' | ||
|
||
import { I18n } from 'app/components/I18n' | ||
import { Link } from 'app/components/Link' | ||
import { useI18n } from 'app/hooks/useI18n' | ||
|
||
function CTA({ | ||
title, | ||
text, | ||
buttonText, | ||
url, | ||
}: { | ||
title: string | ||
text: string | ||
buttonText: string | ||
url: string | ||
}) { | ||
return ( | ||
<> | ||
<div className="flex flex-col gap-sds-xs"> | ||
<h4 className="font-sds-semibold font-semibold text-sds-header-m leading-sds-header-m"> | ||
{title} | ||
</h4> | ||
<p>{text}</p> | ||
</div> | ||
<div> | ||
<Link to={url}> | ||
<Button sdsType="primary" sdsStyle="rounded"> | ||
{buttonText} | ||
</Button> | ||
</Link> | ||
</div> | ||
</> | ||
) | ||
} | ||
|
||
export function IndexCTA() { | ||
const { t } = useI18n() | ||
|
||
return ( | ||
<div className="py-sds-xxl flex flex-col gap-sds-xl relative after:h-full after:w-[200vw] after:bg-sds-primary-100 after:absolute after:top-0 after:-translate-x-1/2 after:-z-10"> | ||
<h3 className="font-sds-semibold font-semibold text-sds-header-xl leading-sds-header-xl"> | ||
<I18n i18nKey="helpUsAchieveThisVision" /> | ||
</h3> | ||
<div className="w-full grid grid-cols-[1fr_auto_1fr] grid-rows-[1fr_auto] grid-flow-col gap-y-sds-xl gap-x-sds-xxl"> | ||
<CTA | ||
title={t('viewAndDownloadDatasets')} | ||
text={t('viewDatasetsCta')} | ||
buttonText={t('browseData')} | ||
url="/browse-data/datasets" | ||
/> | ||
<div className="bg-sds-gray-200 w-sds-xxxs row-span-2" /> | ||
<CTA | ||
title={t('contributeYourData')} | ||
text={t('contributeCta')} | ||
buttonText={t('tellUsMore')} | ||
url={t('urlDataContributionForm')} | ||
/> | ||
</div> | ||
</div> | ||
) | ||
} |
43 changes: 43 additions & 0 deletions
43
frontend/packages/data-portal/app/components/Index/IndexContent.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,43 @@ | ||
import { I18n } from 'app/components/I18n' | ||
|
||
import { IndexContributors } from './IndexContributors' | ||
import { IndexCTA } from './IndexCTA' | ||
|
||
export function IndexContent() { | ||
return ( | ||
<div className="px-sds-xl w-[100vw] overflow-x-clip flex flex-col items-center"> | ||
<div className="flex flex-col max-w-content-small py-sds-xxl gap-sds-xxl"> | ||
<div className="flex flex-col gap-sds-xl"> | ||
<h2 className="font-sds-semibold font-semibold text-sds-header-xl leading-sds-header-xl"> | ||
<I18n i18nKey="landingPageWelcomeBlurb" /> | ||
</h2> | ||
<div className="font-sds-regular text-sds-body-s leading-sds-body-s flex flex-col gap-sds-l"> | ||
<p> | ||
<I18n i18nKey="landingPageCopy1" /> | ||
</p> | ||
<p> | ||
<I18n i18nKey="landingPageCopy2" /> | ||
</p> | ||
<p> | ||
<I18n i18nKey="landingPageCopy3" /> | ||
</p> | ||
<p> | ||
<I18n i18nKey="landingPageCopy4" /> | ||
</p> | ||
<p> | ||
<I18n i18nKey="landingPageCopy5" /> | ||
</p> | ||
</div> | ||
</div> | ||
<IndexCTA /> | ||
<IndexContributors /> | ||
<div className="flex flex-col gap-sds-m"> | ||
<div className="flex-initial h-sds-xxxs bg-sds-gray-200" /> | ||
<p className="text-sds-body-xxxs leading-sds-body-xxxs text-sds-gray-600"> | ||
<I18n i18nKey="landingHeaderImageAttribution" /> | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} |
49 changes: 49 additions & 0 deletions
49
frontend/packages/data-portal/app/components/Index/IndexContributors.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,49 @@ | ||
import { I18n } from 'app/components/I18n' | ||
|
||
const CONTRIBUTORS = ` | ||
David Agard | ||
Ben Barad | ||
Florian Bec | ||
John Briggs | ||
Zhen Chen | ||
Jane Ding | ||
Ben Engel | ||
Ryan Feathers | ||
Sara Goetz | ||
Danielle Grotjhan | ||
Gus Hart | ||
Grant Jensen | ||
Mohammed Kaplan | ||
Zunlong Ke | ||
Sagar Khavnekar | ||
Abhay Kotecha | ||
Jun Liu | ||
Julia Mahamid | ||
Michaela Medina | ||
Jürgen Plitzko | ||
Ricado Righetto | ||
Kem Sochacki | ||
Matt Swulius | ||
Liang Xue | ||
Huaxin Yu | ||
Ellen Zhong | ||
` | ||
|
||
export function IndexContributors() { | ||
const contributors = CONTRIBUTORS.split('\n').filter(Boolean) | ||
|
||
return ( | ||
<div className="flex flex-col gap-sds-xl h-full"> | ||
<h3 className="font-sds-semibold font-semibold text-sds-header-xl leading-sds-header-xl"> | ||
<I18n i18nKey="thankYouToOurDataContributors" /> | ||
</h3> | ||
<ul className="grid grid-flow-col grid-rows-[repeat(7,_minmax(0,_1fr))] grid-cols-4 gap-y-sds-xxs gap-x-sds-xl"> | ||
{contributors.map((name) => ( | ||
<li key={name} className="text-sds-body-xs leading-sds-body-xs"> | ||
{name} | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
) | ||
} |
95 changes: 95 additions & 0 deletions
95
frontend/packages/data-portal/app/components/Index/IndexHeader.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,95 @@ | ||
import { Button } from '@czi-sds/components' | ||
import { styled } from '@mui/material/styles' | ||
import { useTypedLoaderData } from 'remix-typedjson' | ||
|
||
import { LandingPageDataQuery } from 'app/__generated__/graphql' | ||
import { I18n } from 'app/components/I18n' | ||
import { Link } from 'app/components/Link' | ||
import { useI18n } from 'app/hooks/useI18n' | ||
import { theme } from 'app/theme' | ||
import { cns, cnsNoMerge } from 'app/utils/cns' | ||
|
||
function MetricField({ title, count }: { title: string; count: number }) { | ||
return ( | ||
<div | ||
className={cns( | ||
'flex flex-col items-center justify-center', | ||
'flex-auto max-w-[120px] w-full px-sds-m', | ||
'font-sds-semibold font-semibold', | ||
)} | ||
> | ||
<p className="text-sds-caps-xxxs leading-sds-caps-xxxs uppercase drop-shadow-landing-header"> | ||
{title} | ||
</p> | ||
<p className="text-sds-header-l leading-sds-header-l drop-shadow-landing-header"> | ||
{count.toLocaleString()} | ||
</p> | ||
</div> | ||
) | ||
} | ||
|
||
const CTAButton = styled(Button)({ | ||
'background-color': theme.palette.grey[200], | ||
color: theme.palette.common.black, | ||
filter: 'drop-shadow(0 0 7px rgba(0, 0, 0, 0.5))', | ||
'&:hover': { | ||
color: theme.palette.common.black, | ||
'background-color': theme.palette.common.white, | ||
}, | ||
}) | ||
|
||
const DIVIDER = ( | ||
<div className="w-[1px] flex-initial h-full bg-gray-400 drop-shadow-landing-header" /> | ||
) | ||
|
||
export function IndexHeader() { | ||
const { t } = useI18n() | ||
const data = useTypedLoaderData<LandingPageDataQuery>() | ||
|
||
const datasets = data.datasets_aggregate.aggregate?.count | ||
const species = data.species_aggregate.aggregate?.count | ||
const tomograms = data.tomograms_aggregate.aggregate?.count | ||
|
||
return ( | ||
<div | ||
className={cnsNoMerge( | ||
'bg-img-landing-header', | ||
// layout | ||
'w-full h-[325px]', | ||
'py-sds-xxl px-sds-xl', | ||
'flex flex-col items-center justify-center', | ||
// background' | ||
'bg-gradient-img-to-b bg-auto bg-no-repeat bg-black bg-top', | ||
// values ripped from figma: `background: linear-gradient(180deg, #000000 0%, rgba(0, 0, 0, 0.75) 16.69%, rgba(0, 0, 0, 0.3) 88.71%);` | ||
'from-black', | ||
'via-[rgba(0,0,0,0.75)] via-[16.69%]', | ||
'to-[rgba(0,0,0,0.3)] to-[88.71%]', | ||
)} | ||
> | ||
<div className="flex flex-col items-center gap-sds-m text-white"> | ||
<div className="flex flex-col gap-sds-xl items-center"> | ||
<h1 className="text-[32px] leading-[34px] font-sds-semibold font-semibold drop-shadow-landing-header"> | ||
<I18n i18nKey="landingHeaderTitle" /> | ||
</h1> | ||
<div className="flex flex-row justify-center w-full"> | ||
<MetricField title={t('datasets')} count={datasets ?? 0} /> | ||
{DIVIDER} | ||
<MetricField title={t('species')} count={species ?? 0} /> | ||
{DIVIDER} | ||
<MetricField title={t('tomograms')} count={tomograms ?? 0} /> | ||
</div> | ||
<Link to="/browse-data/datasets"> | ||
<CTAButton sdsType="primary" sdsStyle="rounded"> | ||
<I18n i18nKey="browseData" /> | ||
</CTAButton> | ||
</Link> | ||
</div> | ||
<Link to={t('apiDocLink')}> | ||
<p className="underline underline-offset-1 decoration-1 text-sds-body-xxs leading-none drop-shadow-landing-header"> | ||
<I18n i18nKey="orExploreViaApi" /> | ||
</p> | ||
</Link> | ||
</div> | ||
</div> | ||
) | ||
} |
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,2 @@ | ||
export * from './IndexContent' | ||
export * from './IndexHeader' |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: hmm was there no way to do this in tailwind or CSS modules? a bit iffy on adding a 3rd styling solution in the codebase but not a blocker