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 { MdClose } from "react-icons/md"
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,53 +33,33 @@ 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-popover bg-background-highlight" ,
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
+ "shadow-md"
50
+ ) }
61
51
>
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
- >
52
+ < div className = "m-4 mt-10 flex flex-col gap-4 sm:mt-4" >
53
+ < div className = "flex flex-col-reverse items-start sm:flex-row sm:items-center" >
54
+ < h3 className = "leading-none md:text-2xl" >
74
55
< Translation id = "translation-banner-no-bugs-title" />
75
- < Emoji
76
- text = ":bug:"
77
- className = "mb-4 ms-2 pt-2 text-3xl sm:mb-auto"
78
- />
79
- </ Heading >
80
- </ Flex >
81
- < Text >
56
+ < Emoji text = ":bug:" className = "ms-2 text-3xl sm:mb-auto" />
57
+ </ h3 >
58
+ </ div >
59
+ < p >
82
60
< 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
- >
61
+ </ p >
62
+ < div className = "flex flex-col items-start sm:flex-row sm:items-center" >
88
63
< Button
89
64
onClick = { ( ) => {
90
65
localStorage . setItem (
@@ -96,21 +71,20 @@ const TranslationBannerLegal = ({
96
71
>
97
72
< Translation id = "translation-banner-no-bugs-dont-show-again" />
98
73
</ 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
- } }
74
+ </ div >
75
+ </ div >
76
+ < Button
77
+ variant = "ghost"
78
+ className = { cn (
79
+ "absolute right-0 top-0 m-4 p-2" ,
80
+ "text-secondary hover:text-primary"
81
+ ) }
110
82
onClick = { ( ) => setIsOpen ( false ) }
111
- />
112
- </ Flex >
113
- </ Box >
83
+ >
84
+ < MdClose className = "h-4 w-4" />
85
+ </ Button >
86
+ </ div >
87
+ </ aside >
114
88
)
115
89
}
116
90
0 commit comments