Skip to content

Commit

Permalink
fix: set quantity to 1 if exceed
Browse files Browse the repository at this point in the history
ref: TAPC-2456

Signed-off-by: Lionel Bueno <[email protected]>
  • Loading branch information
Lionel Bueno committed Jan 9, 2025
1 parent 103150d commit 667d9a4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
CENTS_PRICE,
convertHourlyPriceToMonthly,
} from '../../utils/commercial-catalog/utils';
import clsx from 'clsx';

Check failure on line 10 in packages/manager/apps/pci-savings-plan/src/components/Commitment/Commitment.tsx

View workflow job for this annotation

GitHub Actions / Lint Code Base

`clsx` import should occur before import of `./Commitment.utils`

Check failure on line 10 in packages/manager/apps/pci-savings-plan/src/components/Commitment/Commitment.tsx

View workflow job for this annotation

GitHub Actions / Lint Code Base

`clsx` import should occur before import of `./Commitment.utils`

const Commitment = ({
duration,
Expand Down Expand Up @@ -38,12 +39,12 @@ const Commitment = ({

return (
<OdsCard
className={`flex flex-row items-center mr-5 my-4 p-5 justify-between w-full cursor-pointer ${
isActive
? 'bg-[--ods-color-primary-050] border-[--ods-color-primary-500] border-2'
: ''
}`}
className={clsx(
'flex flex-row items-center mr-5 my-4 p-5 justify-between w-full cursor-pointer',
{ 'border-[--ods-color-primary-500] border-2': isActive },
)}
onClick={onClick}
color="neutral"
>
<span className="flex flex-row items-center justify-center">
<OdsText>{t('commitment_month', { value: duration })}</OdsText>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { usePciUrl } from '@ovh-ux/manager-pci-common';
import { QuantitySelector, usePciUrl } from '@ovh-ux/manager-pci-common';
import { Subtitle } from '@ovh-ux/manager-react-components';
import {
ODS_BUTTON_VARIANT,
Expand All @@ -7,6 +7,7 @@ import {
ODS_SPINNER_SIZE,
OdsInputChangeEvent,
} from '@ovhcloud/ods-components';

import {
OdsButton,
OdsCard,
Expand Down Expand Up @@ -317,12 +318,17 @@ const CreatePlanForm: FC<CreatePlanFormProps> = ({
<OdsQuantity
onOdsChange={(event: OdsInputChangeEvent) => {
const newValue = Number(event.detail.value);
if (newValue >= 1 && newValue <= 1000) onChangeQuantity(newValue);
if (newValue >= 1 && newValue <= 1000) {
onChangeQuantity(newValue);
} else {
onChangeQuantity(1);
}
}}
value={quantity}
min={1}
max={1000}
name="quantity"
isRequired
/>
</OdsCard>
<OdsMessage className="my-4" isDismissible={false}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const SimpleTile: React.FC<React.PropsWithChildren<{
},
className,
)}
color={'neutral'}
color="neutral"
onClick={onClick}
>
{children}
Expand Down

0 comments on commit 667d9a4

Please sign in to comment.