diff --git a/packages/fxa-react/styles/flows.css b/packages/fxa-react/styles/flows.css index 93bead8daf8..fabd35a0786 100644 --- a/packages/fxa-react/styles/flows.css +++ b/packages/fxa-react/styles/flows.css @@ -6,8 +6,12 @@ * applied after content-server no longer needs it */ /* Transparent border around card is for Windows HCM mode */ +.card-base { + @apply w-full border border-transparent mobileLandscape:bg-white rounded-xl px-6 py-8 mobileLandscape:px-8 mobileLandscape:py-9 mobileLandscape:shadow-card-grey-drop mobileLandscape:mb-6; +} + .card { - @apply w-full border border-transparent mobileLandscape:w-120 mobileLandscape:bg-white rounded-xl px-6 py-8 mobileLandscape:px-8 mobileLandscape:py-9 mobileLandscape:shadow-card-grey-drop mobileLandscape:mb-6; + @apply card-base mobileLandscape:w-120; /* HACK until content-server no longer needs .card, otherwise component classes take precedence */ &.card-xl { @@ -26,3 +30,9 @@ @apply font-body font-normal text-sm block mt-1; } } + +/* HACK to shrink card in split layout so that the image on the left fits in the + * screen. Potentially useful in other cases */ +.card-shrink { + @apply card-base mobileLandscape:max-w-120; +} diff --git a/packages/fxa-settings/src/components/AppLayout/index.test.tsx b/packages/fxa-settings/src/components/AppLayout/index.test.tsx index 21ab1d15d03..51d4f1c3118 100644 --- a/packages/fxa-settings/src/components/AppLayout/index.test.tsx +++ b/packages/fxa-settings/src/components/AppLayout/index.test.tsx @@ -15,6 +15,7 @@ import { MOCK_CMS_INFO_HEADER_LOGO_NO_ALT, MOCK_CMS_INFO_DEFAULT_LOGO, MOCK_CMS_INFO_HEADER_LOGO_WITH_OTHER_PROPS, + MOCK_CMS_INFO_SPLIT_LAYOUT_BG, } from './mocks'; import { MOCK_CMS_INFO } from '../../pages/mocks'; import { useDynamicLocalization } from '../../contexts/DynamicLocalizationContext'; @@ -401,14 +402,19 @@ describe('', () => { isLoading: false, }); - const { container } = renderWithLocalizationProvider( - + renderWithLocalizationProvider( +

Split layout content

); - // Split layout does not render the card wrapper - expect(container.querySelector('.card')).not.toBeInTheDocument(); + expect( + screen.getByRole('img', { + name: MOCK_CMS_INFO_SPLIT_LAYOUT_BG.shared.backgrounds + ?.splitLayoutAltText as string, + }) + ).toBeInTheDocument(); + screen.getByText('Split layout content'); }); @@ -420,14 +426,19 @@ describe('', () => { isLoading: false, }); - const { container } = renderWithLocalizationProvider( + renderWithLocalizationProvider(

Default layout content

); - // Default layout renders with card wrapper - expect(container.querySelector('.card')).toBeInTheDocument(); + expect( + screen.queryByRole('img', { + name: MOCK_CMS_INFO_SPLIT_LAYOUT_BG.shared.backgrounds + ?.splitLayoutAltText as string, + }) + ).not.toBeInTheDocument(); + screen.getByText('Default layout content'); // CMS info is still applied even when split layout is disabled expect(screen.getByAltText('CMS Custom Logo')).toBeInTheDocument(); diff --git a/packages/fxa-settings/src/components/AppLayout/index.tsx b/packages/fxa-settings/src/components/AppLayout/index.tsx index e75d576cd9c..953d0b4472d 100644 --- a/packages/fxa-settings/src/components/AppLayout/index.tsx +++ b/packages/fxa-settings/src/components/AppLayout/index.tsx @@ -12,7 +12,6 @@ import { RelierCmsInfo } from '../../models/integrations'; import { LocaleToggle } from '../LocaleToggle'; import { useConfig } from '../../models/hooks'; import { CardLoadingSpinner } from '../CardLoadingSpinner'; -import LoadingSpinner from 'fxa-react/components/LoadingSpinner'; import { useDynamicLocalization } from '../../contexts/DynamicLocalizationContext'; type AppLayoutProps = { @@ -193,13 +192,13 @@ export const AppLayout = ({ />
-
- {loading ? ( - - ) : ( - children - )} -
+ {loading ? ( + + ) : ( +
+ {children} +
+ )}
{showLocaleToggle && (