Skip to content

Commit d48e953

Browse files
committed
Merge branch 'dev' into gradients
2 parents 6c9ef6d + 816648c commit d48e953

File tree

17 files changed

+219
-248
lines changed

17 files changed

+219
-248
lines changed

src/components/Banners/BannerNotification.tsx

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,26 @@
1-
import React from "react"
2-
import { Center, FlexProps, useMediaQuery } from "@chakra-ui/react"
1+
import { cn } from "@/lib/utils/cn"
32

4-
import { lightTheme as oldTheme } from "../../theme"
5-
6-
export type BannerNotificationProps = FlexProps & {
3+
export type BannerNotificationProps = React.HTMLAttributes<HTMLDivElement> & {
74
shouldShow?: boolean
85
}
96

107
const BannerNotification = ({
118
children,
12-
shouldShow = false,
9+
shouldShow,
10+
className,
1311
...props
1412
}: BannerNotificationProps) => {
15-
const [isLGScreen] = useMediaQuery(`min-width: ${oldTheme.breakpoints.l}`)
13+
if (!shouldShow) return <></>
1614
return (
17-
<>
18-
{shouldShow && (
19-
<Center
20-
as="aside"
21-
maxW={isLGScreen ? oldTheme.variables.maxPageWidth : "100%"}
22-
w="100%"
23-
py="4"
24-
px="8"
25-
bg="primary.base"
26-
color="background.base"
27-
sx={{
28-
a: {
29-
color: "background.base",
30-
},
31-
}}
32-
{...props}
33-
>
34-
{children}
35-
</Center>
15+
<aside
16+
className={cn(
17+
"flex items-center justify-center gap-2 bg-primary-action px-8 py-4 text-white [&_a]:text-white [&_a]:hover:text-white/80",
18+
className
3619
)}
37-
</>
20+
{...props}
21+
>
22+
{children}
23+
</aside>
3824
)
3925
}
4026

src/components/Banners/DismissableBanner/index.tsx

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
// Libraries
2-
import React, { useEffect, useState } from "react"
3-
import { Center, CloseButton } from "@chakra-ui/react"
1+
import { useEffect, useState } from "react"
2+
import { MdClose } from "react-icons/md"
3+
4+
import { Button } from "@/components/ui/buttons/Button"
5+
import { Center } from "@/components/ui/flex"
6+
7+
import { cn } from "@/lib/utils/cn"
48

5-
// Components
69
import BannerNotification from "../BannerNotification"
710

8-
// Interface
9-
export type DismissableBannerProps = {
10-
children: JSX.Element
11+
type DismissableBannerProps = React.HTMLAttributes<HTMLDivElement> & {
1112
storageKey: string
1213
}
1314

1415
const DismissableBanner = ({
1516
children,
1617
storageKey,
18+
className,
1719
}: DismissableBannerProps) => {
1820
const [show, setShow] = useState<boolean>(false)
1921

@@ -28,13 +30,16 @@ const DismissableBanner = ({
2830
}
2931

3032
return (
31-
<BannerNotification shouldShow={show} gap="8">
32-
<Center marginInlineStart="auto">{children}</Center>
33-
<CloseButton
34-
marginInlineStart="auto"
33+
<BannerNotification shouldShow={show} className={cn("gap-8", className)}>
34+
<Center className="ms-auto">{children}</Center>
35+
<Button
36+
className="ms-auto"
3537
onClick={onClose}
3638
aria-label="Close Banner"
37-
/>
39+
variant="ghost"
40+
>
41+
<MdClose />
42+
</Button>
3843
</BannerNotification>
3944
)
4045
}

src/components/EnergyConsumptionChart/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import ChartDataLabels from "chartjs-plugin-datalabels"
1212
import { useRouter } from "next/router"
1313
import { useTranslation } from "next-i18next"
1414
import { Bar } from "react-chartjs-2"
15-
import { useBreakpointValue } from "@chakra-ui/react"
1615

1716
import type { Lang } from "@/lib/types"
1817

@@ -21,6 +20,7 @@ import { Center } from "@/components/ui/flex"
2120
import { wrapLabel } from "@/lib/utils/charts"
2221
import { isLangRightToLeft } from "@/lib/utils/translations"
2322

23+
import { useBreakpointValue } from "@/hooks/useBreakpointValue"
2424
import useColorModeValue from "@/hooks/useColorModeValue"
2525
import { useIsClient } from "@/hooks/useIsClient"
2626

src/components/ExpandableInfo.tsx

Lines changed: 0 additions & 147 deletions
This file was deleted.

src/components/Homepage/useHome.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useRouter } from "next/router"
33
import { useTranslation } from "next-i18next"
44
import { FaDiscord, FaGithub, FaXTwitter } from "react-icons/fa6"
55

6-
import type { EventCardProps, Lang } from "@/lib/types"
6+
import type { EventCardProps } from "@/lib/types"
77
import type { CodeExample } from "@/lib/interfaces"
88

99
import { useBentoBox } from "@/components/Homepage/useBentoBox"
@@ -16,8 +16,8 @@ import TryAppsIcon from "@/components/icons/phone-homescreen.svg"
1616
import RoadmapSign from "@/components/icons/roadmap-sign.svg"
1717
import Whitepaper from "@/components/icons/whitepaper.svg"
1818

19+
import { cn } from "@/lib/utils/cn"
1920
import { isValidDate } from "@/lib/utils/date"
20-
import { isLangRightToLeft } from "@/lib/utils/translations"
2121

2222
import events from "@/data/community-events.json"
2323
import CreateWalletContent from "@/data/CreateWallet"
@@ -27,6 +27,7 @@ import { GITHUB_REPO_URL } from "@/lib/constants"
2727
import SimpleDomainRegistryContent from "!!raw-loader!@/data/SimpleDomainRegistry.sol"
2828
import SimpleTokenContent from "!!raw-loader!@/data/SimpleToken.sol"
2929
import SimpleWalletContent from "!!raw-loader!@/data/SimpleWallet.sol"
30+
import { useRtlFlip } from "@/hooks/useRtlFlip"
3031

3132
export const useHome = () => {
3233
const { t } = useTranslation(["common", "page-index"])
@@ -37,7 +38,7 @@ export const useHome = () => {
3738

3839
const bentoItems = useBentoBox()
3940

40-
const dir = isLangRightToLeft(locale as Lang) ? "rtl" : "ltr"
41+
const { direction, isRtl } = useRtlFlip()
4142

4243
const toggleCodeExample = (id: number): void => {
4344
setActiveCode(id)
@@ -106,7 +107,10 @@ export const useHome = () => {
106107
description: t("page-index:page-index-cta-dapps-description"),
107108
href: "/dapps/",
108109
Svg: TryAppsIcon,
109-
className: "text-accent-c hover:text-accent-c-hover",
110+
className: cn(
111+
"text-accent-c hover:text-accent-c-hover",
112+
isRtl && "[&_svg]:-scale-x-100"
113+
),
110114
},
111115
]
112116

@@ -129,11 +133,13 @@ export const useHome = () => {
129133
{
130134
label: t("page-index:page-index-popular-topics-whitepaper"),
131135
Svg: Whitepaper,
136+
className: cn(isRtl && "[&_svg]:-scale-x-100"),
132137
href: "/whitepaper/",
133138
},
134139
{
135140
label: t("page-index:page-index-popular-topics-roadmap"),
136141
Svg: RoadmapSign,
142+
className: cn(isRtl && "[&_svg]:-scale-x-100"),
137143
href: "/roadmap/",
138144
},
139145
]
@@ -188,7 +194,7 @@ export const useHome = () => {
188194
t,
189195
locale,
190196
asPath,
191-
dir,
197+
dir: direction,
192198
isModalOpen,
193199
setModalOpen,
194200
activeCode,

src/components/Simulator/WalletHome/NFTList.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
import React from "react"
2-
import {
3-
Box,
4-
Flex,
5-
type FlexProps,
6-
Text,
7-
useBreakpointValue,
8-
} from "@chakra-ui/react"
2+
import { Box, Flex, type FlexProps, Text } from "@chakra-ui/react"
93

104
import { Image } from "@/components/Image"
115

126
import type { NFT } from "./interfaces"
137

8+
import { useBreakpointValue } from "@/hooks/useBreakpointValue"
9+
1410
type NFTListProps = FlexProps & {
1511
nfts: Array<NFT>
1612
}

src/components/ui/Link.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const BaseLink = forwardRef<HTMLAnchorElement, LinkProps>(function Link(
5050
ref
5151
) {
5252
const { asPath } = useRouter()
53-
const { flipForRtl } = useRtlFlip()
53+
const { twFlipForRtl } = useRtlFlip()
5454

5555
if (!href) {
5656
console.warn("Link component is missing href prop")
@@ -102,9 +102,10 @@ export const BaseLink = forwardRef<HTMLAnchorElement, LinkProps>(function Link(
102102
<VisuallyHidden>(opens in a new tab)</VisuallyHidden>
103103
{!hideArrow && (
104104
<RxExternalLink
105-
className={cn("-me-1 inline h-6 w-6 p-1 align-middle", {
106-
transform: flipForRtl,
107-
})}
105+
className={cn(
106+
"-me-1 inline h-6 w-6 p-1 align-middle",
107+
twFlipForRtl
108+
)}
108109
/>
109110
)}
110111
</a>

src/components/ui/buttons/Button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { scrollIntoView } from "@/lib/utils/scrollIntoView"
99
import { BaseLink, type LinkProps } from "../Link"
1010

1111
const buttonVariants = cva(
12-
"pointer inline-flex gap-2 items-center justify-center rounded border border-solid border-current text-primary transition focus-visible:outline focus-visible:outline-4 focus-visible:outline-primary-hover focus-visible:-outline-offset-1 disabled:text-disabled disabled:pointer-events-none hover:text-primary-hover [&[data-secondary='true']]:text-body [&>svg]:flex-shrink-0",
12+
"inline-flex gap-2 items-center justify-center rounded border border-solid border-current text-primary transition focus-visible:outline focus-visible:outline-4 focus-visible:outline-primary-hover focus-visible:-outline-offset-1 disabled:text-disabled disabled:pointer-events-none hover:text-primary-hover [&[data-secondary='true']]:text-body [&>svg]:flex-shrink-0",
1313
{
1414
variants: {
1515
variant: {

0 commit comments

Comments
 (0)