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

chore: components dedup #320

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions src/components/animation/SmallSpinner.tsx

This file was deleted.

81 changes: 0 additions & 81 deletions src/components/animation/Spinner.module.css

This file was deleted.

25 changes: 0 additions & 25 deletions src/components/animation/Spinner.tsx

This file was deleted.

5 changes: 2 additions & 3 deletions src/components/banner/WarningBanner.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Image from 'next/image';
import { WarningIcon } from '@hyperlane-xyz/widgets';
import { PropsWithChildren, ReactNode } from 'react';
import WarningIcon from '../../images/icons/warning.svg';

export function WarningBanner({
isVisible,
Expand All @@ -21,7 +20,7 @@ export function WarningBanner({
} overflow-hidden transition-all duration-500 ${className}`}
>
<div className="flex items-center gap-2">
<Image src={WarningIcon} width={20} height={20} alt="Warning:" />
<WarningIcon width={20} height={20} />
{children}
</div>
<button
Expand Down
4 changes: 2 additions & 2 deletions src/components/buttons/CopyButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CheckmarkIcon } from '@hyperlane-xyz/widgets';
import Image from 'next/image';
import { useState } from 'react';
import CheckmarkIcon from '../../images/icons/checkmark.svg';
import CopyIcon from '../../images/icons/copy-stack.svg';
import { tryClipboardSet } from '../../utils/clipboard';

Expand Down Expand Up @@ -32,7 +32,7 @@ export function CopyButton({ width, height, copyValue, classes }: Props) {
} hover:opacity-70 active:opacity-90 ${classes}`}
>
{showCheckmark ? (
<Image src={CheckmarkIcon} width={width} height={height} alt="" />
<CheckmarkIcon width={width} height={height} />
) : (
<Image src={CopyIcon} width={width} height={height} alt="" />
)}
Expand Down
72 changes: 0 additions & 72 deletions src/components/layout/Modal.tsx

This file was deleted.

20 changes: 19 additions & 1 deletion src/consts/warpRoutes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,23 @@
# These configs will be merged with the warp routes in the configured registry
# The input here is typically the output of the Hyperlane CLI warp deploy command
---
tokens: []
tokens:
- addressOrDenom: '0x78fe869f19f917fde4192c51c446Fbd3721788ee'
chainName: alfajores
connections:
- token: ethereum|sepolia|0xeDF994D49F865D3a4bd6F74AeFbe1DcCAE7204F2
decimals: 18
logoURI: /deployments/warp_routes/ETH/logo.svg
name: Ether
standard: EvmHypSynthetic
symbol: ETH
- addressOrDenom: '0xeDF994D49F865D3a4bd6F74AeFbe1DcCAE7204F2'
chainName: sepolia
connections:
- token: ethereum|alfajores|0x78fe869f19f917fde4192c51c446Fbd3721788ee
decimals: 18
logoURI: /deployments/warp_routes/ETH/logo.svg
name: Ether
standard: EvmHypNative
symbol: ETH
options: {}
4 changes: 2 additions & 2 deletions src/features/WarpContextInitGate.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ColorPalette, SpinnerIcon } from '@hyperlane-xyz/widgets';
import { PropsWithChildren, useState } from 'react';
import { Spinner } from '../components/animation/Spinner';
import { useTimeout } from '../utils/timeout';
import { useReadyMultiProvider } from './chains/hooks';

Expand All @@ -21,7 +21,7 @@ export function WarpContextInitGate({ children }: PropsWithChildren<unknown>) {
} else {
return (
<div className="flex h-screen items-center justify-center bg-primary-500">
<Spinner classes="opacity-50" white />
<SpinnerIcon width={80} height={80} color={ColorPalette.White} className="opacity-50" />
</div>
);
}
Expand Down
5 changes: 2 additions & 3 deletions src/features/chains/ChainSelectField.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { ChevronIcon } from '@hyperlane-xyz/widgets';
import { useField, useFormikContext } from 'formik';
import Image from 'next/image';
import { useState } from 'react';
import { ChainLogo } from '../../components/icons/ChainLogo';
import ChevronIcon from '../../images/icons/chevron-down.svg';
import { TransferFormValues } from '../transfer/types';
import { ChainSelectListModal } from './ChainSelectModal';
import { useChainDisplayName } from './hooks';
Expand Down Expand Up @@ -55,7 +54,7 @@ export function ChainSelectField({ name, label, chains, onChange, disabled }: Pr
{displayName}
</div>
</div>
<Image src={ChevronIcon} width={12} height={8} alt="" />
<ChevronIcon width={12} height={8} direction="s" />
</button>
<ChainSelectListModal
isOpen={isModalOpen}
Expand Down
10 changes: 8 additions & 2 deletions src/features/chains/ChainSelectModal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Modal } from '@hyperlane-xyz/widgets';
import { useMemo } from 'react';
import { ChainLogo } from '../../components/icons/ChainLogo';
import { Modal } from '../../components/layout/Modal';
import { useMultiProvider } from './hooks';
import { getChainDisplayName } from './utils';

Expand All @@ -27,7 +27,13 @@ export function ChainSelectListModal({
};

return (
<Modal isOpen={isOpen} title="Select Chain" close={close}>
<Modal
isOpen={isOpen}
close={close}
title="Select Chain"
panelClassname="p-4 max-w-xs"
showCloseButton
>
<div className="mt-2 flex flex-col space-y-1">
{sortedChains.map((c) => (
<button
Expand Down
17 changes: 10 additions & 7 deletions src/features/tokens/SelectTokenIdField.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { ChevronIcon, Modal, SpinnerIcon } from '@hyperlane-xyz/widgets';
import { useField } from 'formik';
import Image from 'next/image';
import { useState } from 'react';
import { Spinner } from '../../components/animation/Spinner';
import { Modal } from '../../components/layout/Modal';
import ChevronIcon from '../../images/icons/chevron-down.svg';

type Props = {
name: string;
Expand Down Expand Up @@ -36,7 +33,7 @@ export function SelectTokenIdField({ name, disabled }: Props) {
{tokenId ? tokenId : 'Select Token Id'}
</span>
</div>
<Image src={ChevronIcon} width={12} height={8} alt="" />
<ChevronIcon width={12} height={8} direction="s" />
</button>
<SelectTokenIdModal
isOpen={isModalOpen}
Expand Down Expand Up @@ -70,11 +67,17 @@ export function SelectTokenIdModal({
};

return (
<Modal isOpen={isOpen} title="Select Token Id" close={close}>
<Modal
isOpen={isOpen}
title="Select Token Id"
close={close}
showCloseButton
panelClassname="p-4"
>
<div className="mt-2 flex flex-col space-y-1">
{isLoading ? (
<div className="my-24 flex flex-col items-center">
<Spinner />
<SpinnerIcon width={80} height={80} />
<h3 className="mt-5 text-sm text-gray-500">Finding token IDs</h3>
</div>
) : tokenIds && tokenIds.length !== 0 ? (
Expand Down
5 changes: 3 additions & 2 deletions src/features/tokens/TokenListModal.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { IToken } from '@hyperlane-xyz/sdk';
import { Modal } from '@hyperlane-xyz/widgets';
import Image from 'next/image';
import { useMemo, useState } from 'react';
import { TokenIcon } from '../../components/icons/TokenIcon';
import { TextInput } from '../../components/input/TextField';
import { Modal } from '../../components/layout/Modal';
import { config } from '../../consts/config';
import InfoIcon from '../../images/icons/info-circle.svg';
import { useMultiProvider } from '../chains/hooks';
Expand Down Expand Up @@ -40,7 +40,8 @@ export function TokenListModal({
isOpen={isOpen}
title="Select Token"
close={onClose}
width="max-w-100 sm:max-w-[31rem] min-h-[24rem]"
panelClassname="p-4 max-w-100 sm:max-w-[31rem] min-h-[24rem]"
showCloseButton
>
<TextInput
value={search}
Expand Down
Loading
Loading