Initial commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import "./loading.css";
|
||||
|
||||
interface LoadingWithAnimationProps {
|
||||
color?: "primary" | "secondary";
|
||||
}
|
||||
|
||||
const LoadingWithAnimation = ({
|
||||
color = "primary",
|
||||
}: LoadingWithAnimationProps) => {
|
||||
return (
|
||||
<div className="loading loading-animation">
|
||||
<i className={`spinner ${color}`} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
interface LoadingWithImageProps {
|
||||
color?: "primary" | "secondary";
|
||||
}
|
||||
|
||||
const LoadingWithImage = ({ color = "primary" }: LoadingWithImageProps) => {
|
||||
return (
|
||||
<div className="loading loading-image">
|
||||
<i className={`spinner ${color}`} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export { LoadingWithAnimation, LoadingWithImage };
|
||||
@@ -0,0 +1,28 @@
|
||||
@tailwind components;
|
||||
|
||||
@layer components {
|
||||
.loading {
|
||||
@apply absolute left-1/2 top-1/2 size-full animate-spin-parent;
|
||||
}
|
||||
.spinner {
|
||||
@apply inline-block size-full animate-spin-child;
|
||||
}
|
||||
.loading-animation .spinner {
|
||||
@apply rounded-full border-[0.3rem];
|
||||
}
|
||||
.loading-animation .spinner.primary {
|
||||
@apply border-t-primary;
|
||||
}
|
||||
.loading-animation .spinner.secondary {
|
||||
@apply border-t-white;
|
||||
}
|
||||
.loading-image {
|
||||
@apply duration-1000;
|
||||
}
|
||||
.loading-image .spinner.primary {
|
||||
@apply bg-[url('../../../public/assets/images/loading_primary.png')] bg-no-repeat duration-0;
|
||||
}
|
||||
.loading-image .spinner.secondary {
|
||||
@apply bg-[url('../../../public/assets/images/loading_secondary.png')] bg-no-repeat duration-0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react";
|
||||
import { LoadingWithAnimation, LoadingWithImage } from ".";
|
||||
|
||||
const meta: Meta<typeof LoadingWithAnimation> = {
|
||||
title: "UI/Loading",
|
||||
component: LoadingWithAnimation,
|
||||
};
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof LoadingWithAnimation>;
|
||||
|
||||
export const Primary: Story = {
|
||||
render: () => (
|
||||
<div className="rounded-lg bg-secondary p-10 dark:bg-transparent">
|
||||
<div className="relative size-[5rem]">
|
||||
<LoadingWithAnimation color="primary" />
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
};
|
||||
|
||||
export const Secondary: Story = {
|
||||
render: () => (
|
||||
<div className="rounded-lg bg-secondary p-10 dark:bg-transparent">
|
||||
<div className="relative size-[5rem]">
|
||||
<LoadingWithAnimation color="secondary" />
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
};
|
||||
|
||||
export const PrimaryWithImage: Story = {
|
||||
render: () => (
|
||||
<div className="rounded-lg bg-secondary p-10 dark:bg-transparent">
|
||||
<div className="relative size-[5rem]">
|
||||
<LoadingWithImage color="primary" />
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
};
|
||||
|
||||
export const SecondaryWithImage: Story = {
|
||||
render: () => (
|
||||
<div className="rounded-lg bg-secondary p-10 dark:bg-transparent">
|
||||
<div className="relative size-[5rem]">
|
||||
<LoadingWithImage color="secondary" />
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
};
|
||||
Reference in New Issue
Block a user