|
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 | + |
6 | 7 | export const Banner = ({ children }: ChildOnlyProp) => {
|
7 | 8 | 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 |
| - > |
| 9 | + <Flex className="flex-col flex-nowrap bg-banner-grid-gradient lg:flex-row [&_h2]:mt-0 [&_ul]:mb-0"> |
22 | 10 | {children}
|
23 | 11 | </Flex>
|
24 | 12 | )
|
25 | 13 | }
|
26 | 14 |
|
27 | 15 | export const BannerBody = ({ children }: ChildOnlyProp) => {
|
28 | 16 | return (
|
29 |
| - <Box flex={4} p={10}> |
30 |
| - {children} |
31 |
| - </Box> |
| 17 | + <div className="flex-shrink-[1] flex-grow-[4] basis-0 p-10">{children}</div> |
32 | 18 | )
|
33 | 19 | }
|
34 | 20 |
|
35 |
| -export const BannerImage = ({ children }: ChildOnlyProp) => { |
| 21 | +export const BannerImage = ({ children }) => { |
36 | 22 | return (
|
37 |
| - <Flex justifyContent="end" flex={2} alignSelf="end"> |
| 23 | + <div className="flex flex-shrink-[1] flex-grow-[2] basis-0 justify-end self-end"> |
38 | 24 | {children}
|
39 |
| - </Flex> |
| 25 | + </div> |
40 | 26 | )
|
41 | 27 | }
|
42 | 28 |
|
43 | 29 | export const BannerGrid = ({ children }: ChildOnlyProp) => {
|
44 | 30 | 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 |
| - > |
| 31 | + <div className="grid grid-cols-1 gap-0 md:grid-cols-2 md:grid-rows-3 lg:grid-cols-3 lg:grid-rows-2"> |
58 | 32 | {children}
|
59 |
| - </Grid> |
| 33 | + </div> |
60 | 34 | )
|
61 | 35 | }
|
62 | 36 |
|
63 | 37 | export const BannerGridCell = ({ children }: ChildOnlyProp) => {
|
64 |
| - const [medBp, lgBp] = useToken("breakpoints", ["md", "lg"]) |
65 |
| - |
66 | 38 | return (
|
67 | 39 | <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 |
| - }} |
| 40 | + // TODO: refactor className to make it more readable |
| 41 | + className={`flex-col border-t border-t-search-background px-0 py-8 first:border-t-0 md:border-l md:border-l-search-background md:px-12 lg:[&:first-child]:border-l-0 lg:[&:first-child]:ps-0 md:[&:nth-child(-n+2)]:border-t-0 lg:[&:nth-child(-n+2)]:border-t lg:[&:nth-child(-n+2)]:border-t-search-background lg:[&:nth-child(-n+3)]:justify-start lg:[&:nth-child(-n+3)]:border-t-0 lg:[&:nth-child(-n+3)]:pt-0 md:[&:nth-child(2n+1)]:border-l-0 lg:[&:nth-child(2n+1)]:border-l lg:[&:nth-child(2n+1)]:border-l-search-background lg:[&:nth-child(3n+1)]:border-l-0 lg:[&:nth-child(3n+1)]:ps-0 lg:[&:nth-child(n+4)]:justify-start lg:[&:nth-child(n+4)]:pb-0`} |
115 | 42 | >
|
116 | 43 | {children}
|
117 | 44 | </Flex>
|
|
0 commit comments