Skip to content

Commit c7375ed

Browse files
authored
Merge pull request #196 from UgnisSoftware/UGN-374
UGN-374 bugfix - add custom styling ability to modal close button
2 parents 662aa1e + b10a844 commit c7375ed

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/components/ModalCloseButton.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
import { IconButton } from "@chakra-ui/react"
1+
import { IconButton, useStyleConfig } from "@chakra-ui/react"
22
import { CgClose } from "react-icons/cg"
33
import { ConfirmCloseAlert } from "./Alerts/ConfirmCloseAlert"
44
import { useState } from "react"
5+
import { themeOverrides } from "../theme"
56

67
type ModalCloseButtonProps = {
78
onClose: () => void
89
}
910

1011
export const ModalCloseButton = ({ onClose }: ModalCloseButtonProps) => {
1112
const [showModal, setShowModal] = useState(false)
13+
const styles = useStyleConfig("Modal") as (typeof themeOverrides)["components"]["Modal"]["baseStyle"]
1214
return (
1315
<>
1416
<ConfirmCloseAlert
@@ -20,14 +22,15 @@ export const ModalCloseButton = ({ onClose }: ModalCloseButtonProps) => {
2022
}}
2123
/>
2224
<IconButton
25+
right="14px"
26+
top="20px"
2327
variant="unstyled"
28+
sx={styles.closeModalButton}
2429
aria-label="Close modal"
2530
icon={<CgClose />}
2631
color="white"
2732
position="absolute"
2833
transform="translate(50%, -50%)"
29-
right="14px"
30-
top="20px"
3134
onClick={() => setShowModal(true)}
3235
zIndex="toast"
3336
dir="ltr"

src/theme.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ export const themeOverrides = {
312312
fontSize: "lg",
313313
color: "textColor",
314314
},
315+
closeModalButton: {},
315316
},
316317
variants: {
317318
rsi: {

0 commit comments

Comments
 (0)