Skip to content

Commit 7bcdaca

Browse files
committed
feat(ips): reworking the appearance of the BYOIP page
ref: #MANAGER-19852 Signed-off-by: aderghamov <[email protected]>
1 parent 342121a commit 7bcdaca

File tree

7 files changed

+83
-18
lines changed

7 files changed

+83
-18
lines changed

packages/manager/apps/ips/public/translations/byoip/Messages_fr_FR.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
"description": "Importez vos propres adresses IP publiques et utilisez les sur les services OVHcloud éligibles.",
44
"rir_selection_title": "Sélectionnez votre RIR - Regional Internet Registry",
55
"rir_selection_description": "Sélectionnez le RIR qui gère vos adresses IP publiques.",
6+
"rir_selection_APNIC_description": "Registre Internet régional pour l'Asie-Pacifique",
7+
"rir_selection_ARIN_description": "Registre américain des numéros Internet",
8+
"rir_selection_RIPE_description": "Registre Internet régional pour l'Europe, le Moyen-Orient et l'Asie centrale",
69
"region_selection_title": "Séléctionnez votre campus",
710
"region_selection_description": "Un campus est l'ensemble de datacentres sur lesquels vous pourrez déplacer vos adresses IP. La liste des datacentres composant un campus est affichée ci-dessous. Vous devez sélectionner le campus ou seront situés vos services.",
811
"region_token_title": "Token",
@@ -26,5 +29,22 @@
2629
"ip_byoip_disclaimer_description_point_3": "Avoir une réputation saine sur cette plage d'adresses IP",
2730
"ip_byoip_disclaimer_ordering_delay_message": "Veuillez noter que ce processus peut prendre approximativement 3 semaines. Nous vous prions de nous excuser pour ce désagrément.",
2831
"ip_byoip_disclaimer_confirm_text": "Valider",
29-
"ip_byoip_disclaimer_cancel_text": "Annuler"
32+
"ip_byoip_disclaimer_cancel_text": "Annuler",
33+
"region_ERI": "Londres (ERI) - Angleterre",
34+
"region_BHS": "Beauharnois (BHS) - Canada",
35+
"region_DC": "Beauharnois (DC) - Canada",
36+
"region_GRA": "Gravelines (GRA) - France",
37+
"region_HIL": "Hillsboro (HIL) - États-Unis",
38+
"region_LIM": "Limburg (LIM) - Allemagne",
39+
"region_RBX": "Roubaix (RBX) - France",
40+
"region_SBG": "Strasbourg (SBG) - France",
41+
"region_SGP": "Singapour (SGP) - Asie",
42+
"region_SYD": "Sydney (SYD) - Australie",
43+
"region_VIN": "Vint Hill (VIN) - États-Unis",
44+
"region_WAW": "Varsovie (WAW) - Pologne",
45+
"region_RBX_HZ": "Roubaix (RBXHZ) - France",
46+
"region_GSW": "(GSW) - France",
47+
"region_YNM": "Mumbai (YNM) - Inde",
48+
"region_YYZ": "Toronto (YYZ) - Canada",
49+
"region_PAR": "Paris (PAR) - France"
3050
}

