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

feat: integrate dynamic images on SEO pages #1557

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from
Open
16 changes: 8 additions & 8 deletions src/app/ui/bridge/BridgeExplanation.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
'use client';
import { BridgePageContainer } from '@/app/ui/bridge/BridgePage.style';
import { Link as MuiLink, Typography } from '@mui/material';
import { Typography } from '@mui/material';

const BridgeExplanationSection = () => {
return (
<BridgePageContainer>
<Typography variant="h3" marginY={2} sx={{ fontSize: '32px!important' }}>
<Typography variant="h3" marginY={2} sx={{ fontSize: '32px' }}>
What is a Blockchain / Crypto Bridge?
</Typography>
<Typography>
Expand Down Expand Up @@ -33,7 +33,7 @@ const BridgeExplanationSection = () => {
variant="h4"
marginY={2}
sx={{
fontSize: '24px!important',
fontSize: '24px',
}}
>
Here's why bridges are essential for enhancing blockchain
Expand All @@ -42,7 +42,7 @@ const BridgeExplanationSection = () => {
<Typography
variant="h4"
sx={{
fontSize: '24px!important',
fontSize: '24px',
marginTop: '4px',
marginBottom: '2px',
}}
Expand All @@ -61,7 +61,7 @@ const BridgeExplanationSection = () => {
<Typography
variant="h4"
sx={{
fontSize: '24px!important',
fontSize: '24px',
marginTop: '4px',
marginBottom: '2px',
}}
Expand All @@ -80,7 +80,7 @@ const BridgeExplanationSection = () => {
<Typography
variant="h4"
sx={{
fontSize: '24px!important',
fontSize: '24px',
marginTop: '4px',
marginBottom: '2px',
}}
Expand All @@ -99,7 +99,7 @@ const BridgeExplanationSection = () => {
<Typography
variant="h4"
sx={{
fontSize: '24px!important',
fontSize: '24px',
marginTop: '4px',
marginBottom: '2px',
}}
Expand All @@ -116,7 +116,7 @@ const BridgeExplanationSection = () => {
<Typography
variant="h4"
sx={{
fontSize: '24px!important',
fontSize: '24px',
marginTop: '4px',
marginBottom: '2px',
}}
Expand Down
4 changes: 3 additions & 1 deletion src/app/ui/bridge/BridgePage.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

import type { BoxProps } from '@mui/system';
import { Box, styled } from '@mui/system';
import type { Breakpoint } from '@mui/material/styles';

export const BridgePageContainer = styled(Box, {
shouldForwardProp: (prop) => prop !== 'active',
})<BoxProps>(({ theme }) => ({
color: theme.palette.text.primary,
maxWidth: '100%',
flexGrow: 1,
overflow: 'hidden',
position: 'relative',
borderRadius: 32,
backgroundColor: theme.palette.bgSecondary.main,
Expand Down
14 changes: 7 additions & 7 deletions src/app/ui/bridge/BridgePage.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use client';
import { Container, Stack, Typography } from '@mui/material';
import { getChainInfoData, getTokenInfoData } from '@/app/ui/bridge/utils';
import { Widget } from '@/components/Widgets/Widget';
import type { ExtendedChain, Token, TokensResponse } from '@lifi/sdk';
import HalfSizeBlock from '@/app/ui/bridge/HalfSizeBlock';
import { getChainInfoData, getTokenInfoData } from '@/app/ui/bridge/utils';
import StepsExplainerSection from './StepsExplainer';
import { Container, Stack, Typography } from '@mui/material';
import InformationCard from 'src/app/ui/bridge/InformationCard';
import BridgeExplanationSection from './BridgeExplanation';
import PopularBridgeSection from './PopularBridgeSection';
import StepsExplainerSection from './StepsExplainer';

interface BridgePageProps {
sourceChain: ExtendedChain;
Expand All @@ -33,7 +33,7 @@ const BridgePage = ({
color="text.primary"
marginY={2}
textAlign="center"
sx={{ fontSize: '40px!important' }}
sx={{ fontSize: '40px' }}
>
How to bridge from {sourceToken.symbol} on {sourceChain.name} to{' '}
{destinationToken.symbol} on {destinationChain.name}
Expand Down Expand Up @@ -61,7 +61,7 @@ const BridgePage = ({
flexWrap="wrap"
>
{[sourceChain, destinationChain].map((chain, index) => (
<HalfSizeBlock
<InformationCard
type="Blockchain"
key={`${chain.id}-${index}`}
info={{
Expand All @@ -72,7 +72,7 @@ const BridgePage = ({
/>
))}
{[sourceToken, destinationToken].map((token, index) => (
<HalfSizeBlock
<InformationCard
type="Token"
key={`${token.address}-${index}`}
info={{
Expand Down
13 changes: 13 additions & 0 deletions src/app/ui/bridge/InformationCard.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use client';

import type { BoxProps, Breakpoint } from '@mui/system';
import { styled } from '@mui/system';
import { BridgePageContainer } from './BridgePage.style';

export const InformationCardContainer = styled(BridgePageContainer, {
shouldForwardProp: (prop) => prop !== 'active',
dennyscode marked this conversation as resolved.
Show resolved Hide resolved
})<BoxProps>(({ theme }) => ({
[theme.breakpoints.up('md' as Breakpoint)]: {
maxWidth: 'calc(50% - 16px)',
},
}));
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import {
TableRow,
Typography,
} from '@mui/material';
import Image from 'next/image';
import Link from 'next/link';
import { BridgePageContainer } from '@/app/ui/bridge/BridgePage.style';
import { Box } from '@mui/system';
import Link from 'next/link';
import { InformationCardContainer } from './InformationCard.style';

function buildExplorerLink(blockExplorerUrls: string[] = [], address: string) {
if (blockExplorerUrls.length === 0) {
Expand All @@ -22,7 +21,7 @@ function buildExplorerLink(blockExplorerUrls: string[] = [], address: string) {
color="text.primary"
component={Link}
target="_blank"
href={`${blockExplorerUrls[0]}/tokens/${address}`}
href={`${blockExplorerUrls[0]}tokens/${address}`}
>
{address}
</MuiLink>
Expand All @@ -39,7 +38,7 @@ interface Data {
value: string | number | JSX.Element | JSX.Element[];
}

function HalfSizeBlock({
function InformationCard({
info,
data = [],
type,
Expand All @@ -49,7 +48,7 @@ function HalfSizeBlock({
type: 'Blockchain' | 'Token';
}) {
return (
<BridgePageContainer width={'48.5%'}>
<InformationCardContainer>
<Typography variant="h3" display="flex" alignItems="center">
{info.logoURI && (
<Box display="flex" marginRight={2}>
Expand All @@ -63,18 +62,20 @@ function HalfSizeBlock({
)}
{info.name} - {type} Information
</Typography>
<Table>
<Table
sx={(theme) => ({ tableLayout: 'fixed', marginTop: theme.spacing(1) })}
>
<TableBody>
{data.map(({ label, value }, index) => (
<TableRow key={index}>
<TableCell>{label}</TableCell>
<TableCell style={{ width: '30%' }}>{label}</TableCell>
<TableCell>{value}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</BridgePageContainer>
</InformationCardContainer>
);
}

export default HalfSizeBlock;
export default InformationCard;
25 changes: 25 additions & 0 deletions src/app/ui/bridge/StepDetail.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'use client';

import type { BoxProps, Breakpoint } from '@mui/system';
import { Box, styled } from '@mui/system';

interface StepDetailContainerProps {
imgWidth: number;
}

export const StepDetailContainer = styled(Box, {
shouldForwardProp: (prop) => prop !== 'imgWidth',
dennyscode marked this conversation as resolved.
Show resolved Hide resolved
})<StepDetailContainerProps>(({ theme, imgWidth }) => ({
display: 'flex',
flexDirection: 'column',
gap: theme.spacing(3),

[theme.breakpoints.up('lg' as Breakpoint)]: {
gap: theme.spacing(6),
},
}));

export const StepDetailInfo = styled(Box)<BoxProps>(({ theme }) => ({
display: 'flex',
minWidth: '50%',
}));
52 changes: 52 additions & 0 deletions src/app/ui/bridge/StepDetail.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
'use client';
import { Box, Typography } from '@mui/material';
import Image from 'next/image';
import type { ReactElement } from 'react';
import { StepDetailContainer } from './StepDetail.style';

const WIDGET_AMOUNT = 3;

interface StepDetailImageProps {
imgUrl: string;
width: number;
height: number;
alt: string;
}

interface StepDetailProps {
title: string;
description: string;
img: StepDetailImageProps;
content?: ReactElement;
}

const StepDetail = ({ title, description, img, content }: StepDetailProps) => {
return (
<StepDetailContainer
sx={(theme) => ({ marginTop: theme.spacing(4) })}
imgWidth={img.width}
>
<Box>
<Typography variant="h4" marginY={2} sx={{ fontSize: '24p' }}>
{title}
</Typography>
<Typography>{description}</Typography>
{content}
</Box>
<Image
src={img.imgUrl}
alt={img.alt}
width={img.width}
height={img.height}
style={{
margin: 'auto',
maxWidth: '100%',
height: 'auto',
borderRadius: '12px',
}}
/>
</StepDetailContainer>
);
};

export default StepDetail;
Loading
Loading