Merge pull request 'fix(ui): add loader sizes' (#5067) from ui/fix-loader-scaling into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/5067
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
.loader {
|
.loader {
|
||||||
@apply relative;
|
@apply relative;
|
||||||
@apply w-4 h-4;
|
@apply size-full;
|
||||||
|
|
||||||
&.primary {
|
&.primary {
|
||||||
& > div.wrapper > div.parent,
|
& > div.wrapper > div.parent,
|
||||||
@@ -15,6 +15,18 @@
|
|||||||
background: #0051ff;
|
background: #0051ff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.sizeDefault {
|
||||||
|
@apply size-4;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.sizeLarge {
|
||||||
|
@apply size-8;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.sizeExtraLarge {
|
||||||
|
@apply size-12;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.wrapper {
|
.wrapper {
|
||||||
|
|||||||
@@ -1,9 +1,17 @@
|
|||||||
import type { Meta, StoryObj } from "@kachurun/storybook-solid";
|
import type { Meta, StoryObj } from "@kachurun/storybook-solid";
|
||||||
import { Loader, LoaderProps } from "@/src/components/Loader/Loader";
|
import { Loader, LoaderProps } from "@/src/components/Loader/Loader";
|
||||||
|
|
||||||
|
const LoaderExamples = (props: LoaderProps) => (
|
||||||
|
<div class="grid grid-cols-8">
|
||||||
|
<Loader {...props} size="default" />
|
||||||
|
<Loader {...props} size="l" />
|
||||||
|
<Loader {...props} size="xl" />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
const meta: Meta<LoaderProps> = {
|
const meta: Meta<LoaderProps> = {
|
||||||
title: "Components/Loader",
|
title: "Components/Loader",
|
||||||
component: Loader,
|
component: LoaderExamples,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default meta;
|
export default meta;
|
||||||
|
|||||||
@@ -7,15 +7,23 @@ export type Hierarchy = "primary" | "secondary";
|
|||||||
export interface LoaderProps {
|
export interface LoaderProps {
|
||||||
hierarchy?: Hierarchy;
|
hierarchy?: Hierarchy;
|
||||||
class?: string;
|
class?: string;
|
||||||
|
size?: "default" | "l" | "xl";
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Loader = (props: LoaderProps) => {
|
export const Loader = (props: LoaderProps) => {
|
||||||
|
const size = () => props.size || "default";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
class={cx(
|
class={cx(
|
||||||
styles.loader,
|
styles.loader,
|
||||||
styles[props.hierarchy || "primary"],
|
styles[props.hierarchy || "primary"],
|
||||||
props.class,
|
props.class,
|
||||||
|
{
|
||||||
|
[styles.sizeDefault]: size() === "default",
|
||||||
|
[styles.sizeLarge]: size() === "l",
|
||||||
|
[styles.sizeExtraLarge]: size() === "xl",
|
||||||
|
},
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div class={styles.wrapper}>
|
<div class={styles.wrapper}>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export const StepProgress = (props: StepProgressProps) => {
|
|||||||
when={store.error}
|
when={store.error}
|
||||||
fallback={
|
fallback={
|
||||||
<>
|
<>
|
||||||
<Loader class="size-8" />
|
<Loader size="l" />
|
||||||
<Typography hierarchy="body" size="s" weight="medium" family="mono">
|
<Typography hierarchy="body" size="s" weight="medium" family="mono">
|
||||||
{store.general?.name} is being created
|
{store.general?.name} is being created
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|||||||
Reference in New Issue
Block a user