ui/loading-bar: move into component

This commit is contained in:
Johannes Kirschbauer
2025-08-05 16:20:56 +02:00
parent 49a5763f69
commit 7b54e9b033
5 changed files with 51 additions and 26 deletions

View File

@@ -0,0 +1,22 @@
import type { Meta, StoryContext, StoryObj } from "@kachurun/storybook-solid";
import { LoadingBar } from "./LoadingBar";
const meta: Meta = {
title: "Components/LoadingBar",
component: LoadingBar,
decorators: [
(Story: StoryObj, context: StoryContext<unknown>) => {
return (
<div class={"flex w-fit items-center justify-center bg-slate-500 p-10"}>
<Story />
</div>
);
},
],
};
export default meta;
type Story = StoryObj;
export const Default: Story = {};

View File

@@ -0,0 +1,24 @@
.loading_bar {
@apply h-3 w-60;
width: 18rem;
background: repeating-linear-gradient(
-45deg,
#bfd0d2 0px,
#bfd0d2 10px,
#f7f9fa 10px,
#f7f9fa 20px
);
animation: stripe-move 1s linear infinite;
background-size: 28px 28px; /* Sqrt(20^2 + 20^2) ~= 28 */
@apply border-2 border-solid rounded-[3px] border-bg-def-1;
}
@keyframes stripe-move {
0% {
background-position: 0 0;
}
100% {
background-position: 28px 0;
}
}

View File

@@ -0,0 +1,3 @@
import styles from "./LoadingBar.module.css";
export const LoadingBar = () => <div class={styles.loading_bar} />;

View File

@@ -18,28 +18,3 @@
.splash_title {
@apply h-8 mb-8;
}
.loading_bar {
@apply h-3 w-60 mb-3;
width: 18rem;
background: repeating-linear-gradient(
-45deg,
#bfd0d2 0px,
#bfd0d2 10px,
#f7f9fa 10px,
#f7f9fa 20px
);
animation: stripe-move 1s linear infinite;
background-size: 28px 28px; /* Sqrt(20^2 + 20^2) ~= 28 */
@apply border-2 border-solid rounded-[3px] border-bg-def-1;
}
@keyframes stripe-move {
0% {
background-position: 0 0;
}
100% {
background-position: 28px 0;
}
}

View File

@@ -1,6 +1,7 @@
import Logo from "@/logos/darknet-builder-logo.svg";
import styles from "./splash.module.css";
import { Typography } from "../components/Typography/Typography";
import { LoadingBar } from "../components/LoadingBar/LoadingBar";
export const Splash = () => (
<div class={styles.splash}>
@@ -8,7 +9,7 @@ export const Splash = () => (
<span class={styles.splash_title}>
<Logo />
</span>
<div class={styles.loading_bar} />
<LoadingBar />
<Typography hierarchy="label" size="xs" weight="medium">
Loading new Clan