Skip to content

Commit

Permalink
Update styles for custom modal footer
Browse files Browse the repository at this point in the history
  • Loading branch information
kkosiorowska committed Mar 21, 2024
1 parent 5becae7 commit eaad94a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
import { TextMd } from "#/components/shared/Typography"
import { EXTERNAL_HREF } from "#/constants"
import IconWrapper from "#/components/shared/IconWrapper"
import { MODAL_BASE_SIZE } from "#/components/shared/ModalBase"

export default function ServerErrorModal({
isLoading,
Expand Down Expand Up @@ -63,6 +64,13 @@ export default function ServerErrorModal({
justifyContent="space-between"
bgColor="gold.200"
borderRadius="xl"
// The dialog container style has padding set by default.
// However, the modal footer should be positioned outside this padding.
// To avoid changing it, let's set the position to relative and calculate the correct width.
position="relative"
bottom={-4}
left={-4}
w={`calc(var(--chakra-sizes-${MODAL_BASE_SIZE}) - 0.25rem)`}
>
<Flex flexDirection="column">
<HStack>
Expand Down
4 changes: 3 additions & 1 deletion dapp/src/components/shared/ModalBase/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import React from "react"
import { Modal, ModalContent, ModalOverlay, ModalProps } from "@chakra-ui/react"

export const MODAL_BASE_SIZE = "lg"

export default function ModalBase({ children, ...restProps }: ModalProps) {
return (
<Modal size="lg" {...restProps}>
<Modal size={MODAL_BASE_SIZE} {...restProps}>
<ModalOverlay mt="header_height" />
<ModalContent mt="modal_shift">{children}</ModalContent>
</Modal>
Expand Down

0 comments on commit eaad94a

Please sign in to comment.