Skip to content

Commit

Permalink
UGN-374 bugfix - add custom styling ability to modal close button
Browse files Browse the repository at this point in the history
  • Loading branch information
JulitorK committed Sep 4, 2023
1 parent 662aa1e commit b10a844
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/ModalCloseButton.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { IconButton } from "@chakra-ui/react"
import { IconButton, useStyleConfig } from "@chakra-ui/react"
import { CgClose } from "react-icons/cg"
import { ConfirmCloseAlert } from "./Alerts/ConfirmCloseAlert"
import { useState } from "react"
import { themeOverrides } from "../theme"

type ModalCloseButtonProps = {
onClose: () => void
}

export const ModalCloseButton = ({ onClose }: ModalCloseButtonProps) => {
const [showModal, setShowModal] = useState(false)
const styles = useStyleConfig("Modal") as (typeof themeOverrides)["components"]["Modal"]["baseStyle"]
return (
<>
<ConfirmCloseAlert
Expand All @@ -20,14 +22,15 @@ export const ModalCloseButton = ({ onClose }: ModalCloseButtonProps) => {
}}
/>
<IconButton
right="14px"
top="20px"
variant="unstyled"
sx={styles.closeModalButton}
aria-label="Close modal"
icon={<CgClose />}
color="white"
position="absolute"
transform="translate(50%, -50%)"
right="14px"
top="20px"
onClick={() => setShowModal(true)}
zIndex="toast"
dir="ltr"
Expand Down
1 change: 1 addition & 0 deletions src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ export const themeOverrides = {
fontSize: "lg",
color: "textColor",
},
closeModalButton: {},
},
variants: {
rsi: {
Expand Down

0 comments on commit b10a844

Please sign in to comment.