From bcd8dab3841f5c4500ab223867885ecbf615626a Mon Sep 17 00:00:00 2001 From: candicecz Date: Thu, 19 Sep 2024 15:44:35 -0400 Subject: [PATCH] style: knowledge center hero banner #258 --- src/components/page-header/index.tsx | 125 -------------------- src/components/page-header/styles.ts | 80 ------------- src/pages/knowledge-center/[[...slug]].tsx | 14 +-- src/pages/news.tsx | 56 ++++++--- src/views/docs/components/HeroBanner.tsx | 65 ++++++++++ src/views/home/components/HeroBanner.tsx | 131 +++++++++++++++------ 6 files changed, 205 insertions(+), 266 deletions(-) delete mode 100644 src/components/page-header/index.tsx delete mode 100644 src/components/page-header/styles.ts create mode 100644 src/views/docs/components/HeroBanner.tsx diff --git a/src/components/page-header/index.tsx b/src/components/page-header/index.tsx deleted file mode 100644 index c0de87be..00000000 --- a/src/components/page-header/index.tsx +++ /dev/null @@ -1,125 +0,0 @@ -import React from 'react'; -import { PageContent } from 'src/components/page-container'; -import { - Box, - Flex, - FlexProps, - Heading, - HeadingProps, - Text, - TextProps, -} from '@chakra-ui/react'; -import { theme } from 'src/theme'; -import { StyledSection } from './styles'; - -interface PageHeaderProps extends FlexProps { - bg?: string; - bgImg?: string; - body?: string[]; - bodyProps?: TextProps; - children?: React.ReactNode; - color?: string; - subtitle?: string; - subtitleProps?: TextProps; - title?: string; - titleProps?: HeadingProps; -} - -export const PageHeader: React.FC = ({ - bg, - bgImg, - body, - bodyProps, - children, - color, - subtitle, - subtitleProps, - title, - titleProps, - ...props -}) => { - return ( - <> - - {/* Header section */} - - - {title && ( - - {title} - - )} - {subtitle && ( - - {subtitle} - - )} - {body && - body.length > 0 && - body.map((text, i) => { - return ( - - {text} - - ); - })} - - {children && ( - - - {children} - - - )} - - - - ); -}; diff --git a/src/components/page-header/styles.ts b/src/components/page-header/styles.ts deleted file mode 100644 index 78d22b04..00000000 --- a/src/components/page-header/styles.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { - Box, - BoxProps, - ButtonGroup, - ButtonGroupProps, - Flex, - FlexProps, - Heading, - HeadingProps, - keyframes, - Text, - TextProps, -} from '@chakra-ui/react'; -import styled from '@emotion/styled'; - -// Styles for the home page -export const fade = keyframes` - 0% { - opacity: 0; - transform: translateY(30px); - } - 100% { - opacity: 1; - transform: translateY(0px); - } -`; - -export const StyledSection = styled(Flex)(props => ({})); - -StyledSection.defaultProps = { - as: 'section', - w: '100%', - px: [2, 4, 6], - py: [2, 4, 8], - flexWrap: ['wrap', 'wrap', 'nowrap'], - flexDirection: ['column', 'column', 'row'], - alignItems: ['flex-start', 'center', 'center'], - justifyContent: ['center', 'center', 'center', 'space-between'], - maxWidth: ['100%', '100%', '1280px'], -}; - -export const StyledSectionHeading = styled(Heading)( - props => ({}), -); - -StyledSectionHeading.defaultProps = { - as: 'h2', - color: 'text.body', - fontWeight: 'regular', -}; - -export const StyledText = styled(Text)(props => ({})); - -StyledText.defaultProps = { - mt: 4, - fontSize: ['lg'], - fontWeight: 'light', - lineHeight: 'short', -}; - -export const StyledBody = styled(Box)(props => ({})); - -StyledBody.defaultProps = { - maxWidth: ['unset', 'unset', '410px'], - textAlign: ['start', 'center', 'start'], -}; - -export const StyledSectionButtonGroup = styled(ButtonGroup)( - props => ({}), -); - -StyledSectionButtonGroup.defaultProps = { - flexWrap: ['wrap', 'nowrap'], - my: [6, 6], - spacing: [0, 4], - w: '100%', - justifyContent: ['flex-start', 'center', 'flex-start'], - // max size for buttons in button group - sx: { a: { maxWidth: 300 } }, -}; diff --git a/src/pages/knowledge-center/[[...slug]].tsx b/src/pages/knowledge-center/[[...slug]].tsx index 86defc47..16f1d4c2 100644 --- a/src/pages/knowledge-center/[[...slug]].tsx +++ b/src/pages/knowledge-center/[[...slug]].tsx @@ -13,7 +13,6 @@ import { import { Link } from 'src/components/link'; import type { GetStaticProps, NextPage } from 'next'; import { PageContainer, PageContent } from 'src/components/page-container'; -import { PageHeader } from 'src/components/page-header'; import DOCUMENTATION_COPY from 'configs/docs.json'; import { Error } from 'src/components/error'; import axios from 'axios'; @@ -32,6 +31,7 @@ import MainContent, { import Empty from 'src/components/empty'; import IntegrationMain from 'src/views/integration/components/Main'; import { DocsSearchBar } from 'src/views/docs/components/SearchBar'; +import { HeroBanner } from 'src/views/docs/components/HeroBanner'; export interface DocumentationByCategories { id: number; @@ -130,18 +130,12 @@ const Docs: NextPage<{ py={0} disableSearchBar > - + = props => { py={0} disableSearchBar > - + backgroundSize='cover' + px='0px' + minHeight='unset' + > + + + + + = ({ + title, + subtitle, + body, + children, +}) => { + return ( + + + A complex network of interconnected lines and nodes, resembling a molecular or neural network structure. The image features various shades of blue and white, with nodes of different sizes connected by thin lines, creating a web-like pattern. + + + + + + + {children} + + ); +}; diff --git a/src/views/home/components/HeroBanner.tsx b/src/views/home/components/HeroBanner.tsx index 103326d6..ee8352c5 100644 --- a/src/views/home/components/HeroBanner.tsx +++ b/src/views/home/components/HeroBanner.tsx @@ -1,4 +1,13 @@ -import { Box, Flex, Heading, Image, Text, VStack } from '@chakra-ui/react'; +import { + Box, + Flex, + FlexProps, + Heading, + Image, + StackProps, + Text, + VStack, +} from '@chakra-ui/react'; interface HeroBannerProps { title?: string; @@ -14,18 +23,7 @@ export const HeroBanner: React.FC = ({ children, }) => { return ( - + {/* Nodes background image */} = ({ /> {/* Headings */} - - {title && ( - - {title} - - )} - {subtitle && ( - - {subtitle} - - )} - {body && {body}} - + {children} + + ); +}; + +interface HeroBannerContainerProps extends FlexProps {} +export const HeroBannerContainer = ({ + children, + ...rest +}: HeroBannerContainerProps) => { + return ( + + {children} ); }; + +interface HeroBannerTextProps extends StackProps { + title?: HeroBannerProps['title']; + subtitle?: HeroBannerProps['subtitle']; + body?: HeroBannerProps['body']; +} +export const HeroBannerText = ({ + title, + subtitle, + body, + children, + ...rest +}: HeroBannerTextProps) => { + return ( + + {title && ( + + {title} + + )} + {subtitle && ( + + {subtitle} + + )} + {body && ( + + {body} + + )} + + {children} + + ); +};