Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModalView quick fix #4978

Merged
merged 2 commits into from
Oct 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,14 @@ const ModalBase: React.FC<ModalBaseProps> = ({

const modalButtonView: ModalButtonView = {
variant: props?.variant || "outlined",
label: props?.label || "Open Modal",
label: props?.label || "",
Br2850 marked this conversation as resolved.
Show resolved Hide resolved
componentsProps: {
button: {
sx: {
height: props?.height || "100%",
width: props?.width || "100%",
padding: 1,
padding: props?.padding || 1,
minWidth: 0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it was a weird edge case. So basically when I try to render ModalView at the top level button, if it is only an Icon then it inherits both the width of normal Button + Icon which was causing a generic Arrow for example to have way too much space & padding

Adding minWidth=0 while also giving flexibility to padding gives the best of both worlds ie., no extra icon padding and can still define additional padding to supplant minWidth on a regular button look

},
},
},
Expand Down Expand Up @@ -206,7 +207,7 @@ const ModalBase: React.FC<ModalBaseProps> = ({
id="modal-title"
variant="h5"
component="h5"
sx={{ textAlign: titleAlign }}
sx={{ textAlign: titleAlign, verticalAlign: "middle" }}
Br2850 marked this conversation as resolved.
Show resolved Hide resolved
>
{modal?.icon && (
<MuiIconFont
Expand Down
Loading