Skip to content

Commit be33439

Browse files
Fran McDadeFran McDade
authored andcommitted
feat: add animation to hero background (#31)
1 parent 527cf4a commit be33439

File tree

24 files changed

+509
-149
lines changed

24 files changed

+509
-149
lines changed

app/components/Home/components/Section/components/SectionAnalytics/sectionAnalytics.styles.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { smokeLightest } from "@databiosphere/findable-ui/lib/styles/common/mixins/colors";
1+
import {
2+
smokeLightest,
3+
smokeMain,
4+
} from "@databiosphere/findable-ui/lib/styles/common/mixins/colors";
25
import styled from "@emotion/styled";
36
import {
47
Section,
@@ -8,6 +11,7 @@ import {
811

912
export const StyledSection = styled(Section)`
1013
background-color: ${smokeLightest};
14+
border-top: 1px solid ${smokeMain};
1115
overflow: hidden;
1216
`;
1317

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import { Fragment } from "react";
2+
import {
3+
FILL,
4+
GRID_SIZE,
5+
} from "../../../../../../../Layout/components/Hero/common/constants";
6+
import {
7+
ELEMENT_ID,
8+
Height,
9+
} from "../../../../../../../Layout/components/Hero/common/entities";
10+
import {
11+
getElementHref,
12+
getFillUrl,
13+
getViewBox,
14+
} from "../../../../../../../Layout/components/Hero/common/utils";
15+
import { BlueCircle } from "../../../../../../../Layout/components/Hero/components/Defs/BlueCircle/blueCircle";
16+
import { BlueRect } from "../../../../../../../Layout/components/Hero/components/Defs/BlueRect/blueRect";
17+
import { CoralPinkCircle } from "../../../../../../../Layout/components/Hero/components/Defs/CoralPinkCircle/coralPinkCircle";
18+
import { SmokeCircle } from "../../../../../../../Layout/components/Hero/components/Defs/SmokeCircle/smokeCircle";
19+
import { SmokeRect } from "../../../../../../../Layout/components/Hero/components/Defs/SmokeRect/smokeRect";
20+
import { YellowRect } from "../../../../../../../Layout/components/Hero/components/Defs/YellowRect/yellowRect";
21+
22+
export interface HeroProps {
23+
gridSize?: number;
24+
height?: Height;
25+
}
26+
27+
export const Hero = ({
28+
gridSize = GRID_SIZE,
29+
height = GRID_SIZE * 3,
30+
}: HeroProps): JSX.Element => {
31+
return (
32+
<svg
33+
fill={FILL.NONE}
34+
height={height}
35+
preserveAspectRatio="xMinYMin meet"
36+
viewBox={getViewBox(gridSize, height)}
37+
width="100vw"
38+
xmlns="http://www.w3.org/2000/svg"
39+
>
40+
<SmokeRect gridSize={gridSize} />
41+
<SmokeCircle gridSize={gridSize} />
42+
<BlueRect gridSize={gridSize} />
43+
<YellowRect gridSize={gridSize} />
44+
<BlueCircle gridSize={gridSize} />
45+
<CoralPinkCircle gridSize={gridSize} />
46+
{[
47+
ELEMENT_ID.PATTERN_SMOKE_RECT,
48+
ELEMENT_ID.PATTERN_SMOKE_CIRCLE,
49+
ELEMENT_ID.PATTERN_BLUE_RECT,
50+
ELEMENT_ID.PATTERN_YELLOW_RECT,
51+
].map((elementId) => (
52+
<Fragment key={elementId}>
53+
<rect
54+
fill={getFillUrl(elementId)}
55+
height={height}
56+
width="100vw"
57+
x={0}
58+
y={0}
59+
/>
60+
</Fragment>
61+
))}
62+
<use href={getElementHref(ELEMENT_ID.GROUP_BLUE_CIRCLE)} x={0} />
63+
<use href={getElementHref(ELEMENT_ID.GROUP_CORAL_PINK_CIRLCLE)} />
64+
</svg>
65+
);
66+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { smokeLightest } from "@databiosphere/findable-ui/lib/styles/common/mixins/colors";
2+
import styled from "@emotion/styled";
3+
4+
export const Section = styled.section`
5+
background-color: ${smokeLightest};
6+
position: fixed;
7+
z-index: -1;
8+
`;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Hero } from "./components/Hero/hero";
2+
import { Section } from "./sectionBranding.styles";
3+
4+
export const SectionBranding = (): JSX.Element => {
5+
return (
6+
<Section>
7+
<Hero />
8+
</Section>
9+
);
10+
};

app/components/Home/components/Section/components/SectionHelp/sectionHelp.styles.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { mediaTabletUp } from "@databiosphere/findable-ui/lib/styles/common/mixins/breakpoints";
2-
import { white } from "@databiosphere/findable-ui/lib/styles/common/mixins/colors";
2+
import {
3+
smokeMain,
4+
white,
5+
} from "@databiosphere/findable-ui/lib/styles/common/mixins/colors";
36
import styled from "@emotion/styled";
47
import {
58
Section,
@@ -12,6 +15,7 @@ import {
1215

1316
export const StyledSection = styled(Section)`
1417
background-color: ${white};
18+
border-top: 1px solid ${smokeMain};
1519
`;
1620

1721
export const SectionLayout = styled(DefaultLayout)`

app/components/Home/components/Section/components/SectionHero/sectionHero.styles.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,14 @@ import {
22
mediaDesktopSmallUp,
33
mediaTabletUp,
44
} from "@databiosphere/findable-ui/lib/styles/common/mixins/breakpoints";
5-
import {
6-
inkLight,
7-
smokeLightest,
8-
} from "@databiosphere/findable-ui/lib/styles/common/mixins/colors";
5+
import { inkLight } from "@databiosphere/findable-ui/lib/styles/common/mixins/colors";
96
import { textBodyLarge400 } from "@databiosphere/findable-ui/lib/styles/common/mixins/fonts";
107
import styled from "@emotion/styled";
118
import {
12-
Section,
139
sectionGrid,
1410
SectionLayout as DefaultLayout,
1511
} from "../../section.styles";
1612

17-
export const StyledSection = styled(Section)`
18-
background: url("/hero/hero.svg") 0 0 repeat, ${smokeLightest};
19-
`;
20-
2113
export const SectionLayout = styled(DefaultLayout)`
2214
${sectionGrid};
2315
align-content: flex-end;

app/components/Home/components/Section/components/SectionHero/sectionHero.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { Button } from "@mui/material";
22
import { ROUTES } from "../../../../../../../routes/constants";
3+
import { Section } from "../../section.styles";
34
import {
45
Head,
56
Headline,
67
SectionLayout,
7-
StyledSection as Section,
88
Subhead,
99
SubHeadline,
1010
SubHeadlinePositioner,

app/components/Home/components/Section/components/SectionSubHero/sectionSubHero.styles.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { white } from "@databiosphere/findable-ui/lib/styles/common/mixins/colors";
1+
import {
2+
smokeMain,
3+
white,
4+
} from "@databiosphere/findable-ui/lib/styles/common/mixins/colors";
25
import { textBodySmall500 } from "@databiosphere/findable-ui/lib/styles/common/mixins/fonts";
36
import styled from "@emotion/styled";
47
import { Chip as MChip } from "@mui/material";
@@ -10,6 +13,7 @@ import {
1013

1114
export const StyledSection = styled(Section)`
1215
background-color: ${white};
16+
border-top: 1px solid ${smokeMain};
1317
`;
1418

1519
export const SectionLayout = styled(DefaultLayout)`

app/components/Layout/components/AppLayout/appLayout.styles.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Footer } from "@databiosphere/findable-ui/lib/components/Layout/components/Footer/footer";
2+
import { smokeLightest } from "@databiosphere/findable-ui/lib/styles/common/mixins/colors";
3+
import styled from "@emotion/styled";
4+
5+
export const StyledFooter = styled(Footer)`
6+
background-color: ${smokeLightest};
7+
`;

0 commit comments

Comments
 (0)