Skip to content

Commit

Permalink
Replace chakra icon props with tw classes
Browse files Browse the repository at this point in the history
  • Loading branch information
JunichiSugiura committed Dec 20, 2024
1 parent be1a021 commit 17c204c
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 40 deletions.
4 changes: 2 additions & 2 deletions packages/keychain/src/components/DeployController.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export function DeployController({
return (
<Container
variant="expanded"
icon={<WandIcon fontSize="5xl" variant="line" />}
icon={<WandIcon variant="line" size="lg" />}
title="Deploy Controller"
description="This will initialize your controller on the new network"
>
Expand Down Expand Up @@ -199,7 +199,7 @@ export function DeployController({
return (
<Container
variant="expanded"
icon={<CheckIcon fontSize="5xl" />}
icon={<CheckIcon size="lg" />}
title="Success!"
description={`Your controller has been deployed on ${chainName}`}
>
Expand Down
18 changes: 5 additions & 13 deletions packages/keychain/src/components/ErrorAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
CopyIcon,
CheckIcon,
ErrorAlertIcon,
ErrorAlertIconProps,
} from "@cartridge/ui-next";
import {
Text,
Expand All @@ -19,12 +20,7 @@ import {
Divider,
} from "@chakra-ui/react";
import { motion } from "framer-motion";
import React, {
ComponentProps,
ReactElement,
useEffect,
useState,
} from "react";
import React, { ReactElement, useEffect, useState } from "react";
import { ErrorCode } from "@cartridge/account-wasm/controller";
import { ControllerError } from "@/utils/connection";
import { useConnection } from "@/hooks/connection";
Expand Down Expand Up @@ -75,11 +71,7 @@ export function ErrorAlert({
<HStack alignItems="flex-start">
{variant && (
<ErrorAlertIcon
variant={
variant as ComponentProps<
typeof ErrorAlertIcon
>["variant"]
}
variant={variant as ErrorAlertIconProps["variant"]}
size="xs"
/>
)}
Expand Down Expand Up @@ -122,9 +114,9 @@ export function ErrorAlert({
aria-label="Copy stacktrace"
icon={
copied ? (
<CheckIcon fontSize="xs" color="black" />
<CheckIcon size="xs" className="text-[black]" />
) : (
<CopyIcon fontSize="xs" color="black" />
<CopyIcon size="xs" className="text-[black]" />
)
}
onClick={() => {
Expand Down
4 changes: 2 additions & 2 deletions packages/keychain/src/components/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function ErrorPage({ error }: { error: Error }) {
variant="expanded"
title="Uh oh!"
description="Something went wrong"
icon={<AlertIcon fontSize={48} />}
icon={<AlertIcon size="lg" />}
>
<Content gap={4}>
<HStack
Expand Down Expand Up @@ -78,7 +78,7 @@ export function ErrorPage({ error }: { error: Error }) {
<Link href={CARTRIDGE_DISCORD_LINK} isExternal>
<HStack>
<Text fontSize="sm">Cartridge Discord</Text>
<ExternalIcon fontSize="xl" />
<ExternalIcon size="sm" />
</HStack>
</Link>
</HStack>
Expand Down
4 changes: 3 additions & 1 deletion packages/keychain/src/components/Fees.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ function LineItem({
) : (
<HStack gap={0}>
{variant && <ErrorAlertIcon variant={variant} />}
{value !== "FREE" && <EthereumIcon color="text.primary" />}
{value !== "FREE" && (
<EthereumIcon className="text-secondary-foreground" />
)}
<Text fontSize={13}>{value}</Text>
</HStack>
)}
Expand Down
10 changes: 3 additions & 7 deletions packages/keychain/src/components/Funding/DepositEth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,8 @@ function DepositEthInner({ onComplete, onBack }: DepositEthProps) {
colorScheme="colorful"
onClick={() => onConnect(c)}
>
{c.name === "argentX" && (
<ArgentIcon fontSize={20} />
)}
{c.name === "braavos" && (
<BraavosIcon fontSize={20} />
)}
{c.name === "argentX" && <ArgentIcon size="sm" />}
{c.name === "braavos" && <BraavosIcon size="sm" />}
{c.name}
</Button>
))}
Expand All @@ -214,7 +210,7 @@ function DepositEthInner({ onComplete, onBack }: DepositEthProps) {
</Text>
)}
<Button w="full" gap="5px" onClick={onCopy}>
<CopyIcon fontSize={20} /> copy address
<CopyIcon size="sm" /> copy address
</Button>
<HStack>
<Text color="text.secondary" fontSize="14px">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function SessionConsent({
)}
<Text color="text.secondary" fontSize="xs" fontWeight="bold">
Authorize{" "}
{/* <LockIcon fontSize="md" color="text.secondaryAccent" mr={0.5} /> */}
{/* <LockIcon className="text-accent-foreground mr-0.5" /> */}
<Text as="span" color="text.secondaryAccent" fontWeight="bold">
{origin}
</Text>{" "}
Expand Down
2 changes: 1 addition & 1 deletion packages/keychain/src/components/failure.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function Failure() {
alignItems="center"
>
Discord
<ExternalIcon />
<ExternalIcon size="sm" />
</UILink>
</Text>
</>
Expand Down
2 changes: 1 addition & 1 deletion packages/keychain/src/components/session/ContractCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export function ContractCard({
);
}

export function humanizeString(str: string): string {
function humanizeString(str: string): string {
return (
str
// Convert from camelCase or snake_case
Expand Down
12 changes: 7 additions & 5 deletions packages/ui-next/src/components/icons/error-alert-icon.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { cn } from "@/utils";
import { InfoIcon, WarningIcon, AlertIcon as AlertIconRaw } from "./utility";

export type ErrorAlertIconProps = {
variant: "info" | "warning" | "error";
size?: "xs" | "default";
className?: string;
};

export function ErrorAlertIcon({
variant,
size = "default",
className,
}: {
variant: "info" | "warning" | "error";
size?: "xs" | "default";
className?: string;
}) {
}: ErrorAlertIconProps) {
switch (variant) {
case "info":
return (
Expand Down
10 changes: 3 additions & 7 deletions packages/ui-next/src/components/network.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,11 @@ export function Network({ chainId }: { chainId: string }) {
{(() => {
switch (chainId) {
case constants.StarknetChainId.SN_MAIN:
return <StarknetColorIcon fontSize="xl" />;
return <StarknetColorIcon />;
case constants.StarknetChainId.SN_SEPOLIA:
return <StarknetIcon fontSize="xl" />;
return <StarknetIcon />;
default:
return isSlotChain(chainId) ? (
<SlotIcon fontSize="xl" />
) : (
<QuestionIcon fontSize="xl" />
);
return isSlotChain(chainId) ? <SlotIcon /> : <QuestionIcon />;
}
})()}
<div>{getChainName(chainId)}</div>
Expand Down

0 comments on commit 17c204c

Please sign in to comment.