From e11d21d2744cdcda706dce50cc87c2cf4832aa21 Mon Sep 17 00:00:00 2001 From: Clara Ni Date: Mon, 7 Oct 2024 13:45:36 +0200 Subject: [PATCH] front: fix items alignement in stdcm card Signed-off-by: Clara Ni --- .../stdcmV2/components/StdcmCard.tsx | 12 +- .../stdcmV2/components/StdcmConsist.tsx | 56 +++++--- .../stdcmV2/components/StdcmDefaultCard.tsx | 4 +- .../stdcmV2/components/StdcmDestination.tsx | 1 + .../stdcmV2/components/StdcmOpSchedule.tsx | 8 +- .../components/StdcmOperationalPoint.tsx | 6 +- .../stdcmV2/components/StdcmOrigin.tsx | 35 +++-- .../stdcmV2/components/StdcmStopType.tsx | 2 +- .../stdcmV2/components/StdcmVias.tsx | 15 +- .../SpeedLimitByTagSelector.tsx | 11 +- .../scss/applications/stdcmV2/_card.scss | 131 ++++++++++++++---- .../scss/applications/stdcmV2/_home.scss | 25 +--- 12 files changed, 192 insertions(+), 114 deletions(-) diff --git a/front/src/applications/stdcmV2/components/StdcmCard.tsx b/front/src/applications/stdcmV2/components/StdcmCard.tsx index ef4a3e3b568..3216c3abcd6 100644 --- a/front/src/applications/stdcmV2/components/StdcmCard.tsx +++ b/front/src/applications/stdcmV2/components/StdcmCard.tsx @@ -6,9 +6,17 @@ export type StdcmCardProps = { disabled?: boolean; title?: React.ReactNode; children: React.ReactNode; + className?: string; }; -const StdcmCard = ({ name, hasTip = false, disabled = false, title, children }: StdcmCardProps) => ( +const StdcmCard = ({ + name, + hasTip = false, + disabled = false, + title, + children, + className = '', +}: StdcmCardProps) => (
{name && (
)} -
{children}
+
{children}
); diff --git a/front/src/applications/stdcmV2/components/StdcmConsist.tsx b/front/src/applications/stdcmV2/components/StdcmConsist.tsx index 17bdc3e8542..de712595a6b 100644 --- a/front/src/applications/stdcmV2/components/StdcmConsist.tsx +++ b/front/src/applications/stdcmV2/components/StdcmConsist.tsx @@ -108,33 +108,43 @@ const StdcmConsist = ({ setCurrentSimulationInputs, disabled = false }: StdcmCon name={t('consist.consist')} title={} disabled={disabled} + className="consist" > -
-
- getLabel(suggestion)} - onSelectSuggestion={onSelectSuggestion} - /> -
-
- - -
- + getLabel(suggestion)} + onSelectSuggestion={onSelectSuggestion} />
+
+ + +
+ ); }; diff --git a/front/src/applications/stdcmV2/components/StdcmDefaultCard.tsx b/front/src/applications/stdcmV2/components/StdcmDefaultCard.tsx index 84afd2bc231..ea2e9b38c7a 100644 --- a/front/src/applications/stdcmV2/components/StdcmDefaultCard.tsx +++ b/front/src/applications/stdcmV2/components/StdcmDefaultCard.tsx @@ -14,9 +14,9 @@ const StdcmDefaultCard = ({ onClick, disabled = false, }: StdcmCardProps) => ( - + diff --git a/front/src/applications/stdcmV2/components/StdcmDestination.tsx b/front/src/applications/stdcmV2/components/StdcmDestination.tsx index 9fcd3d6340f..2cb41d40deb 100644 --- a/front/src/applications/stdcmV2/components/StdcmDestination.tsx +++ b/front/src/applications/stdcmV2/components/StdcmDestination.tsx @@ -101,6 +101,7 @@ const StdcmDestination = ({ name={t('trainPath.destination')} title={destination} disabled={disabled} + className="extremity" >
-
+ <> +
} + className="extremity" disabled={disabled} hasTip > -
- + {origin && ( + - {origin && ( - - )} -
+ )} ); }; diff --git a/front/src/applications/stdcmV2/components/StdcmStopType.tsx b/front/src/applications/stdcmV2/components/StdcmStopType.tsx index 2c2f05fbfd8..69105a7d666 100644 --- a/front/src/applications/stdcmV2/components/StdcmStopType.tsx +++ b/front/src/applications/stdcmV2/components/StdcmStopType.tsx @@ -12,7 +12,7 @@ const StdcmStopType = ({ stopTypes, updatePathStepStopType }: StdcmStopTypeProps const { t } = useTranslation('stdcm'); return ( -
+
.base-label-wrapper > label { + margin-bottom: 0; + } + } + + .speed-limit-by-tag-selector { + padding-right: 0.1875rem; + } + } + + &.extremity { + padding-bottom: 1.5rem; + + .arrival-type-select { + padding: 2.125rem 0 0 1rem; + } + + .schedule { + display: flex; + flex-direction: row; + padding-top: 1rem; + } + } + + &.via { + padding-right: 0.5rem; + padding-bottom: 0.8125rem; + + .location-line { + padding-right: 1rem; + } + + .stop-type-selector { + padding: 0.8125rem 1rem; + } + + .stop-time { + .feed-back { + padding: 0 1rem 0.8125rem 1rem; + } + } + } + + &.add-via { + padding: 0.6875rem 1.5rem 0.8125rem 0.75rem; } .stdcm-v2-default-card-button { - color: rgba(24, 68, 239, 1); - line-height: 24px; + color: var(--primary60); + line-height: 1.5rem; margin-left: 0.75rem; } + button:focus { outline: none; } @@ -118,15 +203,9 @@ button { display: contents; font-size: 1rem; - font-weight: 500; + font-weight: 600; cursor: pointer; - color: #256afa; + color: var(--primary60); } } } - -.stdcm-v2-card:last-of-type { - .stdcm-v2-card__body { - padding-bottom: 0.75rem; - } -} diff --git a/front/src/styles/scss/applications/stdcmV2/_home.scss b/front/src/styles/scss/applications/stdcmV2/_home.scss index e4c025d4d8f..dbbea1f3d13 100644 --- a/front/src/styles/scss/applications/stdcmV2/_home.scss +++ b/front/src/styles/scss/applications/stdcmV2/_home.scss @@ -2,7 +2,7 @@ font-family: 'IBM Plex Sans'; min-width: 85rem; - /* + /* We set the cursor to default to avoid the pointer cursor that appears due to role="button" on the div. The role="button" makes the div appear clickable, which causes the cursor to change to a pointer on hover. Using !important ensures that the cursor remains in its default state. @@ -59,25 +59,6 @@ height: 1.25rem; } } - .stdcm-v2-consist { - .osrd-config-item-container { - padding: 0 0.6rem 0 0; - .feed-back { - padding: 0; - } - } - } - .stdcm-v2-consist__properties { - .feed-back:nth-child(1) { - width: 7.75rem; - } - .feed-back:nth-child(2) { - width: 8.25rem; - } - * > .base-label-wrapper > label { - margin-bottom: 0; - } - } } .stdcm-v2__separator { @@ -95,10 +76,6 @@ position: relative; align-items: center; - & > div:not(:nth-last-child(-n + 2)) { - margin-bottom: 2rem; - } - > div { width: 100%; }