Skip to content

Commit

Permalink
chore: upgrade Next.js links and image components
Browse files Browse the repository at this point in the history
  • Loading branch information
yerdua committed Sep 18, 2023
1 parent 542108e commit 271cecc
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/components/buttons/BackToListButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const BackToListButton = ({ mode }: Props) => {
const chainId = useChainId();
const href = appendChainIdToLink(`/${mode}`, chainId);
return (
<Link href={href}>
<Link href={href} legacyBehavior>
<div className="flex flex-row items-center rounded-[16px] gap-2 cursor-pointer">
<ThemedIcon name="arrow" alt="open" classes="rotate-[90deg]" height={24} width={24} />
<span className="font-medium text-[14px] text-color-secondary">
Expand Down
11 changes: 10 additions & 1 deletion src/components/icons/IndicatorIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ interface IndicatorIconProps {
}
export const IndicatorIcon = ({ classes }: IndicatorIconProps) => (
<span className={`${classes} inline-flex`}>
<Image className={classes} src={IndicatorSVG} alt="Connection indicator" width={8} height={8} />
<Image
src={IndicatorSVG}
alt="Connection indicator"
width={8}
height={8}
style={{
maxWidth: '100%',
height: 'auto',
}}
/>
</span>
);
5 changes: 4 additions & 1 deletion src/components/icons/ThemedIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ export const ThemedIcon = ({
width={width}
height={height}
onClick={onClick}
layout={fill ? 'fill' : 'intrinsic'}
style={{
maxWidth: '100%',
height: 'auto',
}}
/>
</span>
</OpacityTransition>
Expand Down
7 changes: 5 additions & 2 deletions src/components/icons/TokenIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Image from 'next/image';
import Image from "next/image";
import { OpacityTransition } from 'src/components/transitions/OpacityTransition';
import CeloIcon from 'src/images/icons/token-celo.svg';
import stCeloIcon from 'src/images/icons/token-stcelo.svg';
Expand All @@ -25,7 +25,10 @@ export const TokenIcon = ({ token, quality = 100, width = 32, height = 32 }: Tok
quality={quality}
width={width}
height={height}
/>
style={{
maxWidth: "100%",
height: "auto"
}} />
</span>
</OpacityTransition>
);
2 changes: 1 addition & 1 deletion src/components/list/row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const Row = (props: PropsWithChildren<Props>) => {
href={props.href}
target={props.href?.startsWith('http') ? '_blank' : '_self'}
rel="noreferrer"
>
legacyBehavior>
<ThemedIcon name="arrow" alt="open" classes="rotate-[270deg] cursor-pointer" />
</Link>
</span>
Expand Down
13 changes: 11 additions & 2 deletions src/features/swap/utils/toast.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Image from 'next/image';
import Image from "next/image";
import { PropsWithChildren } from 'react';
import { ThemedIcon } from 'src/components/icons/ThemedIcon';
import { TokenIcon } from 'src/components/icons/TokenIcon';
Expand All @@ -21,7 +21,16 @@ export const showStakingToast = (amount: StCelo) =>

export const showUnstakingToast = () =>
showToast(
<Image src={Clock} alt="Clock" quality={100} width={32} height={32} />,
<Image
src={Clock}
alt="Clock"
quality={100}
width={32}
height={32}
style={{
maxWidth: "100%",
height: "auto"
}} />,
<ToastContent>You started unstaking, funds available in 3 days.</ToastContent>
);

Expand Down
10 changes: 6 additions & 4 deletions src/layout/AppLayout/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ export const Header = ({ isConnectPage = true }: HeaderProps) => {

return (
<header className="px-base w-full h-[80px] flex items-center justify-between">
<Link href="/stake">
<a className={`flex items-center ${isConnectPage ? 'invisible' : ''}`}>
<ThemedIcon name="logo" alt="StakedCelo Home" quality={100} width={40} height={40} />
</a>
<Link
href="/stake"
className={`flex items-center ${isConnectPage ? 'invisible' : ''}`}>

<ThemedIcon name="logo" alt="StakedCelo Home" quality={100} width={40} height={40} />

</Link>
{isConnected && <WalletButton />}
<ThemeToggle isConnectPage={isConnectPage} />
Expand Down

0 comments on commit 271cecc

Please sign in to comment.