Merged in feat/sw-3369-move-loadingspinner (pull request #2742)

feat(SW-3369): Move LoadingSpinner to design-system

* Move LoadingSpinner to design-system


Approved-by: Joakim Jäderberg
This commit is contained in:
Anton Gunnarsson
2025-09-02 06:46:58 +00:00
parent 914871607d
commit 65c6bc4c59
29 changed files with 59 additions and 31 deletions

View File

@@ -0,0 +1,29 @@
import type { Meta, StoryObj } from '@storybook/nextjs-vite'
import { LoadingSpinner } from './index'
const meta: Meta<typeof LoadingSpinner> = {
title: 'Components/LoadingSpinner',
component: LoadingSpinner,
argTypes: {
fullPage: {
control: 'check',
},
},
}
export default meta
type Story = StoryObj<typeof LoadingSpinner>
export const Default: Story = {
args: {
fullPage: false,
},
}
export const Fullpage: Story = {
args: {
fullPage: true,
},
}

View File

@@ -0,0 +1,22 @@
import styles from './loading.module.css'
export function LoadingSpinner({ fullPage }: { fullPage?: boolean }) {
return (
<div className={`${styles.container} ${fullPage ? styles.fullPage : ''}`}>
<div className={styles.spinner}>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</div>
)
}

View File

@@ -0,0 +1,76 @@
.container {
display: flex;
justify-content: center;
align-items: center;
height: 100px;
}
.fullPage {
min-height: 100dvh;
}
.spinner {
display: inline-block;
position: relative;
width: 40px;
height: 40px;
}
.spinner div {
transform-origin: 20px 20px;
animation: spinnerAnimation 0.8s linear infinite;
}
.spinner div::after {
content: ' ';
display: block;
position: absolute;
top: 3px;
left: 7px;
width: 6px;
height: 6px;
border-radius: 100%;
background: var(--Scandic-Brand-Burgundy);
}
.spinner div:nth-child(1) {
transform: rotate(0deg);
animation-delay: -0.7s;
}
.spinner div:nth-child(2) {
transform: rotate(45deg);
animation-delay: -0.6s;
}
.spinner div:nth-child(3) {
transform: rotate(90deg);
animation-delay: -0.5s;
}
.spinner div:nth-child(4) {
transform: rotate(135deg);
animation-delay: -0.4s;
}
.spinner div:nth-child(5) {
transform: rotate(180deg);
animation-delay: -0.3s;
}
.spinner div:nth-child(6) {
transform: rotate(225deg);
animation-delay: -0.2s;
}
.spinner div:nth-child(7) {
transform: rotate(270deg);
animation-delay: -0.1s;
}
.spinner div:nth-child(8) {
transform: rotate(315deg);
animation-delay: 0s;
}
@keyframes spinnerAnimation {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}