|
1 |
| -import styled from "@emotion/styled" |
2 |
| - |
3 |
| -export const Banner = styled.div` |
4 |
| - width: 100%; |
5 |
| - display: flex; |
6 |
| - background: ${(props) => props.theme.colors.bannerGridGradient}; |
7 |
| -
|
8 |
| - h2 { |
9 |
| - margin-top: 0; |
10 |
| - } |
11 |
| -
|
12 |
| - ul { |
13 |
| - margin-bottom: 0; |
14 |
| - } |
15 |
| -
|
16 |
| - flex-flow: column nowrap; |
17 |
| -
|
18 |
| - @media (min-width: ${(props) => props.theme.breakpoints.l}) { |
19 |
| - flex-flow: row nowrap; |
20 |
| - } |
21 |
| -` |
22 |
| - |
23 |
| -export const BannerBody = styled.div` |
24 |
| - flex: 4; |
25 |
| - padding: 40px; |
26 |
| -` |
27 |
| - |
28 |
| -export const BannerImage = styled.div` |
29 |
| - display: flex; |
30 |
| - justify-content: end; |
31 |
| - flex: 2; |
32 |
| - align-self: end; |
33 |
| -` |
34 |
| - |
35 |
| -export const BannerGrid = styled.div` |
36 |
| - display: grid; |
37 |
| - grid-template-columns: repeat(1, 1fr); |
38 |
| - grid-column-gap: 0px; |
39 |
| - grid-row-gap: 0px; |
40 |
| -
|
41 |
| - @media (min-width: ${(props) => props.theme.breakpoints.m}) { |
42 |
| - grid-template-columns: repeat(2, 1fr); |
43 |
| - grid-template-rows: repeat(3, 1fr); |
44 |
| - } |
45 |
| -
|
46 |
| - @media (min-width: ${(props) => props.theme.breakpoints.l}) { |
47 |
| - grid-template-columns: repeat(3, 1fr); |
48 |
| - grid-template-rows: repeat(2, 1fr); |
49 |
| - } |
50 |
| -` |
51 |
| - |
52 |
| -export const BannerGridCell = styled.div` |
53 |
| - padding: 2rem 3rem; |
54 |
| - display: flex; |
55 |
| - flex-direction: column; |
56 |
| -
|
57 |
| - border-top: 1px solid ${({ theme }) => theme.colors.searchBackground}; |
58 |
| -
|
59 |
| - border-left: none; |
60 |
| - &:first-child { |
61 |
| - border-top: none; |
62 |
| - } |
63 |
| -
|
64 |
| - @media (min-width: ${(props) => props.theme.breakpoints.m}) { |
65 |
| - border-left: 1px solid ${({ theme }) => theme.colors.searchBackground}; |
66 |
| - &:nth-child(-n + 2) { |
67 |
| - border-top: none; |
68 |
| - } |
69 |
| - &:nth-child(2n + 1) { |
70 |
| - border-left: none; |
71 |
| - } |
72 |
| - } |
73 |
| -
|
74 |
| - @media (min-width: ${(props) => props.theme.breakpoints.l}) { |
75 |
| - &:nth-child(-n + 2) { |
76 |
| - border-top: 1px solid ${({ theme }) => theme.colors.searchBackground}; |
77 |
| - } |
78 |
| - &:nth-child(2n + 1) { |
79 |
| - border-left: 1px solid ${({ theme }) => theme.colors.searchBackground}; |
80 |
| - } |
81 |
| -
|
82 |
| - &:nth-child(-n + 3) { |
83 |
| - border-top: none; |
84 |
| - justify-content: start; |
85 |
| - padding-top: 0; |
86 |
| - } |
87 |
| - &:first-child, |
88 |
| - &:nth-child(3n + 1) { |
89 |
| - padding-left: 0; |
90 |
| - border-left: none; |
91 |
| - } |
92 |
| - &:nth-child(n + 4) { |
93 |
| - justify-content: start; |
94 |
| - padding-bottom: 0; |
95 |
| - } |
96 |
| - } |
97 |
| -` |
| 1 | +import { Box, Flex, Grid, useToken } from "@chakra-ui/react" |
| 2 | +import React from "react" |
| 3 | + |
| 4 | +export type Props = { |
| 5 | + children: React.ReactNode |
| 6 | +} |
| 7 | + |
| 8 | +export const Banner: React.FC<Props> = ({ children }) => { |
| 9 | + return ( |
| 10 | + <Flex |
| 11 | + w="full" |
| 12 | + background="bannerGridGradient" |
| 13 | + direction={{ base: "column", lg: "row" }} |
| 14 | + wrap="nowrap" |
| 15 | + sx={{ |
| 16 | + h2: { |
| 17 | + mt: 0, |
| 18 | + }, |
| 19 | + ul: { |
| 20 | + mb: 0, |
| 21 | + }, |
| 22 | + }} |
| 23 | + > |
| 24 | + {children} |
| 25 | + </Flex> |
| 26 | + ) |
| 27 | +} |
| 28 | + |
| 29 | +export const BannerBody: React.FC<Props> = ({ children }) => { |
| 30 | + return ( |
| 31 | + <Box flex={4} p={10}> |
| 32 | + {children} |
| 33 | + </Box> |
| 34 | + ) |
| 35 | +} |
| 36 | + |
| 37 | +export const BannerImage: React.FC<Props> = ({ children }) => { |
| 38 | + return ( |
| 39 | + <Flex justifyContent="end" flex={2} alignSelf="end"> |
| 40 | + {children} |
| 41 | + </Flex> |
| 42 | + ) |
| 43 | +} |
| 44 | + |
| 45 | +export const BannerGrid: React.FC<Props> = ({ children }) => { |
| 46 | + return ( |
| 47 | + <Grid |
| 48 | + templateColumns={{ |
| 49 | + base: "repeat(1,1fr)", |
| 50 | + md: "repeat(2,1fr)", |
| 51 | + lg: "repeat(3,1fr)", |
| 52 | + }} |
| 53 | + templateRows={{ |
| 54 | + md: "repeat(3, 1fr)", |
| 55 | + lg: "repeat(2, 1fr)", |
| 56 | + }} |
| 57 | + columnGap={0} |
| 58 | + rowGap={0} |
| 59 | + > |
| 60 | + {children} |
| 61 | + </Grid> |
| 62 | + ) |
| 63 | +} |
| 64 | + |
| 65 | +export const BannerGridCell: React.FC<Props> = ({ children }) => { |
| 66 | + const [medBp, lgBp] = useToken("breakpoints", ["md", "lg"]) |
| 67 | + |
| 68 | + return ( |
| 69 | + <Flex |
| 70 | + px={12} |
| 71 | + py={8} |
| 72 | + direction="column" |
| 73 | + borderTop="1px solid" |
| 74 | + borderTopColor="searchBackground" |
| 75 | + borderLeft={{ base: 0, md: "1px solid" }} |
| 76 | + borderLeftColor={{ md: "searchBackground" }} |
| 77 | + sx={{ |
| 78 | + "&:first-child": { |
| 79 | + borderTop: 0, |
| 80 | + }, |
| 81 | + [`@media (min-width: ${medBp})`]: { |
| 82 | + "&:nth-child(-n + 2)": { |
| 83 | + borderTop: 0, |
| 84 | + }, |
| 85 | + "&:nth-child(2n + 1)": { |
| 86 | + borderLeft: 0, |
| 87 | + }, |
| 88 | + }, |
| 89 | + [`@media (min-width: ${lgBp})`]: { |
| 90 | + "&:first-child": { |
| 91 | + paddingLeft: 0, |
| 92 | + borderLeft: 0, |
| 93 | + }, |
| 94 | + "&:nth-child(-n + 2)": { |
| 95 | + borderTop: "1px solid", |
| 96 | + borderTopColor: "searchBackground", |
| 97 | + }, |
| 98 | + "&:nth-child(2n + 1)": { |
| 99 | + borderLeft: "1px solid", |
| 100 | + borderLeftColor: "searchBackground", |
| 101 | + }, |
| 102 | + "&:nth-child(-n + 3)": { |
| 103 | + borderTop: 0, |
| 104 | + justifyContent: "start", |
| 105 | + paddingTop: 0, |
| 106 | + }, |
| 107 | + "&:nth-child(3n + 1)": { |
| 108 | + paddingLeft: 0, |
| 109 | + borderLeft: 0, |
| 110 | + }, |
| 111 | + "&:nth-child(n + 4)": { |
| 112 | + justifyContent: "start", |
| 113 | + paddingBottom: 0, |
| 114 | + }, |
| 115 | + }, |
| 116 | + }} |
| 117 | + > |
| 118 | + {children} |
| 119 | + </Flex> |
| 120 | + ) |
| 121 | +} |
0 commit comments