Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 30 additions & 30 deletions src/components/PageAssets.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import styled from "@emotion/styled"
import { Link } from "gatsby"
import React, { useState } from "react"
import Sparkles from "./Sparkle"
import Fade from "react-reveal/fade"
import styled from "@emotion/styled";
import { Link } from "gatsby";
import React, { useState } from "react";
import Sparkles from "./Sparkle";
import Fade from "react-reveal/fade";

const fonts = {
main: "Prompt",
}
};

const mobile = `@media (max-width: 800px)`
export const mobile = `@media (max-width: 800px)`;

export const NovaH1 = styled.div`
font-family: ${fonts.main};
Expand All @@ -24,7 +24,7 @@ export const NovaH1 = styled.div`
${mobile} {
font-size: 32px;
}
`
`;
export const NovaH2 = styled.div`
font-family: ${fonts.main};
font-style: normal;
Expand All @@ -40,7 +40,7 @@ export const NovaH2 = styled.div`
${mobile} {
font-size: 24px;
}
`
`;

export const NovaH4 = styled.div`
font-family: ${fonts.main};
Expand All @@ -57,7 +57,7 @@ export const NovaH4 = styled.div`
${mobile} {
font-size: 18px;
}
`
`;

export const NovaDiv = styled.div`
font-family: Rubik;
Expand All @@ -68,15 +68,15 @@ export const NovaDiv = styled.div`
${mobile} {
font-size: ${({ fontSize }) => `${(2 / 3) * fontSize || 12}px`};
}
`
`;

export const NovaSpacer = styled.div`
width: 100%;
height: ${({ y }) => `${y}`}px;
${mobile} {
height: ${({ mobileY, y }) => `${mobileY || (2 / 3) * y}`}px;
}
`
`;

export const MainBox = styled.div`
margin-top: 100px;
Expand All @@ -88,7 +88,7 @@ export const MainBox = styled.div`
width: 95%;
min-width: 0;
}
`
`;

export const NovaP = styled.p`
-webkit-font-smoothing: antialiased;
Expand All @@ -106,7 +106,7 @@ export const NovaP = styled.p`
${mobile} {
font-size: 16px;
}
`
`;

export const Button = styled(Link)`
color: ${({ textColor }) => `${textColor || "#FFFFFF"}`};
Expand All @@ -132,10 +132,10 @@ export const Button = styled(Link)`
padding: 12px 15px;
margin: 5px;
}
`
`;

export function SparklyButton(props) {
const [hover, setHover] = useState(false)
const [hover, setHover] = useState(false);
return (
<Sparkles hide={!hover}>
<Button
Expand All @@ -147,7 +147,7 @@ export function SparklyButton(props) {
{props.children}
</Button>
</Sparkles>
)
);
}

const SectionBoxStyled = styled.div`
Expand All @@ -159,15 +159,15 @@ const SectionBoxStyled = styled.div`
width: 95%;
min-width: 0;
}
`
`;

export const SectionBox = ({ children }) => {
return (
<Fade>
<SectionBoxStyled>{children}</SectionBoxStyled>
</Fade>
)
}
);
};

export const SectionHeading = styled(NovaH2)`
font-family: ${fonts.main};
Expand All @@ -181,7 +181,7 @@ export const SectionHeading = styled(NovaH2)`
margin: 0;
/* identical to box height, or 65px */
letter-spacing: 0.05em;
`
`;

export const SectionSubHeading = styled.h2`
font-family: ${fonts.main};
Expand All @@ -196,7 +196,7 @@ export const SectionSubHeading = styled.h2`
${mobile} {
font-size: 20px;
}
`
`;

export const NovaLink = styled(Link)`
color: #ffffff;
Expand All @@ -206,7 +206,7 @@ export const NovaLink = styled(Link)`
&:hover {
color: #ffc650;
}
`
`;

export const NovaA = styled.a`
color: #ffffff;
Expand All @@ -217,7 +217,7 @@ export const NovaA = styled.a`
&:hover {
color: #ffc650;
}
`
`;

export const Img = styled.img`
width: 100%;
Expand All @@ -228,7 +228,7 @@ export const Img = styled.img`
${mobile} {
margin: 32px 0;
}
`
`;

export const Span = styled.span`
font-family: Rubik;
Expand All @@ -238,7 +238,7 @@ export const Span = styled.span`
line-height: 160%;
/* or 22px */
color: #d7a3e1;
`
`;

export const ListItem = styled.li`
list-style-type: none;
Expand All @@ -248,7 +248,7 @@ export const ListItem = styled.li`
&::before {
content: "•\xa0\xa0";
}
`
`;

const ArrowStyled = styled.b`
color: #ffc650;
Expand All @@ -258,7 +258,7 @@ const ArrowStyled = styled.b`
${mobile} {
font-size: 14px;
}
`
`;
export const Arrow = () => {
return <ArrowStyled>&#8594;&ensp;</ArrowStyled>
}
return <ArrowStyled>&#8594;&ensp;</ArrowStyled>;
};
89 changes: 89 additions & 0 deletions src/components/TextVSlider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import React from "react";
import styled from "@emotion/styled";
import { keyframes } from "@emotion/core";
import { mobile, NovaH1 } from "./PageAssets";
import Sparkles from "./Sparkle";

// First pass: keyframes for the text slider will be fixed, so if user
// were to add more elements, they would need to change the keyframes
// accordingly.
// Huge credits to W.S. Toh
// https://code-boxx.com/responsive-pure-css-text-slider/#sec-v

const DimensionedDiv = styled.div`
box-sizing: border-box;
width: 100%;
height: 66px;

