Skip to content
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 color shadows to ETHos CTA boxes #118

Merged
merged 8 commits into from
Apr 7, 2023
Merged
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
127 changes: 72 additions & 55 deletions components/EthosComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,31 @@ import {
Flex,
FlexProps,
Grid,
Image,
Link,
LinkProps,
Text,
} from "@chakra-ui/react"
import NextImage from "next/image"
import { SHADOW_SMALL, SHADOW_LARGE } from "../constants"

const shadowTranslate = (
const shadowCardProps = (
color: string,
toLeft: boolean = false
): { base: string; md: string } => ({
base: `${toLeft ? "-" : ""}${SHADOW_SMALL} ${SHADOW_SMALL}`,
md: `${toLeft ? "-" : ""}${SHADOW_LARGE} ${SHADOW_LARGE}`,
): FlexProps => ({
w: [`calc(100% - ${SHADOW_SMALL})`, null, `calc(100% - ${SHADOW_LARGE})`],
_before: {
content: '""',
position: "absolute",
inset: 0,
translate: {
base: `${toLeft ? "-" : ""}${SHADOW_SMALL} ${SHADOW_SMALL}`,
md: `${toLeft ? "-" : ""}${SHADOW_LARGE} ${SHADOW_LARGE}`,
},
bg: color,
zIndex: -1,
border: "3px solid",
borderColor: "fg",
}
})

interface CardProps extends BoxProps {
Expand All @@ -36,17 +49,7 @@ const Card: FC<CardProps> = ({
gap={4}
position="relative"
justifySelf={toLeft ? "end" : "start"}
w={[`calc(100% - ${SHADOW_SMALL})`, null, `calc(100% - ${SHADOW_LARGE})`]}
_before={{
content: '""',
position: "absolute",
inset: 0,
translate: shadowTranslate(toLeft),
bg: color,
zIndex: -1,
border: "3px solid",
borderColor: "fg",
}}
{...shadowCardProps(color as string, toLeft)}
{...restProps}
>
{children}
Expand All @@ -55,35 +58,33 @@ const Card: FC<CardProps> = ({

interface InfoCardProps extends BoxProps {
title: string
imagePath: string
imagePath?: string
toLeft?: boolean
flipHeader?: boolean
}
export const InfoCard: FC<InfoCardProps> = ({
color,
children,
title,
imagePath,
toLeft = false,
flipHeader = false,
...restProps
}) => (
<Card color={color} toLeft={toLeft} {...restProps}>
<Flex
gap={6}
direction={flipHeader ? "row-reverse" : "row"}
justify="start"
justify="space-between"
>
<Text
as="h2"
fontFamily="heading"
fontWeight="bold"
fontSize={["xl", "2xl", "3xl"]}
color="white"
lineHeight="1.2"
>
{title}
</Text>
<Image src={imagePath} width="auto" height="100%" alt="" />
{imagePath && <NextImage src={imagePath} width="64px" height="32px" alt="" />}
</Flex>
<Text fontFamily="body" fontSize={["lg", "xl", "2xl"]} lineHeight="1.2">
{children}
Expand All @@ -93,43 +94,58 @@ export const InfoCard: FC<InfoCardProps> = ({

interface ButtonLinkProps
extends Pick<LinkProps, "href" | "color" | "children"> {}
export const ButtonLink: FC<ButtonLinkProps> = ({ color, href, children }) => (
<Link
href={href}
isExternal={href.startsWith("http")}
_hover={{
textDecoration: "none",
}}
>
<Grid
position="relative"
border="3px solid"
borderColor="fg"
bg={color}
px={[6, null, null, 8]}
py={[3, 4]}
placeItems="center"
export const ButtonLink: FC<ButtonLinkProps> = ({ color, href, children }) => {
const hoverStyles = {
boxShadow: "inset 0 0 0 2px var(--chakra-colors-mix-red-400)",
bg: "fg",
p: { color: "mix.red.400" },
_after: {
position: "absolute",
content: '""',
bgImage: "url('/images/ethos/chili-decorator.png')",
bgSize: "contain",
bgRepeat: "no-repeat",
insetInlineEnd: [`calc(-0.5 * ${SHADOW_SMALL})`, null, `calc(-0.5 * ${SHADOW_LARGE})`],
bottom: [`calc(-0.5 * ${SHADOW_SMALL})`, null, `calc(-0.5 * ${SHADOW_LARGE})`],
w: ["2rem", null, "3rem", null],
h: ["2rem", null, "3rem", null],
zIndex: 1,
}
}

return (
<Link
href={href}
isExternal={href.startsWith("http")}
_hover={{
_after: {
content: '""',
position: "absolute",
inset: 2,
bg: "blackAlpha.400",
zIndex: 1,
},
textDecoration: "none",
}}
data-group
>
<Text
fontSize={["sm", "md", "md", "xl"]}
color="fg"
fontFamily="a"
textTransform="lowercase"
<Grid
position="relative"
borderColor="fg"
bg={color}
px={[6, null, null, 8]}
py={[3, 4]}
placeItems="center"
boxShadow="inset 0 0 0 8px var(--chakra-colors-blackAlpha-400)"
_groupHover={hoverStyles}
_groupFocus={hoverStyles}
>
{children}
</Text>
</Grid>
</Link>
)
<Text
fontSize={["lg", null, null, "2xl"]}
fontWeight="bold"
color="fg"
fontFamily="a"
textTransform="lowercase"
>
{children}
</Text>
</Grid>
</Link>
)
}

interface CtaCardProps extends Pick<FlexProps, "children" | "color"> {
prompt: string
Expand All @@ -143,6 +159,7 @@ export const CtaCard: FC<CtaCardProps> = ({ prompt, color, children }) => (
justify="space-between"
alignItems="center"
position="relative"
{...shadowCardProps(color as string)}
>
<Text
fontSize={["lg", "xl", null, "2xl"]}
Expand Down
63 changes: 40 additions & 23 deletions pages/ethos.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FC } from "react"
import { Box, Flex, Grid, Text } from "@chakra-ui/react"
import { PageMetadata, InfoCard, ButtonLink, CtaCard } from "../components"
import { Box, Flex, Grid, Link, Text } from "@chakra-ui/react"
import { PageMetadata, InfoCard, ButtonLink, CtaCard, Icon, IconName } from "../components"
import { SHADOW_SMALL, SHADOW_LARGE } from "../constants"

const Ethos: FC = () => (
Expand Down Expand Up @@ -48,6 +48,8 @@ const Ethos: FC = () => (
</Text>
S
</Text>

{/* Sub-hero */}
<Box
px={[12, null, null, 16]}
py={4}
Expand All @@ -57,10 +59,11 @@ const Ethos: FC = () => (
alignSelf="start"
mb={[6, null, 8]}
mt={[-6, null, -10]}
ms={8}
w={[
`calc(100% - ${SHADOW_SMALL})`,
`calc(100% - 3 * ${SHADOW_SMALL})`,
null,
`calc(100% - ${SHADOW_LARGE})`,
`calc(100% - 2 * ${SHADOW_LARGE})`,
]}
/* ETH glyph decorator */
_after={{
Expand Down Expand Up @@ -103,7 +106,7 @@ const Ethos: FC = () => (

{/* Calls to action */}
<Grid
gap={6}
gap={[10, null, 4, 8]}
templateColumns={{
base: "1fr",
md: "repeat(2, 1fr)",
Expand Down Expand Up @@ -137,22 +140,9 @@ const Ethos: FC = () => (
>
<InfoCard
color="brand.taco"
title="What are we up to?"
imagePath="/images/ethos/ethos-test-tube.svg"
title="What we're up to"
imagePath="/images/ethos/hardhat.svg"
toLeft
_after={{
content: "''",
position: "absolute",
insetInlineEnd: "-2rem",
insetBlockStart: "-1rem",
width: "5rem",
height: "5rem",
zIndex: 5,
bgImage: "url('/images/ethos/hardhat.svg')",
bgRepeat: "no-repeat",
objectFit: "contain",
transform: "rotate(30deg)",
}}
>
Our mission is to identify global events that unite groups of diverse
humans, exploring the intersections of Web3 technologies and human
Expand All @@ -163,10 +153,8 @@ const Ethos: FC = () => (

<InfoCard
color="mix.teal.400"
title="Who are we?"
imagePath="/images/ethos/ethos-smile.svg"
title="Who we are"
toLeft
flipHeader
sx={{
p: {
fontSize: ["xl", "2xl", "3xl"],
Expand All @@ -178,6 +166,35 @@ const Ethos: FC = () => (
funding experiments in physical gathering spaces.
</InfoCard>
</Grid>

{/* Substack email subscription callout */}
<Link
href="https://dapp.substack.com/"
isExternal
mt={8}
>
<Flex
gap={1}
color="fg"
transition="transform 0.2s ease-in-out"
_hover={{
transform: "scale(1.03)",
transition: "transform 0.2s ease-in-out"
}}
fontSize={['md', 'lg', 'xl']}
alignItems="center"
>
<Icon name={'letter-mail' as IconName} />
<Text
fontFamily="heading"
fontWeight="bold"
textDecoration="underline"
textAlign="center"
>
Subscribe to our newsletter
</Text>
</Flex>
</Link>
</Flex>
</Flex>
)
Expand Down
Binary file added public/images/ethos/chili-decorator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions public/images/ethos/chili-decorator.svg

This file was deleted.

Loading