|
1 | 1 | import React from "react"
|
2 |
| -import { Box, Flex, Grid, useToken } from "@chakra-ui/react" |
3 | 2 |
|
4 | 3 | import { ChildOnlyProp } from "@/lib/types"
|
5 | 4 |
|
| 5 | +import { Flex } from "@/components/ui/flex" |
| 6 | + |
| 7 | +import { cn } from "@/lib/utils/cn" |
| 8 | + |
6 | 9 | export const Banner = ({ children }: ChildOnlyProp) => {
|
7 | 10 | return (
|
8 |
| - <Flex |
9 |
| - w="full" |
10 |
| - background="bannerGridGradient" |
11 |
| - direction={{ base: "column", lg: "row" }} |
12 |
| - wrap="nowrap" |
13 |
| - sx={{ |
14 |
| - h2: { |
15 |
| - mt: 0, |
16 |
| - }, |
17 |
| - ul: { |
18 |
| - mb: 0, |
19 |
| - }, |
20 |
| - }} |
21 |
| - > |
| 11 | + <Flex className="w-full flex-col flex-nowrap bg-banner-grid-gradient lg:flex-row [&_h2]:mt-0 [&_ul]:mb-0"> |
22 | 12 | {children}
|
23 | 13 | </Flex>
|
24 | 14 | )
|
25 | 15 | }
|
26 | 16 |
|
27 | 17 | export const BannerBody = ({ children }: ChildOnlyProp) => {
|
28 |
| - return ( |
29 |
| - <Box flex={4} p={10}> |
30 |
| - {children} |
31 |
| - </Box> |
32 |
| - ) |
| 18 | + return <div className="w-full flex-[4] p-10">{children}</div> |
33 | 19 | }
|
34 | 20 |
|
35 | 21 | export const BannerImage = ({ children }: ChildOnlyProp) => {
|
36 |
| - return ( |
37 |
| - <Flex justifyContent="end" flex={2} alignSelf="end"> |
38 |
| - {children} |
39 |
| - </Flex> |
40 |
| - ) |
| 22 | + return <Flex className="flex-[2] justify-end self-end">{children}</Flex> |
41 | 23 | }
|
42 | 24 |
|
43 | 25 | export const BannerGrid = ({ children }: ChildOnlyProp) => {
|
44 | 26 | return (
|
45 |
| - <Grid |
46 |
| - templateColumns={{ |
47 |
| - base: "repeat(1,1fr)", |
48 |
| - md: "repeat(2,1fr)", |
49 |
| - lg: "repeat(3,1fr)", |
50 |
| - }} |
51 |
| - templateRows={{ |
52 |
| - md: "repeat(3, 1fr)", |
53 |
| - lg: "repeat(2, 1fr)", |
54 |
| - }} |
55 |
| - columnGap={0} |
56 |
| - rowGap={0} |
57 |
| - > |
| 27 | + <div className="md:grid-rows-[repeat(3, 1fr)] lg:grid-rows-[repeat(2, 1fr)] grid w-full grid-cols-[repeat(1,1fr)] gap-0 md:grid-cols-[repeat(2,1fr)] lg:grid-cols-[repeat(3,1fr)]"> |
58 | 28 | {children}
|
59 |
| - </Grid> |
| 29 | + </div> |
60 | 30 | )
|
61 | 31 | }
|
62 | 32 |
|
63 | 33 | export const BannerGridCell = ({ children }: ChildOnlyProp) => {
|
64 |
| - const [medBp, lgBp] = useToken("breakpoints", ["md", "lg"]) |
65 |
| - |
66 | 34 | return (
|
67 | 35 | <Flex
|
68 |
| - px={{ base: 0, md: 12 }} |
69 |
| - py={8} |
70 |
| - direction="column" |
71 |
| - borderTop="1px solid" |
72 |
| - borderTopColor="searchBackground" |
73 |
| - borderInlineStart={{ base: 0, md: "1px solid" }} |
74 |
| - borderInlineStartColor={{ md: "searchBackground" }} |
75 |
| - sx={{ |
76 |
| - "&:first-child": { |
77 |
| - borderTop: 0, |
78 |
| - }, |
79 |
| - [`@media (min-width: ${medBp})`]: { |
80 |
| - "&:nth-child(-n + 2)": { |
81 |
| - borderTop: 0, |
82 |
| - }, |
83 |
| - "&:nth-child(2n + 1)": { |
84 |
| - borderInlineStart: 0, |
85 |
| - }, |
86 |
| - }, |
87 |
| - [`@media (min-width: ${lgBp})`]: { |
88 |
| - "&:first-child": { |
89 |
| - ps: 0, |
90 |
| - borderInlineStart: 0, |
91 |
| - }, |
92 |
| - "&:nth-child(-n + 2)": { |
93 |
| - borderTop: "1px solid", |
94 |
| - borderTopColor: "searchBackground", |
95 |
| - }, |
96 |
| - "&:nth-child(2n + 1)": { |
97 |
| - borderInlineStart: "1px solid", |
98 |
| - borderInlineStartColor: "searchBackground", |
99 |
| - }, |
100 |
| - "&:nth-child(-n + 3)": { |
101 |
| - borderTop: 0, |
102 |
| - justifyContent: "start", |
103 |
| - paddingTop: 0, |
104 |
| - }, |
105 |
| - "&:nth-child(3n + 1)": { |
106 |
| - ps: 0, |
107 |
| - borderInlineStart: 0, |
108 |
| - }, |
109 |
| - "&:nth-child(n + 4)": { |
110 |
| - justifyContent: "start", |
111 |
| - paddingBottom: 0, |
112 |
| - }, |
113 |
| - }, |
114 |
| - }} |
| 36 | + className={cn( |
| 37 | + "px-0 py-8 md:px-12", |
| 38 | + "flex-col", |
| 39 | + "border-t border-t-search-background", |
| 40 | + "md:border-s md:border-s-search-background", |
| 41 | + "first:border-t-0", |
| 42 | + "lg:[&:first-child]:border-s-0", |
| 43 | + "md:[&:nth-child(-n+2)]:border-t-0 lg:[&:nth-child(-n+2)]:border-t lg:[&:nth-child(-n+2)]:border-t-search-background", |
| 44 | + "md:[&:nth-child(2n+1)]:border-s-0 lg:[&:nth-child(2n+1)]:border-s lg:[&:nth-child(2n+1)]:border-s-search-background", |
| 45 | + "lg:[&:nth-child(-n+3)]:justify-start lg:[&:nth-child(-n+3)]:border-t-0 lg:[&:nth-child(-n+3)]:pt-0", |
| 46 | + "lg:[&:nth-child(3n+1)]:border-s-0 lg:[&:nth-child(3n+1)]:ps-0", |
| 47 | + "lg:[&:nth-child(n+4)]:justify-start lg:[&:nth-child(n+4)]:pb-0" |
| 48 | + )} |
115 | 49 | >
|
116 | 50 | {children}
|
117 | 51 | </Flex>
|
|
0 commit comments