Skip to content

Commit

Permalink
Add ecosystem hero section
Browse files Browse the repository at this point in the history
  • Loading branch information
evandrosaturnino committed Aug 29, 2023
1 parent 3e4bd5b commit dccff09
Show file tree
Hide file tree
Showing 5 changed files with 149 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/components/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const Image: FC<ImageProps & IconProps & { childImageSharp?: any }> = ({
childImageSharp,
...restProps
}) => {
if (internal.mediaType === "image/svg+xml" && svg) {
if (internal?.mediaType === "image/svg+xml" && svg) {
const IconComponent = buildIcon(id, svg)
return <IconComponent {...restProps} />
} else if (gatsbyImageData) {
Expand Down
23 changes: 20 additions & 3 deletions src/components/PageSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import { Image } from "../components/Image"
import useChakraBreakpoint from "../hooks/useChakraBreakpoint"
import { ImageProps } from "./Image"

export interface SectionImageProps {
imageProps: ImageProps
isImageBackground?: boolean
}

export const PageSection: FC<BoxProps & { withSmallPadding?: boolean }> = ({
withSmallPadding,
children,
Expand Down Expand Up @@ -45,12 +50,24 @@ export const ResponsiveStack: FC<
)
}

export const SectionImage: FC<ImageProps> = (imageProps) => {
export const SectionImage: FC<SectionImageProps> = ({
imageProps,
isImageBackground,
}) => {
const mdSize = useChakraBreakpoint("md")

return (
<Box maxW="415px" maxH="300px" mx={mdSize ? "auto !important" : undefined}>
<Image {...imageProps} />
<Box
display="flex"
justifyContent="center"
maxW="415px"
maxH="300px"
mx={mdSize ? "auto !important" : undefined}
>
<Image
position={isImageBackground ? "absolute" : undefined}
{...imageProps}
/>
</Box>
)
}
Expand Down
13 changes: 13 additions & 0 deletions src/content/pages/ecosystem/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
template: ecosystem-page
path: /ecosystem
title: Ecosystem Page
seoTitle: Threshold Ecosystem
ecosystemInfo:
title: We Are Building Our Ecosystem Together
highlightedWord: "Ecosystem"
description: "The Threshold ecosystem is built around a vibrant community of
users, developers, designers, and educators."
image: /images/ecosystem-grid.svg
rowReverse: false
---
52 changes: 47 additions & 5 deletions src/templates/home-page/SectionTemplate.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { FC } from "react"
import { BoxProps, Stack } from "@chakra-ui/react"
import { BoxProps, Stack, Text } from "@chakra-ui/react"
import {
ButtonType,
CmsButtonLink,
Expand All @@ -26,21 +26,57 @@ export interface RoleTemplateProps extends BoxProps {
title: string
description: string
buttons: FooterButton[]
highlightedWord?: string
image?: ImageProps
rowReverse?: boolean
isSmallSize?: boolean
isImageBackground?: boolean
columnReverse?: boolean
preTitle?: string
}

const SectionTitleTemplate: FC<Partial<RoleTemplateProps>> = ({
title,
highlightedWord,
}) => {
return (
<H2 mt={3} color="brand.50">
{title!
.split(" ")
.map((word, index, arr) => {
return word === highlightedWord ? (
<Text
as="span"
bgGradient="linear-gradient(120.19deg, #BD30FF 3.32%, #7D00FF 95.02%)"
bgClip="text"
fontWeight="bold"
key={index}
>
{word}
</Text>
) : (
<Text as="span" color="brand.50" key={index}>
{word}
</Text>
)
})
.reduce((acc, curr, index, arr) => {
return index !== arr.length - 1 ? [...acc, curr, " "] : [...acc, curr]
}, [] as React.ReactNode[])}
</H2>
)
}

const SectionTemplate: FC<RoleTemplateProps> = ({
title,
highlightedWord,
description,
buttons = [],
image,
rowReverse,
columnReverse,
isSmallSize,
isImageBackground,
preTitle = "Get Started",
children,
...boxProps
Expand All @@ -56,9 +92,10 @@ const SectionTemplate: FC<RoleTemplateProps> = ({
<LabelMd textTransform="uppercase" color="gray.500">
{preTitle}
</LabelMd>
<H2 mt={3} color="gray.50">
{title}
</H2>
<SectionTitleTemplate
title={title}
highlightedWord={highlightedWord}
/>
{isSmallSize ? (
<BodyLg mt={10} color="gray.300">
{description}
Expand All @@ -84,7 +121,12 @@ const SectionTemplate: FC<RoleTemplateProps> = ({
})}
</Stack>
</SectionTextContainer>
{image && <SectionImage {...image} />}
{image && (
<SectionImage
imageProps={image}
isImageBackground={isImageBackground}
/>
)}
</ResponsiveStack>
{children}
</PageSection>
Expand Down
68 changes: 68 additions & 0 deletions static/images/ecosystem-grid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit dccff09

Please sign in to comment.