packages/manager/apps/ips/src/components/OptionCard/OptionCard.component.tsx

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
OdsDivider,
1010
OdsText,
1111
OdsSpinner,
12+
OdsRadio,
1213
} from '@ovhcloud/ods-components/react';
1314
import { handleClick } from '@ovh-ux/manager-react-components';
1415
import './option-card.scss';
@@ -18,6 +19,7 @@ export type OptionCardProps = React.PropsWithChildren<{
1819
isDisabled?: boolean;
1920
isSelected?: boolean;
2021
isLoading?: boolean;
22+
hasRadioButton?: boolean;
2123
onClick?: () => void;
2224
title: React.ReactNode;
2325
subtitle?: React.ReactNode;
@@ -29,6 +31,7 @@ export const OptionCard: React.FC<OptionCardProps> = ({
2931
isDisabled,
3032
isSelected,
3133
isLoading,
34+
hasRadioButton,
3235
onClick,
3336
title,
3437
description,
@@ -38,43 +41,59 @@ export const OptionCard: React.FC<OptionCardProps> = ({
3841
const stateStyle = isDisabled
3942
? 'cursor-not-allowed bg-neutral-100'
4043
: 'cursor-pointer hover:shadow-md';
41-
const borderStyle = isSelected ? 'option_card_selected' : 'm-[1px]';
44+
const borderStyle = isSelected
45+
? 'option_card_selected'
46+
: 'option_card m-[1px]';
47+
const justifyStyle = hasRadioButton ? 'justify-left' : 'justify-center';
4248
return (
4349
<OdsCard
4450
tabIndex={0}
45-
className={`flex flex-col p-3 transition-shadow ${stateStyle} ${borderStyle} ${className}`}
51+
className={`flex flex-col justify-between transition-shadow ${stateStyle} ${borderStyle} ${className}`}
4652
{...handleClick(() => !isDisabled && onClick?.())}
4753
color={ODS_CARD_COLOR.neutral}
4854
>
49-
<OdsText
50-
className="flex justify-center mb-2"
51-
preset={ODS_TEXT_PRESET.heading4}
52-
>
53-
{title}
54-
</OdsText>
55+
{hasRadioButton ? (
56+
<OdsText
57+
className="flex justify-left m-4"
58+
preset={ODS_TEXT_PRESET.heading4}
59+
>
60+
<span className="h-full align-middle mr-3">
61+
<OdsRadio name="" is-checked={isSelected}></OdsRadio>
62+
</span>
63+
<span>{title}</span>
64+
</OdsText>
65+
) : (
66+
<OdsText
67+
className="flex justify-center mb-2"
68+
preset={ODS_TEXT_PRESET.heading4}
69+
>
70+
{title}
71+
</OdsText>
72+
)}
5573
{subtitle && (
5674
<OdsText
5775
preset={ODS_TEXT_PRESET.paragraph}
58-
className="flex justify-center mb-4"
76+
className={`flex ${justifyStyle} m-4`}
5977
>
6078
{subtitle}
6179
</OdsText>
6280
)}
6381
{description && (
6482
<OdsText
65-
className="flex justify-center text-center"
83+
className={`flex ${justifyStyle} m-4 text-center`}
6684
preset={ODS_TEXT_PRESET.paragraph}
6785
>
6886
{description}
6987
</OdsText>
7088
)}
71-
{children && <OdsDivider className="block -ml-3 -mr-3 mt-auto mb-2" />}
7289
{isLoading ? (
7390
<div className="text-center">
7491
<OdsSpinner size={ODS_SPINNER_SIZE.xs} />
7592
</div>
7693
) : (
77-
children
94+
children && (
95+
<span className="card-children p-4 rounded-b-md">{children}</span>
96+
)
7897
)}
7998
</OdsCard>
8099
);
Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1+
.option_card {
2+
border-color: var(--ods-color-primary-100);
3+
.card-children {
4+
background-color: var(--ods-color-neutral-050);
5+
}
6+
}
7+
18
.option_card_selected {
2-
border: 2px solid #0050d7;
9+
border: 2px solid var(--ods-color-information-500);
10+
background-color: #f3fdff;
311
margin: 0;
12+
13+
.card-children {
14+
background-color: var(--ods-color-primary-050);
15+
}
416
}

packages/manager/apps/ips/src/pages/byoip/sections/AsOwnTypeSelectionSection.component.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ export const AsOwnTypeSelectionSection: React.FC = () => {
3737
}
3838
return (
3939
<OrderSection title={t('ip_byoip_as_rir_title')}>
40-
<div className="grid grid-rows-2 gap-3">
40+
<div className="grid grid-cols-3 gap-3">
4141
{campusValues.map((value) => (
4242
<OptionCard
4343
key={value}
4444
title={value}
45+
hasRadioButton={true}
4546
isSelected={asOwnRirType === value}
4647
onClick={() => setAsOwnRirType(value)}
4748
/>

packages/manager/apps/ips/src/pages/byoip/sections/AsTypeSelectionSection.component.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ export const AsTypeSelectionSection: React.FC = () => {
2020
title={t('ip_byoip_as_system_title')}
2121
description={t('ip_byoip_as_system_description')}
2222
>
23-
<div className="grid grid-rows-2 gap-3">
23+
<div className="grid grid-cols-2 gap-3">
2424
{AS_OPTIONS.map((value) => (
2525
<OptionCard
2626
key={value}
27+
hasRadioButton={true}
2728
title={t(`ip_byoip_as_type_${value}`)}
2829
isSelected={asType === value}
2930
onClick={() => handleAsTypeChange(value)}

packages/manager/apps/ips/src/pages/byoip/sections/RegionSelectionSection.component.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ import { RegionCard } from '@/components/RegionCard/RegionCard.component';
77
import { useGetCatalog, CONFIG_NAME } from '@/data/hooks/catalog/useGetCatalog';
88
import { getConfigValues } from '../Byoip.utils';
99
import { ByoipContext } from '../Byoip.context';
10+
import { OptionCard } from '@/components/OptionCard/OptionCard.component';
1011

1112
type CampusType = {
1213
name: string;
1314
planCode: string;
1415
};
1516

1617
export const RegionSelectionSection: React.FC = () => {
17-
const { t } = useTranslation('byoip');
18+
const { t } = useTranslation(['byoip']);
1819
const { data: catalog, isLoading } = useGetCatalog();
1920
const { selectedRegion, setSelectedRegion } = React.useContext(ByoipContext);
2021

@@ -38,6 +39,14 @@ export const RegionSelectionSection: React.FC = () => {
3839
>
3940
<div className="grid grid-cols-3 gap-2">
4041
{campusValues.map((value) => (
42+
<OptionCard
43+
key={value.name}
44+
title={t(`region_${value.name}`)}
45+
hasRadioButton={true}
46+
isSelected={selectedRegion === value.name}
47+
onClick={() => setSelectedRegion(value.name)}
48+
/>
49+
/*
4150
<RegionCard
4251
key={value.name}
4352
title={value.name}
@@ -48,6 +57,7 @@ export const RegionSelectionSection: React.FC = () => {
4857
>
4958
<OdsText preset={ODS_TEXT_PRESET.paragraph}>{value.name}</OdsText>
5059
</RegionCard>
60+
*/
5161
))}
5262
</div>
5363
</OrderSection>

packages/manager/apps/ips/src/pages/byoip/sections/RirSelectionSection.component.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ export const RirSelectionSection: React.FC = () => {
3131
title={t('rir_selection_title')}
3232
description={t('rir_selection_description')}
3333
>
34-
<div className="grid grid-rows-2 gap-3">
34+
<div className="grid grid-cols-3 gap-3">
3535
{ipRirValues.map((value) => (
3636
<OptionCard
3737
key={value}
3838
title={value}
39+
subtitle={t(`rir_selection_${value}_description`)}
40+
hasRadioButton={true}
3941
isSelected={ipRir === value}
4042
onClick={() => setIpRir(value)}
4143
/>

0 commit comments

Comments
 (0)