-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: updated grid size on home page (#66)
- Loading branch information
Fran McDade
authored and
Fran McDade
committed
Sep 25, 2024
1 parent
0123448
commit 9c57d37
Showing
6 changed files
with
86 additions
and
26 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
56 changes: 33 additions & 23 deletions
56
app/components/Home/components/Section/components/SectionHero/sectionHero.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 |
---|---|---|
@@ -1,39 +1,49 @@ | ||
import { Button } from "@mui/material"; | ||
import { Fragment } from "react"; | ||
import { ROUTES } from "../../../../../../../routes/constants"; | ||
import { calculateGridSize } from "../../../../../Layout/components/Hero/common/utils"; | ||
import { Carousel } from "./components/Carousel/carousel"; | ||
import { Hero } from "./components/Hero/hero"; | ||
import { | ||
Head, | ||
Headline, | ||
Section, | ||
SectionLayout, | ||
StyledSection, | ||
Subhead, | ||
SubHeadline, | ||
} from "./sectionHero.styles"; | ||
|
||
export const SectionHero = (): JSX.Element => { | ||
return ( | ||
<Section> | ||
<Hero gridSize={228} /> | ||
<SectionLayout> | ||
<Headline> | ||
<Head> | ||
<span>Analytics for pathogen, </span> | ||
<span>host, and vector data</span> | ||
</Head> | ||
<SubHeadline> | ||
<Subhead> | ||
Comprehensive tools for exploring and interpreting genomic | ||
annotations and functional insights into disease-causing organisms | ||
and their carriers | ||
</Subhead> | ||
<Button color="hero" href={ROUTES.ORGANISMS} variant="contained"> | ||
Get started | ||
</Button> | ||
</SubHeadline> | ||
</Headline> | ||
<Carousel /> | ||
</SectionLayout> | ||
</Section> | ||
<StyledSection> | ||
{(height): JSX.Element => ( | ||
<Fragment> | ||
<Hero gridSize={calculateGridSize(height)} height={height} /> | ||
<SectionLayout> | ||
<Headline> | ||
<Head> | ||
<span>Analytics for pathogen, </span> | ||
<span>host, and vector data</span> | ||
</Head> | ||
<SubHeadline> | ||
<Subhead> | ||
Comprehensive tools for exploring and interpreting genomic | ||
annotations and functional insights into disease-causing | ||
organisms and their carriers | ||
</Subhead> | ||
<Button | ||
color="hero" | ||
href={ROUTES.ORGANISMS} | ||
variant="contained" | ||
> | ||
Get started | ||
</Button> | ||
</SubHeadline> | ||
</Headline> | ||
<Carousel /> | ||
</SectionLayout> | ||
</Fragment> | ||
)} | ||
</StyledSection> | ||
); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import styled from "@emotion/styled"; | ||
|
||
export const StyledSection = styled.section` | ||
width: 100%; | ||
`; |
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,22 @@ | ||
import { | ||
getBorderBoxSizeHeight, | ||
useResizeObserver, | ||
} from "@databiosphere/findable-ui/lib/hooks/useResizeObserver"; | ||
import { useRef } from "react"; | ||
import { StyledSection } from "./section.styles"; | ||
|
||
export interface SectionProps { | ||
children: (height?: number) => JSX.Element; | ||
className?: string; | ||
} | ||
|
||
export const Section = ({ children, className }: SectionProps): JSX.Element => { | ||
const sectionRef = useRef<HTMLElement>(null); | ||
const { height } = | ||
useResizeObserver(sectionRef, getBorderBoxSizeHeight) || {}; | ||
return ( | ||
<StyledSection className={className} ref={sectionRef}> | ||
{children?.(height)} | ||
</StyledSection> | ||
); | ||
}; |