Skip to content

Commit

Permalink
fix(Popover): no left-side overflow due to negative margins (#736)
Browse files Browse the repository at this point in the history
  • Loading branch information
gearoffortune authored Jun 23, 2023
1 parent 24cfc5b commit c113920
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
10 changes: 1 addition & 9 deletions src/components/Popover/Popover.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ $block: '.#{variables.$ns}popover';
min-height: 40px;
max-width: var(--yc-popover-max-width);
padding: var(--yc-popover-padding);
display: flex;
flex-direction: column;
cursor: default;

&-title {
Expand All @@ -37,10 +35,8 @@ $block: '.#{variables.$ns}popover';
}

&-buttons {
align-self: center;
display: inline-flex;
display: flex;
flex-wrap: wrap;
width: 100%;
// giving additional -5 margin
// this is taking into account the margins of buttons
// to imitate the `gap` property for flexbox
Expand Down Expand Up @@ -114,10 +110,6 @@ $block: '.#{variables.$ns}popover';
--yc-popup-background-color: var(--yc-color-base-simple-hover-solid);
--yc-popup-border-color: var(--yc-color-base-simple-hover-solid);
}

#{$class}__tooltip-buttons {
width: auto;
}
}

&_special {
Expand Down
22 changes: 18 additions & 4 deletions src/components/Popover/__stories__/Popover.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,6 @@ FullFeatured.args = {
text: 'Action',
onClick: () => alert('Action button was clicked'),
},
tooltipCancelButton: {
text: 'Cancel',
onClick: () => alert('Cancel button was clicked'),
},
links: [
{
text: 'Link with a href',
Expand Down Expand Up @@ -183,6 +179,24 @@ WithLongActionItems.args = {
theme: 'info',
};

export const WithAlmostLongActionItems = FullFeaturedTemplate.bind({});
WithAlmostLongActionItems.args = {
autoclosable: false,
content: 'There are two actions',
tooltipActionButton: {
text: 'Action with more',
onClick: () => alert('Action button was clicked'),
},
tooltipCancelButton: {
text: 'Action with',
onClick: () => alert('Cancel button was clicked'),
},
className: 'demo-icon-tooltip',
openOnHover: false,
behavior: PopoverBehavior.Delayed,
theme: 'info',
};

const WithCustomAnchorTemplate: StoryFn = () => <WithCustomAnchorExample />;
export const WithCustomAnchor = WithCustomAnchorTemplate.bind({});
WithCustomAnchor.args = {
Expand Down

0 comments on commit c113920

Please sign in to comment.