Skip to content

Commit

Permalink
fix(svp): add link in action menu (#14993)
Browse files Browse the repository at this point in the history
Co-authored-by: Lionel Bueno <lionel.bueno.ext@ovhcloud.com>
  • Loading branch information
2 people authored and acavalloni committed Jan 20, 2025
1 parent c4e044e commit a813e52
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Ugly patch for ODS to manager link like Button in ActionMenu
.menu-item-link {
&::part(link) {
box-sizing: border-box;
width: 100%;
justify-content: left;
padding: 0 6px;
height: 32px;
}

&:not([is-disabled='true']) {
&::part(link) {
background-size: 0;

&:hover {
border-radius: 5px;
background-color: var(--ods-color-primary-100);
}
}
}
}

// Customize <OdsButton />
.menu-item-button {
&::part(button) {
width: 100%;
justify-content: left;
height: 32px;
border-radius: 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
ODS_BUTTON_VARIANT,
ODS_ICON_NAME,
} from '@ovhcloud/ods-components';
import { OdsButton, OdsPopover } from '@ovhcloud/ods-components/react';
import { OdsButton, OdsLink, OdsPopover } from '@ovhcloud/ods-components/react';
import { usePciUrl } from '@ovh-ux/manager-pci-common';
import {
ButtonType,
Expand All @@ -18,6 +18,7 @@ import {
SavingsPlanPlanedChangeStatus,
SavingsPlanStatus,
} from '@/types/api.type';
import './ActionCell.scss';

interface SavingsPlanActionsCell {
onClickEditName: (path: string) => void;
Expand Down Expand Up @@ -77,23 +78,19 @@ const MenuItems = ({
/>
)}

<OdsButton
<OdsLink
href={
isInstance ? `${pciUrl}/instances/new` : `${pciUrl}/rancher/new`
}
className="menu-item-link"
label={t(isInstance ? 'order_instance' : 'order_rancher')}
size={ODS_BUTTON_SIZE.sm}
variant={ODS_BUTTON_VARIANT.ghost}
text-align="start"
onClick={() => {
trackClick({
location: PageLocation.page,
buttonType: ButtonType.button,
actionType: 'navigation',
actions: ['add_instance'],
});
if (isInstance) {
navigate(`${pciUrl}/instances/new`);
} else {
navigate(`${pciUrl}/rancher/new`);
}
}}
/>
</div>
Expand Down

0 comments on commit a813e52

Please sign in to comment.