mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-13 19:46:39 +00:00
refactor to Section components to accept SVG prop
This commit is contained in:
parent
d791e0a1a3
commit
caaedf0335
4 changed files with 21 additions and 26 deletions
|
|
@ -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 { FC } from 'react';
|
||||||
|
|
||||||
import { GopherHomeLinks } from '../svgs'
|
|
||||||
interface Props {
|
interface Props {
|
||||||
children: React.ReactNode;
|
|
||||||
id: string;
|
id: string;
|
||||||
imgSrc?: string;
|
|
||||||
imgAltText?: string;
|
|
||||||
sectionTitle: 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 (
|
return (
|
||||||
<Stack border='2px solid' borderColor='primary' id={id}>
|
<Stack border='2px solid' borderColor='primary' id={id}>
|
||||||
{imgSrc || showGopher && (
|
{Svg && (
|
||||||
<Stack alignItems='center' p={4} borderBottom='2px solid' borderColor='primary'>
|
<Stack alignItems='center' p={4} borderBottom='2px solid' borderColor='primary'>
|
||||||
{/* TODO: use NextImage */}
|
<Svg aria-label={ariaLabel} />
|
||||||
{imgSrc && <Image src={imgSrc} alt={imgAltText} />}
|
|
||||||
{showGopher && < GopherHomeLinks/>}
|
|
||||||
</Stack>
|
</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 { FC } from 'react';
|
||||||
import NextLink from 'next/link';
|
import NextLink from 'next/link';
|
||||||
|
|
||||||
import { GopherHomeFront } from '../svgs/';
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
imgSrc?: string;
|
|
||||||
imgAltText?: string;
|
|
||||||
sectionTitle: string;
|
sectionTitle: string;
|
||||||
linkLabel: string;
|
linkLabel: string;
|
||||||
buttonHref: string;
|
buttonHref: string;
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
showGopher?: boolean;
|
Svg?: React.FC<IconProps>;
|
||||||
|
ariaLabel?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const HomeSection: FC<Props> = ({
|
export const HomeSection: FC<Props> = ({
|
||||||
imgSrc,
|
Svg,
|
||||||
imgAltText,
|
ariaLabel,
|
||||||
sectionTitle,
|
sectionTitle,
|
||||||
linkLabel,
|
linkLabel,
|
||||||
buttonHref,
|
buttonHref,
|
||||||
showGopher,
|
|
||||||
children
|
children
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<Stack border='2px solid' borderColor='primary' h='100%'>
|
<Stack border='2px solid' borderColor='primary' h='100%'>
|
||||||
{imgSrc || showGopher && (
|
{Svg && (
|
||||||
<Stack alignItems='center' p={4} borderBottom='2px solid' borderColor='primary'>
|
<Stack alignItems='center' p={4} borderBottom='2px solid' borderColor='primary'>
|
||||||
{/* TODO: use NextImage */}
|
<Svg aria-label={ariaLabel} />
|
||||||
{imgSrc && <Image src={imgSrc} alt={imgAltText} />}
|
|
||||||
{showGopher && <GopherHomeFront />}
|
|
||||||
</Stack>
|
</Stack>
|
||||||
)}
|
)}
|
||||||
<Stack
|
<Stack
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { useState } from 'react';
|
||||||
|
|
||||||
import { DownloadsHero, DownloadsSection, DownloadsTable } from '../components/UI/downloads';
|
import { DownloadsHero, DownloadsSection, DownloadsTable } from '../components/UI/downloads';
|
||||||
import { DataTable } from '../components/UI';
|
import { DataTable } from '../components/UI';
|
||||||
|
import { GopherDownloads } from '../components/UI/svgs'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
DEFAULT_BUILD_AMOUNT_TO_SHOW,
|
DEFAULT_BUILD_AMOUNT_TO_SHOW,
|
||||||
|
|
@ -54,7 +55,8 @@ const DownloadsPage: NextPage = () => {
|
||||||
<DownloadsSection
|
<DownloadsSection
|
||||||
sectionTitle='Specific Versions'
|
sectionTitle='Specific Versions'
|
||||||
id='specificversions'
|
id='specificversions'
|
||||||
showGopher
|
Svg={GopherDownloads}
|
||||||
|
ariaLabel="Gopher facing right"
|
||||||
>
|
>
|
||||||
<Stack p={4}>
|
<Stack p={4}>
|
||||||
<Text textStyle='quick-link-text'>
|
<Text textStyle='quick-link-text'>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import { Box, Grid, GridItem, Link, Stack, Text } from '@chakra-ui/react';
|
import { Box, Grid, GridItem, Link, Stack, Text } from '@chakra-ui/react';
|
||||||
import type { NextPage } from 'next';
|
import type { NextPage } from 'next';
|
||||||
|
|
||||||
|
import { GopherHomeFront } from '../components/UI/svgs';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
HomeHero,
|
HomeHero,
|
||||||
HomeSection,
|
HomeSection,
|
||||||
|
|
@ -35,7 +37,8 @@ const HomePage: NextPage = ({}) => {
|
||||||
sectionTitle='What is Geth'
|
sectionTitle='What is Geth'
|
||||||
linkLabel='Get started with Geth'
|
linkLabel='Get started with Geth'
|
||||||
buttonHref={`${DOCS_PAGE}/getting-started`}
|
buttonHref={`${DOCS_PAGE}/getting-started`}
|
||||||
showGopher
|
Svg={GopherHomeFront}
|
||||||
|
ariaLabel='Gopher greeting'
|
||||||
>
|
>
|
||||||
<Text fontFamily='"Inter", sans-serif' lineHeight='26px'>
|
<Text fontFamily='"Inter", sans-serif' lineHeight='26px'>
|
||||||
Geth (go-ethereum) is a{' '}
|
Geth (go-ethereum) is a{' '}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue