1
- import React , { useEffect , useState } from "react"
2
- import {
3
- Box ,
4
- Button ,
5
- CloseButton ,
6
- Flex ,
7
- Heading ,
8
- useToken ,
9
- } from "@chakra-ui/react"
1
+ import { useEffect , useState } from "react"
2
+ import { X } from "lucide-react"
3
+
4
+ import { Button } from "@/components/ui/buttons/Button"
5
+
6
+ import { cn } from "@/lib/utils/cn"
10
7
11
8
import Emoji from "./Emoji"
12
- import Text from "./OldText"
13
9
import Translation from "./Translation"
14
10
15
11
export type TranslationBannerLegalProps = {
@@ -23,7 +19,6 @@ const TranslationBannerLegal = ({
23
19
} : TranslationBannerLegalProps ) => {
24
20
// Default to isOpen being false, and let the useEffect set this.
25
21
const [ isOpen , setIsOpen ] = useState ( false )
26
- const text = useToken ( "colors" , "text" )
27
22
28
23
useEffect ( ( ) => {
29
24
if (
@@ -38,54 +33,39 @@ const TranslationBannerLegal = ({
38
33
} , [ originalPagePath , shouldShow ] )
39
34
40
35
return (
41
- < Box
42
- as = "aside"
43
- position = "fixed"
44
- display = { isOpen ? "block" : "none" }
45
- bottom = { { base : 0 , md : 8 } }
46
- insetInlineEnd = { { base : 0 , md : 8 } }
47
- zIndex = "99"
36
+ < aside
37
+ className = { cn (
38
+ "fixed z-50" ,
39
+ "bottom-0 md:bottom-8" ,
40
+ "right-0 md:right-8" ,
41
+ isOpen ? "block" : "hidden"
42
+ ) }
48
43
>
49
- < Flex
50
- bg = "infoBanner"
51
- color = "black300"
52
- justify = "space-between"
53
- maxW = { { base : "full" , md : "600px" } }
54
- maxH = "full"
55
- p = { 4 }
56
- borderRadius = "sm"
57
- boxShadow = { {
58
- base : `-4px 10px 0px ${ text } 10%` ,
59
- md : "rgba(0, 0, 0, 0.16) 0px 2px 4px 0px" ,
60
- } }
44
+ < div
45
+ className = { cn (
46
+ "relative flex justify-between" ,
47
+ "w-full md:max-w-[600px]" ,
48
+ "rounded-sm p-4" ,
49
+ "bg-info-banner text-black-300" ,
50
+ "shadow-[rgba(0,0,0,0.16)_0px_2px_4px_0px] md:shadow-md"
51
+ ) }
61
52
>
62
- < Flex direction = "column" m = { 4 } mt = { { base : 10 , sm : 4 } } >
63
- < Flex
64
- align = { { base : "flex-start" , sm : "center" } }
65
- flexDirection = { { base : "column-reverse" , sm : "row" } }
66
- mb = { 4 }
67
- >
68
- < Heading
69
- as = "h3"
70
- fontSize = { { base : "1.25rem" , md : "1.5rem" } }
71
- fontWeight = "bold"
72
- lineHeight = "100%"
73
- >
53
+ < div className = "m-4 mt-[40px] flex flex-col sm:mt-4" >
54
+ < div className = "mb-4 flex flex-col-reverse items-start sm:flex-row sm:items-center" >
55
+ < h3 className = "text-xl font-bold leading-none md:text-2xl" >
74
56
< Translation id = "translation-banner-no-bugs-title" />
75
57
< Emoji
76
58
text = ":bug:"
77
59
className = "mb-4 ms-2 pt-2 text-3xl sm:mb-auto"
78
60
/>
79
- </ Heading >
80
- </ Flex >
81
- < Text >
61
+ </ h3 >
62
+ </ div >
63
+ < p >
82
64
< Translation id = "translation-banner-no-bugs-content" />
83
- </ Text >
84
- < Flex
85
- align = { { base : "flex-start" , sm : "center" } }
86
- flexDirection = { { base : "column" , sm : "row" } }
87
- >
65
+ </ p >
66
+ < div className = "flex flex-col items-start sm:flex-row sm:items-center" >
88
67
< Button
68
+ variant = "link"
89
69
onClick = { ( ) => {
90
70
localStorage . setItem (
91
71
`dont-show-translation-legal-banner-${ originalPagePath } ` ,
@@ -96,21 +76,21 @@ const TranslationBannerLegal = ({
96
76
>
97
77
< Translation id = "translation-banner-no-bugs-dont-show-again" />
98
78
</ Button >
99
- </ Flex >
100
- </ Flex >
101
- < CloseButton
102
- position = "absolute"
103
- top = { 0 }
104
- insetInlineEnd = "0"
105
- margin = { 4 }
106
- color = "secondary"
107
- _hover = { {
108
- color : "primary.base" ,
109
- } }
79
+ </ div >
80
+ </ div >
81
+ < button
82
+ type = "button"
83
+ className = { cn (
84
+ "absolute right-0 top-0 m-4" ,
85
+ "rounded-sm p-2" ,
86
+ "text-secondary hover:text-primary"
87
+ ) }
110
88
onClick = { ( ) => setIsOpen ( false ) }
111
- />
112
- </ Flex >
113
- </ Box >
89
+ >
90
+ < X className = "h-4 w-4" />
91
+ </ button >
92
+ </ div >
93
+ </ aside >
114
94
)
115
95
}
116
96
0 commit comments