Skip to content

Commit

Permalink
fix: fix shadow for rounded cornered single control (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
flops authored Jul 18, 2024
1 parent 3ce429c commit 168584d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/components/OverlayControls/OverlayControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class OverlayControls extends React.Component<OverlayControlsProps> {
)
: defaultControl;

const menu = this.renderMenu();
const menu = this.renderMenu(controls === null);

return (
<div
Expand All @@ -212,7 +212,7 @@ class OverlayControls extends React.Component<OverlayControlsProps> {
</div>
);
}
private renderMenu() {
private renderMenu(isOnlyOneItem: boolean) {
const {view, size} = this.props;

const dropdown = this.renderDropdownMenu();
Expand All @@ -227,7 +227,7 @@ class OverlayControls extends React.Component<OverlayControlsProps> {
view={view}
size={size}
title={i18n('label_delete')}
pin="brick-round"
pin={isOnlyOneItem ? 'round-round' : 'brick-round'}
onClick={this.onRemoveItem}
qa="dashkit-overlay-control-menu"
>
Expand Down Expand Up @@ -403,9 +403,10 @@ class OverlayControls extends React.Component<OverlayControlsProps> {
(item: OverlayControlItem, index: number, controlItems: OverlayControlItem[]) =>
this.renderControlsItem(item, index, controlItems.length),
);
const isOnlyOneItem = items.length === 0;

// Добавляем контрол удаления или меню виджета по умолчанию
result.push(this.renderMenu());
result.push(this.renderMenu(isOnlyOneItem));

return result;
}
Expand Down

0 comments on commit 168584d

Please sign in to comment.