Skip to content

Commit

Permalink
Fix/Studio spinner makes surroundings overflow (#11974)
Browse files Browse the repository at this point in the history
* removed studioCenter wrapper

* add some styling to the replacement

* replace studiCenter + studiospinner with studioPageSpinner

* use variable on gap-distance in styling

* remove unused variable
  • Loading branch information
lassopicasso authored Jan 9, 2024
1 parent 85999aa commit 0848b1e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { AppLogs } from './AppLogs';
import { Navigation } from './Navigation';
import { News } from './News';
import { PageContainer } from 'app-shared/components/PageContainer/PageContainer';
import { StudioCenter, StudioSpinner } from '@studio/components';
import { StudioPageSpinner } from '@studio/components';
import { useRepoMetadataQuery } from 'app-shared/hooks/queries';
import { RepoOwnedByPersonInfo } from './RepoOwnedByPersonInfo';

Expand All @@ -38,11 +38,7 @@ export const Overview = () => {
}

if (isPendingAppConfig || isPendingOrgs) {
return (
<StudioCenter>
<StudioSpinner spinnerText={t('general.loading')} className={classes.spinner} />
</StudioCenter>
);
return <StudioPageSpinner spinnerText={t('general.loading')} className={classes.spinner} />;
}

// If repo-owner is an organisation
Expand All @@ -53,7 +49,9 @@ export const Overview = () => {
<main className={classes.container}>
<header className={classes.header} role='generic'>
{/* According to https://developer.mozilla.org/en-US/docs/Web/HTML/Element/header, the role of <header> should implicitly be "generic" when it is a descendant of <main>, but Testing Library still interprets it as "banner". */}
<Heading level={1} size='xlarge'>{appConfigData?.serviceName || app}</Heading>
<Heading level={1} size='xlarge'>
{appConfigData?.serviceName || app}
</Heading>
</header>
<div className={classes.panel}>
<div className={classes.content}>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.spinnerWrapper {
display: flex;
justify-content: center;
align-items: center;
gap: var(--fds-spacing-1);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { HTMLAttributes, forwardRef, useId } from 'react';
import { Paragraph, Spinner } from '@digdir/design-system-react';
import type { SpinnerProps } from '@digdir/design-system-react';
import { useTranslation } from 'react-i18next';
import { StudioCenter } from '../StudioCenter';
import classes from './StudioSpinner.module.css';

export type StudioSpinnerProps = {
spinnerText?: string;
Expand All @@ -17,7 +17,7 @@ export const StudioSpinner = forwardRef<HTMLDivElement, StudioSpinnerProps>(
const spinnerDescriptionId = useId();

return (
<StudioCenter ref={ref} {...rest}>
<div className={classes.spinnerWrapper} ref={ref} {...rest}>
<Spinner
title={!spinnerText && t('general.loading')}
size={size}
Expand All @@ -30,7 +30,7 @@ export const StudioSpinner = forwardRef<HTMLDivElement, StudioSpinnerProps>(
{spinnerText}
</Paragraph>
)}
</StudioCenter>
</div>
);
},
);
Expand Down

0 comments on commit 0848b1e

Please sign in to comment.