${mobile} {
height: 49px;
}
`;

// Vertical slider (move up)
// Keeping just in case we want to revert.
// const SlideV = keyframes`
// 0% { bottom: 0; }
// 16% { bottom: 0; }
// 20% { bottom: 100%; }
// 36% { bottom: 100%; }
// 40% { bottom: 200%; }
// 56% { bottom: 200%; }
// 60% { bottom: 300%; }
// 76% { bottom: 300%; }
// 80% { bottom: 400%; }
// 100% { bottom: 400%; }
// `;

// Vertical slider (move down)
const SlideV = keyframes`
0% { bottom: 400%; }
16% { bottom: 400%; }
20% { bottom: 300%; }
36% { bottom: 300%; }
40% { bottom: 200%; }
56% { bottom: 200%; }
60% { bottom: 100%; }
76% { bottom: 100%; }
80% { bottom: 0%; }
100% { bottom: 0%; }
`;

// TODO: "for Good" horizontal re-centering

const VWrap = styled(DimensionedDiv)`
overflow: hidden;
`;

const VMove = styled.div`
position: relative;
bottom: 0%;
animation: ${SlideV} 12s forwards;
`;

// VSlide is left as a somewhat redundant component for better semantics
// and easier styling in the future.
const VSlide = styled(DimensionedDiv)``;

const verbs = ["Build", "Code", "Design", "Innovate", "Nova"];

const TextVSlider = (params) => {
return (
<VWrap>
<VMove>
{verbs.map((verb, i, a) => {
return (
// <VSlide as={NovaH1} center>
// <NovaH1 as center>{verb} for Good</NovaH1>
// </VSlide>
<VSlide as={NovaH1} center>
{a[a.length - i - 1]} for Good
</VSlide>
);
})}
</VMove>
</VWrap>
);
};

export default TextVSlider;
5 changes: 3 additions & 2 deletions src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
NovaA,
} from "../components/PageAssets";
import styled from "@emotion/styled";
import TextVSlider from "../components/TextVSlider";

const mobile = `@media (max-width: 800px)`;
const notMobile = `@media (min-width: 801px)`;
Expand Down Expand Up @@ -140,8 +141,8 @@ export default function Home({ data }) {
<MobileView>
<NovaSpacer y={48} />
</MobileView>
<NovaH1 center>Nova, Tech for Good.</NovaH1>
<NovaSpacer y={36} />
<TextVSlider />
<NovaSpacer y={34} />
<Description center>
We are a team of students at UCLA who aim to create high-impact
technology that empowers nonprofits to better serve their
Expand Down