File tree Expand file tree Collapse file tree 3 files changed +31
-40
lines changed Expand file tree Collapse file tree 3 files changed +31
-40
lines changed Original file line number Diff line number Diff line change 1
- import React from "react"
2
- import { Center , FlexProps , useMediaQuery } from "@chakra-ui/react"
1
+ import { cn } from "@/lib/utils/cn"
3
2
4
- import { lightTheme as oldTheme } from "../../theme"
5
-
6
- export type BannerNotificationProps = FlexProps & {
3
+ export type BannerNotificationProps = React . HTMLAttributes < HTMLDivElement > & {
7
4
shouldShow ?: boolean
8
5
}
9
6
10
7
const BannerNotification = ( {
11
8
children,
12
- shouldShow = false ,
9
+ shouldShow,
10
+ className,
13
11
...props
14
12
} : BannerNotificationProps ) => {
15
- const [ isLGScreen ] = useMediaQuery ( `min-width: ${ oldTheme . breakpoints . l } ` )
13
+ if ( ! shouldShow ) return < > </ >
16
14
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
36
19
) }
37
- </ >
20
+ { ...props }
21
+ >
22
+ { children }
23
+ </ aside >
38
24
)
39
25
}
40
26
Original file line number Diff line number Diff line change 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"
4
8
5
- // Components
6
9
import BannerNotification from "../BannerNotification"
7
10
8
- // Interface
9
- export type DismissableBannerProps = {
10
- children : JSX . Element
11
+ type DismissableBannerProps = React . HTMLAttributes < HTMLDivElement > & {
11
12
storageKey : string
12
13
}
13
14
14
15
const DismissableBanner = ( {
15
16
children,
16
17
storageKey,
18
+ className,
17
19
} : DismissableBannerProps ) => {
18
20
const [ show , setShow ] = useState < boolean > ( false )
19
21
@@ -28,13 +30,16 @@ const DismissableBanner = ({
28
30
}
29
31
30
32
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"
35
37
onClick = { onClose }
36
38
aria-label = "Close Banner"
37
- />
39
+ variant = "ghost"
40
+ >
41
+ < MdClose />
42
+ </ Button >
38
43
</ BannerNotification >
39
44
)
40
45
}
Original file line number Diff line number Diff line change @@ -177,7 +177,7 @@ export const UseCasesLayout = ({
177
177
width = "full"
178
178
dir = { contentNotTranslated ? "ltr" : "unset" }
179
179
>
180
- < BannerNotification shouldShow zIndex = " sticky" hideBelow = { lgBp } >
180
+ < BannerNotification shouldShow className = "z- sticky max-lg:hidden" >
181
181
< Emoji text = ":pencil:" className = "me-4 shrink-0 text-2xl" />
182
182
< Text m = { 0 } >
183
183
{ t ( "template-usecase:template-usecase-banner" ) } { " " }
You can’t perform that action at this time.
0 commit comments