notionsoft-ui 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/templates/boolean-status-button/BooleanStatusButton.tsx +2 -2
- package/src/templates/button/button.tsx +2 -2
- package/src/templates/button-spinner/ButtonSpinner.stories.tsx +58 -0
- package/src/templates/button-spinner/button-spinner.tsx +26 -0
- package/src/templates/circle-loader/circle-loader.tsx +2 -2
- package/src/templates/sheet/AnimatedSheet.tsx +2 -2
- package/src/templates/shining-text/shining-text.tsx +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
3
|
-
import { cn } from "@/utils/cn";
|
|
2
|
+
import { cn } from "../../utils/cn";
|
|
3
|
+
// import { cn } from "@/utils/cn";
|
|
4
4
|
|
|
5
5
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
6
6
|
variant?: "primary" | "secondary" | "warning" | "success";
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import Button from "../button/button";
|
|
2
|
+
import ButtonSpinner from "./button-spinner";
|
|
3
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof ButtonSpinner> = {
|
|
6
|
+
title: "Components/ButtonSpinner",
|
|
7
|
+
component: ButtonSpinner,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: "centered",
|
|
10
|
+
},
|
|
11
|
+
argTypes: {
|
|
12
|
+
loading: { control: "boolean" },
|
|
13
|
+
className: { control: "text" },
|
|
14
|
+
children: { control: "text" },
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default meta;
|
|
19
|
+
type Story = StoryObj<typeof ButtonSpinner>;
|
|
20
|
+
|
|
21
|
+
/* -----------------------------
|
|
22
|
+
Template: how ButtonSpinner
|
|
23
|
+
is intended to be used
|
|
24
|
+
------------------------------ */
|
|
25
|
+
const Template = (args) => (
|
|
26
|
+
<Button disabled={args.loading} className="flex items-center gap-3">
|
|
27
|
+
<ButtonSpinner {...args} />
|
|
28
|
+
</Button>
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
/* -----------------------------
|
|
32
|
+
Stories
|
|
33
|
+
------------------------------ */
|
|
34
|
+
|
|
35
|
+
export const Default: Story = {
|
|
36
|
+
render: Template,
|
|
37
|
+
args: {
|
|
38
|
+
loading: false,
|
|
39
|
+
children: "Save",
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const Loading: Story = {
|
|
44
|
+
render: Template,
|
|
45
|
+
args: {
|
|
46
|
+
loading: true,
|
|
47
|
+
children: "Saving...",
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const WithCustomClass: Story = {
|
|
52
|
+
render: Template,
|
|
53
|
+
args: {
|
|
54
|
+
loading: true,
|
|
55
|
+
className: "text-blue-600 font-semibold",
|
|
56
|
+
children: "Processing...",
|
|
57
|
+
},
|
|
58
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { cn } from "../../utils/cn";
|
|
2
|
+
// import { cn } from "@/utils/cn";
|
|
3
|
+
|
|
4
|
+
export interface IButtonSpinnerProps {
|
|
5
|
+
children: any;
|
|
6
|
+
loading: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default function ButtonSpinner(props: IButtonSpinnerProps) {
|
|
11
|
+
const { loading, children, className } = props;
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
{loading && (
|
|
15
|
+
<div className="relative w-[16px] h-[16px]">
|
|
16
|
+
{/* <!-- Ring --> */}
|
|
17
|
+
<div
|
|
18
|
+
className="w-[16px] h-[16px] rounded-full animate-spin absolute
|
|
19
|
+
border border-solid border-secondary border-t-transparent"
|
|
20
|
+
/>
|
|
21
|
+
</div>
|
|
22
|
+
)}
|
|
23
|
+
<h1 className={cn("", className)}>{children}</h1>
|
|
24
|
+
</>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { useSpring, animated } from "@react-spring/web";
|
|
3
|
-
|
|
4
|
-
import { cn } from "@/utils/cn";
|
|
3
|
+
import { cn } from "../../utils/cn";
|
|
4
|
+
// import { cn } from "@/utils/cn";
|
|
5
5
|
|
|
6
6
|
interface ShiningTextProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
7
7
|
text: string;
|