refactor to Section components to accept SVG prop

pull/26459/head^2
Paul Wackerow 2 years ago
parent d791e0a1a3
commit caaedf0335
No known key found for this signature in database
GPG Key ID: BB63E296FE9CAB8D
  1. 18
      src/components/UI/downloads/DownloadsSection.tsx
  2. 20
      src/components/UI/homepage/HomeSection.tsx
  3. 4
      src/pages/downloads.tsx
  4. 5
      src/pages/index.tsx

@ -1,24 +1,20 @@
import { Box, Image, Stack } from '@chakra-ui/react';
import { Box, IconProps, Stack } from '@chakra-ui/react';
import { FC } from 'react';
import { GopherHomeLinks } from '../svgs'
interface Props {
children: React.ReactNode;
id: string;
imgSrc?: string;
imgAltText?: string;
sectionTitle: string;
showGopher?: boolean;
children: React.ReactNode;
Svg?: React.FC<IconProps>;
ariaLabel?: string;
}
export const DownloadsSection: FC<Props> = ({ children, imgSrc, imgAltText, sectionTitle, id, showGopher }) => {
export const DownloadsSection: FC<Props> = ({ children, Svg, ariaLabel, sectionTitle, id, showGopher }) => {
return (
<Stack border='2px solid' borderColor='primary' id={id}>
{imgSrc || showGopher && (
{Svg && (
<Stack alignItems='center' p={4} borderBottom='2px solid' borderColor='primary'>
{/* TODO: use NextImage */}
{imgSrc && <Image src={imgSrc} alt={imgAltText} />}
{showGopher && < GopherHomeLinks/>}
<Svg aria-label={ariaLabel} />
</Stack>
)}

@ -1,35 +1,29 @@
import { Box, Image, Link, Stack, Text } from '@chakra-ui/react';
import { Box, IconProps, Link, Stack, Text } from '@chakra-ui/react';
import { FC } from 'react';
import NextLink from 'next/link';
import { GopherHomeFront } from '../svgs/';
interface Props {
imgSrc?: string;
imgAltText?: string;
sectionTitle: string;
linkLabel: string;
buttonHref: string;
children?: React.ReactNode;
showGopher?: boolean;
Svg?: React.FC<IconProps>;
ariaLabel?: string;
}
export const HomeSection: FC<Props> = ({
imgSrc,
imgAltText,
Svg,
ariaLabel,
sectionTitle,
linkLabel,
buttonHref,
showGopher,
children
}) => {
return (
<Stack border='2px solid' borderColor='primary' h='100%'>
{imgSrc || showGopher && (
{Svg && (
<Stack alignItems='center' p={4} borderBottom='2px solid' borderColor='primary'>
{/* TODO: use NextImage */}
{imgSrc && <Image src={imgSrc} alt={imgAltText} />}
{showGopher && <GopherHomeFront />}
<Svg aria-label={ariaLabel} />
</Stack>
)}
<Stack

@ -4,6 +4,7 @@ import { useState } from 'react';
import { DownloadsHero, DownloadsSection, DownloadsTable } from '../components/UI/downloads';
import { DataTable } from '../components/UI';
import { GopherDownloads } from '../components/UI/svgs'
import {
DEFAULT_BUILD_AMOUNT_TO_SHOW,
@ -54,7 +55,8 @@ const DownloadsPage: NextPage = () => {
<DownloadsSection
sectionTitle='Specific Versions'
id='specificversions'
showGopher
Svg={GopherDownloads}
ariaLabel="Gopher facing right"
>
<Stack p={4}>
<Text textStyle='quick-link-text'>

@ -1,6 +1,8 @@
import { Box, Grid, GridItem, Link, Stack, Text } from '@chakra-ui/react';
import type { NextPage } from 'next';
import { GopherHomeFront } from '../components/UI/svgs';
import {
HomeHero,
HomeSection,
@ -35,7 +37,8 @@ const HomePage: NextPage = ({}) => {
sectionTitle='What is Geth'
linkLabel='Get started with Geth'
buttonHref={`${DOCS_PAGE}/getting-started`}
showGopher
Svg={GopherHomeFront}
ariaLabel='Gopher greeting'
>
<Text fontFamily='"Inter", sans-serif' lineHeight='26px'>
Geth (go-ethereum) is a{' '}

Loading…
Cancel
Save