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

fix: Don’t clip 'ConfirmationDialog' button outlines #1203

Merged
merged 3 commits into from
May 3, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
21 changes: 20 additions & 1 deletion src/Dialog/ConfirmationDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ const StyledConfirmationFooter = styled(Box)`
button {
font-size: ${get('fontSizes.1')};
flex: 1 1 0;
border-radius: 0;
border-bottom: 0;
margin: 0;
border-right: 0;
Expand All @@ -89,6 +88,26 @@ const StyledConfirmationFooter = styled(Box)`
z-index: 1;
}
}
button:first-of-type:not(:last-of-type) {
// All except border-bottom-left-radius, which should follow the curvature of the container
border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
button:last-of-type:not(:first-of-type) {
// All except border-bottom-right-radius, which should follow the curvature of the container
border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-left-radius: 0;
}
button:first-of-type:last-of-type {
// When the footer contains a single button, it should follow the curvature of the container
border-top-left-radius: 0;
border-top-right-radius: 0;
}
button:not(:first-of-type):not(:last-of-type) {
border-radius: 0;
}
Comment on lines +108 to +110
Copy link
Member

Choose a reason for hiding this comment

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

Great coverage here for all cases except button:first-of-type:last-of-type if there is only 1 button. If we are assuming there will always be exactly 2 buttons, then this last section can be removed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh interesting, great catch! I hadn’t considered a ConfirmationDialog with only one button. I’ll update this on Monday. 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in b2bdb66!

Before After
before after

`
const ConfirmationFooter: React.FC<DialogProps> = ({footerButtons}) => {
const {containerRef: footerRef} = useFocusZone({
Expand Down
1 change: 0 additions & 1 deletion src/Dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ const StyledDialog = styled.div<StyledDialogProps & SystemCommonProps & SystemPo
width: ${props => widthMap[props.width ?? ('xl' as const)]};
height: ${props => heightMap[props.height ?? ('auto' as const)]};
border-radius: 12px;
overflow: hidden;
opacity: 1;
animation: overlay--dialog-appear ${ANIMATION_DURATION} ${get('animation.easeOutCubic')};

Expand Down