Skip to content

Commit 3eef910

Browse files
committed
[Dashboard] Remove HStack (#4749)
## Problem solved Short description of the bug fixed or feature added <!-- start pr-codex --> --- ## PR-Codex overview This PR introduces changes to replace `HStack` with `div` using flex classes in various components for better styling consistency. ### Detailed summary - Replaced `HStack` with `div` using flex classes in multiple components for styling consistency. > The following files were skipped due to too many changes: `apps/dashboard/src/components/smart-wallets/SponsorshipPolicies/index.tsx` > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 3d52dd4 commit 3eef910

File tree

14 files changed

+62
-67
lines changed

14 files changed

+62
-67
lines changed

apps/dashboard/.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ module.exports = {
5656
"MenuGroup",
5757
"MenuItem",
5858
"VStack",
59+
"HStack",
5960
// also the types
6061
"ButtonProps",
6162
"BadgeProps",

apps/dashboard/src/app/team/[team_slug]/(team)/~/usage/UsagePage.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import { Spinner } from "@/components/ui/Spinner/Spinner";
44
import { useAccount, useAccountUsage } from "@3rdweb-sdk/react/hooks/useApi";
5-
import { HStack } from "@chakra-ui/react";
65
import { BillingPeriod } from "components/settings/Account/Billing/Period";
76
import { BillingPlan } from "components/settings/Account/Billing/Plan";
87
import { Usage } from "components/settings/Account/Usage";
@@ -24,14 +23,10 @@ export const SettingsUsagePage = () => {
2423
<div className="flex flex-col gap-8">
2524
<div className="flex flex-col">
2625
<h1 className="font-semibold text-3xl tracking-tight mb-2">Usage</h1>
27-
<HStack
28-
justifyContent="space-between"
29-
flexDir={{ base: "column", lg: "row" }}
30-
alignItems={{ base: "flex-start", lg: "center" }}
31-
>
26+
<div className="flex flex-col lg:flex-row justify-between items-start lg:items-center">
3227
<BillingPlan account={account} />
3328
<BillingPeriod account={account} usage={usageQuery.data} />
34-
</HStack>
29+
</div>
3530
</div>
3631

3732
<Usage usage={usageQuery.data} usagePending={usageQuery.isPending} />

apps/dashboard/src/components/onboarding/Steps.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
useApiKeys,
88
} from "@3rdweb-sdk/react/hooks/useApi";
99
import { useLoggedInUser } from "@3rdweb-sdk/react/hooks/useLoggedInUser";
10-
import { Flex, HStack, useBreakpointValue } from "@chakra-ui/react";
10+
import { Flex, useBreakpointValue } from "@chakra-ui/react";
1111
import { ChakraNextImage } from "components/Image";
1212
import { OPSponsoredChains } from "constants/chains";
1313
import { useTrack } from "hooks/analytics/useTrack";
@@ -282,7 +282,7 @@ export const OnboardingSteps: React.FC<OnboardingStepsProps> = ({
282282
>
283283
<Heading size="title.sm">{title}</Heading>
284284
<Text>{description}</Text>
285-
<HStack mt={4} alignItems="center">
285+
<div className="flex flex-row mt-4 items-center">
286286
{isLoggedIn ? (
287287
<Button
288288
size="sm"
@@ -308,7 +308,7 @@ export const OnboardingSteps: React.FC<OnboardingStepsProps> = ({
308308
Skip
309309
</Button>
310310
)}
311-
</HStack>
311+
</div>
312312
</div>
313313
{rightImageDark && !isMobile && theme === "dark" && (
314314
<ChakraNextImage src={rightImageDark} alt={""} w="50%" priority />

apps/dashboard/src/components/settings/Account/AccountForm.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { cn } from "@/lib/utils";
22
import { type Account, useUpdateAccount } from "@3rdweb-sdk/react/hooks/useApi";
3-
import { Flex, FormControl, HStack, Input } from "@chakra-ui/react";
3+
import { Flex, FormControl, Input } from "@chakra-ui/react";
44
import { zodResolver } from "@hookform/resolvers/zod";
55
import { ManageBillingButton } from "components/settings/Account/Billing/ManageButton";
66
import { useTrack } from "hooks/analytics/useTrack";
@@ -219,9 +219,11 @@ export const AccountForm: React.FC<AccountFormProps> = ({
219219
)}
220220
</Flex>
221221

222-
<HStack
223-
justifyContent={showBillingButton ? "space-between" : "flex-end"}
224-
w="full"
222+
<div
223+
className={cn(
224+
"flex flex-row w-full",
225+
showBillingButton ? "justify-between" : "justify-end",
226+
)}
225227
>
226228
{showBillingButton && <ManageBillingButton account={account} />}
227229

@@ -240,7 +242,7 @@ export const AccountForm: React.FC<AccountFormProps> = ({
240242
{buttonText}
241243
</Button>
242244
)}
243-
</HStack>
245+
</div>
244246
</div>
245247
</form>
246248
);

apps/dashboard/src/components/settings/Account/Billing/DowngradeDialog.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
AlertDialogHeader,
77
AlertDialogOverlay,
88
Flex,
9-
HStack,
109
Icon,
1110
Menu,
1211
MenuButton,
@@ -65,10 +64,13 @@ export const BillingDowngradeDialog: React.FC<BillingDowngradeDialogProps> = ({
6564
</Text>
6665
<Flex flexDir="column" gap={2}>
6766
{oldPlanFeatures.map((feat) => (
68-
<HStack key={Array.isArray(feat) ? feat[0] : feat}>
67+
<div
68+
className="flex flex-row"
69+
key={Array.isArray(feat) ? feat[0] : feat}
70+
>
6971
<Icon as={FiX} boxSize={4} color="red.500" />
7072
<Text>{Array.isArray(feat) ? feat[0] : feat}</Text>
71-
</HStack>
73+
</div>
7274
))}
7375
</Flex>
7476
</Flex>
@@ -123,7 +125,7 @@ export const BillingDowngradeDialog: React.FC<BillingDowngradeDialogProps> = ({
123125
</AlertDialogBody>
124126

125127
<AlertDialogFooter>
126-
<HStack alignItems="center" gap={3}>
128+
<div className="flex flex-row items-center gap-3">
127129
<Button
128130
onClick={() =>
129131
onConfirm(feedback === "other" ? otherFeedback : feedback)
@@ -140,7 +142,7 @@ export const BillingDowngradeDialog: React.FC<BillingDowngradeDialogProps> = ({
140142
<Button ref={cancelRef} onClick={onClose} size="sm">
141143
Keep {oldPlan} plan
142144
</Button>
143-
</HStack>
145+
</div>
144146
</AlertDialogFooter>
145147
</AlertDialogContent>
146148
</AlertDialogOverlay>

apps/dashboard/src/components/settings/Account/Billing/Header.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Flex, HStack, Icon } from "@chakra-ui/react";
1+
import { Flex, Icon } from "@chakra-ui/react";
22
import { FiAlertCircle, FiCheckCircle, FiInfo } from "react-icons/fi";
33
import { Badge, Heading, Text } from "tw-components";
44

@@ -17,7 +17,7 @@ export const BillingHeader: React.FC<BillingHeaderProps> = ({
1717
Billing Info
1818
</Heading>
1919

20-
<HStack>
20+
<div className="flex flex-row">
2121
<Text size="body.md">
2222
Manage your payment methods, billing information and invoices.
2323
</Text>
@@ -29,7 +29,7 @@ export const BillingHeader: React.FC<BillingHeaderProps> = ({
2929
py={1.5}
3030
textTransform="capitalize"
3131
>
32-
<HStack as="span">
32+
<span className="flex flex-row">
3333
<Icon
3434
as={
3535
validPayment
@@ -53,9 +53,9 @@ export const BillingHeader: React.FC<BillingHeaderProps> = ({
5353
? "Needs verification"
5454
: "Invalid payment"}
5555
</Text>
56-
</HStack>
56+
</span>
5757
</Badge>
58-
</HStack>
58+
</div>
5959
</Flex>
6060
);
6161
};

apps/dashboard/src/components/settings/Account/Billing/Plan.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Account } from "@3rdweb-sdk/react/hooks/useApi";
2-
import { Flex, HStack } from "@chakra-ui/react";
2+
import { Flex } from "@chakra-ui/react";
33
import { Badge, Text, TrackedLink } from "tw-components";
44
import { PLANS } from "utils/pricing";
55

@@ -20,7 +20,7 @@ export const BillingPlan: React.FC<BillingPlanProps> = ({
2020
}) => {
2121
return (
2222
<Flex direction={direction} gap={3}>
23-
<HStack>
23+
<div className="flex flex-row">
2424
<Text color={titleColor} size={titleSize}>
2525
Your current plan is
2626
</Text>
@@ -33,9 +33,9 @@ export const BillingPlan: React.FC<BillingPlanProps> = ({
3333
>
3434
{PLANS[account.plan as keyof typeof PLANS].title}
3535
</Badge>
36-
</HStack>
36+
</div>
3737

38-
<HStack>
38+
<div className="flex flex-row">
3939
{description && <Text>{description}</Text>}
4040

4141
<TrackedLink
@@ -48,7 +48,7 @@ export const BillingPlan: React.FC<BillingPlanProps> = ({
4848
Learn more
4949
</Text>
5050
</TrackedLink>
51-
</HStack>
51+
</div>
5252
</Flex>
5353
);
5454
};

apps/dashboard/src/components/settings/Account/Billing/PlanCard.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useAccount, useAccountCredits } from "@3rdweb-sdk/react/hooks/useApi";
2-
import { Flex, HStack } from "@chakra-ui/react";
2+
import { Flex } from "@chakra-ui/react";
33
import { Badge, Card, Heading, Text } from "tw-components";
44
import { PLANS } from "utils/pricing";
55
import { CreditsItem } from "./CreditsItem";
@@ -17,7 +17,7 @@ export const BillingPlanCard = () => {
1717

1818
return (
1919
<Card as={Flex} flexDir="column" gap={2}>
20-
<HStack>
20+
<div className="flex flex-row">
2121
<Heading size="title.xs">Your current plan is</Heading>
2222
<Badge
2323
borderRadius="md"
@@ -28,7 +28,7 @@ export const BillingPlanCard = () => {
2828
>
2929
{PLANS[account.plan as keyof typeof PLANS].title}
3030
</Badge>
31-
</HStack>
31+
</div>
3232

3333
<Flex flexDir="column" gap={4}>
3434
<Text size="body.md" />

apps/dashboard/src/components/settings/Account/Billing/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
AccountStatus,
77
useUpdateAccountPlan,
88
} from "@3rdweb-sdk/react/hooks/useApi";
9-
import { Flex, HStack, Icon, useDisclosure } from "@chakra-ui/react";
9+
import { Flex, Icon, useDisclosure } from "@chakra-ui/react";
1010
import { StepsCard } from "components/dashboard/StepsCard";
1111
import { OnboardingModal } from "components/onboarding/Modal";
1212
import { AccountForm } from "components/settings/Account/AccountForm";
@@ -141,7 +141,7 @@ export const Billing: React.FC<BillingProps> = ({ account }) => {
141141
return [
142142
{
143143
title: (
144-
<HStack justifyContent="space-between">
144+
<div className="flex flex-row justify-between">
145145
<Heading
146146
size="label.md"
147147
opacity={!stepsCompleted.account ? 1 : 0.6}
@@ -161,7 +161,7 @@ export const Billing: React.FC<BillingProps> = ({ account }) => {
161161
Edit
162162
</Button>
163163
)}
164-
</HStack>
164+
</div>
165165
),
166166
description:
167167
"This information will be used for billing notifications and invoices.",
@@ -288,10 +288,10 @@ export const Billing: React.FC<BillingProps> = ({ account }) => {
288288
color="blue.500"
289289
isExternal
290290
>
291-
<HStack alignItems="center" gap={2}>
291+
<div className="flex flex-row items-center gap-2">
292292
<Text color="blue.500">Learn more about thirdweb&apos;s pricing</Text>
293293
<Icon as={FiExternalLink} />
294-
</HStack>
294+
</div>
295295
</TrackedLink>
296296

297297
{downgradePlan && (

0 commit comments

Comments
 (0)