File tree Expand file tree Collapse file tree 1 file changed +29
-27
lines changed Expand file tree Collapse file tree 1 file changed +29
-27
lines changed Original file line number Diff line number Diff line change 1
1
import React from "react"
2
- import styled from "@emotion/styled"
3
-
4
- export interface IStyledBanner {
5
- shouldShow : boolean
6
- }
2
+ import { Flex , useMediaQuery } from "@chakra-ui/react"
3
+ import { lightTheme as oldTheme } from "../theme"
7
4
8
5
export interface IProps {
9
6
children ?: React . ReactNode
10
7
shouldShow ?: boolean
11
8
className ?: string
12
9
}
13
10
14
- const Banner = styled . div < IStyledBanner > `
15
- display: ${ ( props ) => ( props . shouldShow ? `flex` : `none` ) } ;
16
- width: 100%;
17
- background-color: ${ ( props ) => props . theme . colors . primary } ;
18
- color: ${ ( props ) => props . theme . colors . background } ;
19
- padding: 1rem 2rem;
20
- border-bottom: 1px solid ${ ( props ) => props . theme . colors . primary } ;
21
-
22
- a {
23
- color: ${ ( props ) => props . theme . colors . background } !important;
24
- }
25
-
26
- @media (min-width: ${ ( props ) => props . theme . breakpoints . l } ) {
27
- max-width: ${ ( props ) => props . theme . variables . maxPageWidth } ;
28
- }
29
- `
30
-
31
11
const BannerNotification : React . FC < IProps > = ( {
32
12
children,
33
13
className,
34
14
shouldShow = false ,
35
- } ) => (
36
- < Banner shouldShow = { shouldShow } className = { className } >
37
- { children }
38
- </ Banner >
39
- )
15
+ } ) => {
16
+ const [ isLGScreen ] = useMediaQuery ( `min-width: ${ oldTheme . breakpoints . l } ` )
17
+
18
+ return (
19
+ < >
20
+ { shouldShow && (
21
+ < Flex
22
+ className = { className }
23
+ maxW = { isLGScreen ? oldTheme . variables . maxPageWidth : "100%" }
24
+ w = "100%"
25
+ py = "4"
26
+ px = "8"
27
+ bg = "primary"
28
+ color = "background"
29
+ borderBottom = "1px solid primary"
30
+ sx = { {
31
+ a : {
32
+ color : "background" ,
33
+ } ,
34
+ } }
35
+ >
36
+ { children }
37
+ </ Flex >
38
+ ) }
39
+ </ >
40
+ )
41
+ }
40
42
41
43
export default BannerNotification
You can’t perform that action at this time.
0 commit comments