@edu-tosel/design 1.0.289 → 1.0.291
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/layout/template/home/layout/Carousel.d.ts +6 -1
- package/layout/template/home/layout/Carousel.js +7 -6
- package/package.json +1 -1
- package/slidemodal/index.d.ts +1 -0
- package/slidemodal/index.js +1 -0
- package/slidemodal/template/index.d.ts +9 -0
- package/slidemodal/template/index.js +52 -0
- package/version.txt +1 -1
- package/modalV2/index.d.ts +0 -1
- package/modalV2/index.js +0 -1
- package/modalV2/template/index.d.ts +0 -22
- package/modalV2/template/index.js +0 -51
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { CarouselContent } from "../../../../interface";
|
|
2
|
-
|
|
2
|
+
interface CarouselOption {
|
|
3
|
+
isStatic?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export default function Carousel({ contents, option, }: {
|
|
3
6
|
contents: CarouselContent[];
|
|
7
|
+
option?: CarouselOption;
|
|
4
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -7,15 +7,14 @@ import { LineBreaks } from "../../../../text";
|
|
|
7
7
|
import SVG from "../../../../asset/SVG";
|
|
8
8
|
import { tagString } from "../../../../interface/domain";
|
|
9
9
|
import useResponsive from "../../../../hook/useResponsive";
|
|
10
|
-
export default function Carousel({ contents, }) {
|
|
10
|
+
export default function Carousel({ contents, option, }) {
|
|
11
11
|
const [index, setIndex] = useState(0);
|
|
12
12
|
const [flag, inTime] = useEase(10000, 1000);
|
|
13
13
|
const [loaded, setLoaded] = useState(false);
|
|
14
14
|
const isMD = useResponsive("md");
|
|
15
15
|
const isXL = useResponsive("xl");
|
|
16
16
|
const intervalRef = useRef(null);
|
|
17
|
-
const { tag, titles, image
|
|
18
|
-
const { text, background } = option ?? {};
|
|
17
|
+
const { tag, titles, image } = contents[index];
|
|
19
18
|
// Transition animation using react-spring
|
|
20
19
|
const transitionStyles = useSpring({
|
|
21
20
|
opacity: loaded ? 1 : 0,
|
|
@@ -36,7 +35,9 @@ export default function Carousel({ contents, }) {
|
|
|
36
35
|
}, 3000);
|
|
37
36
|
}, [contents.length]);
|
|
38
37
|
useEffect(() => {
|
|
39
|
-
|
|
38
|
+
if (!option?.isStatic) {
|
|
39
|
+
resetTimer(); // timerstarts after mounting component
|
|
40
|
+
}
|
|
40
41
|
return () => {
|
|
41
42
|
// clear timer after unmounting component
|
|
42
43
|
if (intervalRef.current) {
|
|
@@ -59,7 +60,7 @@ export default function Carousel({ contents, }) {
|
|
|
59
60
|
displays: "relative flex justify-center items-center",
|
|
60
61
|
sizes: "w-full h-fit md:h-80 ml:h-100",
|
|
61
62
|
textstyle: "break-keep",
|
|
62
|
-
background,
|
|
63
|
+
background: contents[index].option?.background,
|
|
63
64
|
animations: "duration-300",
|
|
64
65
|
};
|
|
65
66
|
const titleWrapper = {
|
|
@@ -81,7 +82,7 @@ export default function Carousel({ contents, }) {
|
|
|
81
82
|
const body = {
|
|
82
83
|
displays: "flex flex-none flex-col items-center justify-center md:flex-row",
|
|
83
84
|
sizes: "w-full max-w-256 h-full",
|
|
84
|
-
text: text ?? "text-gray-dark",
|
|
85
|
+
text: contents[index].option?.text ?? "text-gray-dark",
|
|
85
86
|
animations: "duration-500",
|
|
86
87
|
};
|
|
87
88
|
const tagBox = {
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SlideModal } from "./template";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SlideModal } from "./template";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ModalProps } from "../../interface";
|
|
3
|
+
type Theme = "green" | "red" | "blue";
|
|
4
|
+
interface Props extends ModalProps {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
theme: Theme;
|
|
7
|
+
}
|
|
8
|
+
declare function SlideModal({ titles, children, theme, option, showAction }: Props): "" | import("react/jsx-runtime").JSX.Element | undefined;
|
|
9
|
+
export default SlideModal;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../util";
|
|
3
|
+
import { useActionStore } from "../../store";
|
|
4
|
+
function SlideModal({ titles, children, theme, option, showAction }) {
|
|
5
|
+
const { removeModal } = useActionStore();
|
|
6
|
+
const { isVisible, event } = showAction ?? {};
|
|
7
|
+
const { buttons: btns } = option ?? {};
|
|
8
|
+
const container = {
|
|
9
|
+
positions: "fixed inset-0 z-100",
|
|
10
|
+
displays: "flex flex-col justify-center items-center",
|
|
11
|
+
backgrounds: "bg-black/20 backdrop-blur-sm duration-300",
|
|
12
|
+
animation: isVisible
|
|
13
|
+
? "opacity-100 pointer-events-auto"
|
|
14
|
+
: "opacity-0 pointer-events-none",
|
|
15
|
+
};
|
|
16
|
+
const boxPositionWrapper = {
|
|
17
|
+
displays: "flex flex-col justify-end items-center",
|
|
18
|
+
sizes: "w-full h-full",
|
|
19
|
+
};
|
|
20
|
+
const tagWrapper = {
|
|
21
|
+
displays: "flex flex-col rounded-tl-lg rounded-tr-lg bg-white",
|
|
22
|
+
sizes: "w-full h-fit max-w-120",
|
|
23
|
+
spacings: "p-5 gap-5",
|
|
24
|
+
position: isVisible ? "translate-y-0" : "translate-y-full",
|
|
25
|
+
animation: "duration-300",
|
|
26
|
+
pointer: "pointer-events-auto",
|
|
27
|
+
};
|
|
28
|
+
const titleWrapper = {
|
|
29
|
+
displays: "flex flex-col gap-2",
|
|
30
|
+
sizes: "w-full",
|
|
31
|
+
};
|
|
32
|
+
const titleText = {
|
|
33
|
+
sizes: "w-full",
|
|
34
|
+
textStyles: "font-bold text-lg leading-none",
|
|
35
|
+
colors: "text-gray-dark",
|
|
36
|
+
};
|
|
37
|
+
const subtitleText = {
|
|
38
|
+
sizes: "w-full",
|
|
39
|
+
textStyles: "font-medium text-sm leading-none",
|
|
40
|
+
colors: "text-gray-medium",
|
|
41
|
+
};
|
|
42
|
+
const themeColors = {
|
|
43
|
+
green: "green-dark",
|
|
44
|
+
blue: "blue-navy",
|
|
45
|
+
red: "crimson-dark",
|
|
46
|
+
};
|
|
47
|
+
const buttonStyles = (btn) => !btn.disabled
|
|
48
|
+
? cn("flex justify-center items-center w-full h-fit rounded-lg p-3", `${btn.option?.background}`, `${btn.option?.className}`)
|
|
49
|
+
: "flex justify-center items-center w-full h-fit rounded-lg p-3 bg-gray-light text-gray-dark cursor-not-allowed";
|
|
50
|
+
return (event && (_jsx("div", { className: cn(container), onClick: () => removeModal(event), children: _jsx("div", { className: cn(boxPositionWrapper), children: _jsxs("div", { className: cn(tagWrapper), onClick: (e) => e.stopPropagation(), children: [_jsxs("div", { className: "w-full flex justify-between items-start", children: [_jsxs("div", { className: cn(titleWrapper), children: [_jsx("div", { className: cn(titleText), children: titles.title }), _jsx("div", { className: cn(subtitleText), children: titles.subtitle })] }), _jsx("div", { className: "size-6 flex justify-center items-center cursor-pointer", onClick: () => removeModal(event), children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "size-6", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18 18 6M6 6l12 12" }) }) })] }), _jsx("div", { className: "w-full flex flex-wrap max-h-100 overflow-scroll", children: children }), btns && (_jsx("div", { className: "w-full flex justify-center gap-2 cursor-pointer flex-col sm:flex-row", children: btns.map((btn, index) => btn ? (_jsx("div", { className: cn(buttonStyles(btn), btns.length === 1 ? "w-full" : "w-1/2 sm:w-full"), onClick: !btn.disabled ? btn.onClick : undefined, children: btn.title }, index)) : null) }))] }) }) })));
|
|
51
|
+
}
|
|
52
|
+
export default SlideModal;
|
package/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.291
|
package/modalV2/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as ModalV2 } from "./template";
|
package/modalV2/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as ModalV2 } from "./template";
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
interface Button {
|
|
3
|
-
active: boolean;
|
|
4
|
-
type: ButtonType;
|
|
5
|
-
options?: {
|
|
6
|
-
title: string;
|
|
7
|
-
onClick: () => void;
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
type Theme = "green" | "red" | "blue";
|
|
11
|
-
type ButtonType = "main" | "sub";
|
|
12
|
-
declare function ModalV2({ titles, openState, contents, theme, btns, }: {
|
|
13
|
-
titles: {
|
|
14
|
-
title: string;
|
|
15
|
-
subtitle: string;
|
|
16
|
-
};
|
|
17
|
-
openState: [boolean, React.Dispatch<React.SetStateAction<boolean>>];
|
|
18
|
-
contents: React.ReactNode;
|
|
19
|
-
theme: Theme;
|
|
20
|
-
btns?: Button[];
|
|
21
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
export default ModalV2;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from "../../util";
|
|
3
|
-
function ModalV2({ titles, openState, contents, theme, btns, }) {
|
|
4
|
-
const [isOpen, setIsOpen] = openState;
|
|
5
|
-
const container = {
|
|
6
|
-
positions: "fixed inset-0 z-100",
|
|
7
|
-
displays: "flex flex-col justify-center items-center",
|
|
8
|
-
backgrounds: "bg-black/20 backdrop-blur-sm duration-300",
|
|
9
|
-
animation: isOpen
|
|
10
|
-
? "opacity-100 pointer-events-auto"
|
|
11
|
-
: "opacity-0 pointer-events-none",
|
|
12
|
-
};
|
|
13
|
-
const boxPositionWrapper = {
|
|
14
|
-
displays: "flex flex-col justify-end items-center",
|
|
15
|
-
sizes: "w-full h-full",
|
|
16
|
-
};
|
|
17
|
-
const tagWrapper = {
|
|
18
|
-
displays: "flex flex-col rounded-tl-lg rounded-tr-lg bg-white",
|
|
19
|
-
sizes: "w-full h-fit max-w-120",
|
|
20
|
-
spacings: "p-5 gap-5",
|
|
21
|
-
position: isOpen ? "translate-y-0" : "translate-y-full",
|
|
22
|
-
animation: "duration-300",
|
|
23
|
-
pointer: "pointer-events-auto",
|
|
24
|
-
};
|
|
25
|
-
const titleWrapper = {
|
|
26
|
-
displays: "flex flex-col gap-2",
|
|
27
|
-
sizes: "w-full",
|
|
28
|
-
};
|
|
29
|
-
const titleText = {
|
|
30
|
-
sizes: "w-full",
|
|
31
|
-
textStyles: "font-bold text-lg leading-none",
|
|
32
|
-
colors: "text-gray-dark",
|
|
33
|
-
};
|
|
34
|
-
const subtitleText = {
|
|
35
|
-
sizes: "w-full",
|
|
36
|
-
textStyles: "font-medium text-sm leading-none",
|
|
37
|
-
colors: "text-gray-medium",
|
|
38
|
-
};
|
|
39
|
-
const themeColors = {
|
|
40
|
-
green: "green-dark",
|
|
41
|
-
blue: "blue-navy",
|
|
42
|
-
red: "crimson-dark",
|
|
43
|
-
};
|
|
44
|
-
const buttonStyles = (btn) => btn.active
|
|
45
|
-
? cn("flex justify-center items-center w-full h-fit rounded-lg p-3", btn.type === "main"
|
|
46
|
-
? `bg-${themeColors[theme]} text-white`
|
|
47
|
-
: `bg-${themeColors[theme]}/10 text-${themeColors[theme]}`)
|
|
48
|
-
: "flex justify-center items-center w-full h-fit rounded-lg p-3 bg-gray-light text-gray-dark cursor-not-allowed";
|
|
49
|
-
return (_jsx("div", { className: cn(container), onClick: () => setIsOpen(false), children: _jsx("div", { className: cn(boxPositionWrapper), children: _jsxs("div", { className: cn(tagWrapper), onClick: (e) => e.stopPropagation(), children: [_jsxs("div", { className: "w-full flex justify-between items-start", children: [_jsxs("div", { className: cn(titleWrapper), children: [_jsx("div", { className: cn(titleText), children: titles.title }), _jsx("div", { className: cn(subtitleText), children: titles.subtitle })] }), _jsx("div", { className: "size-6 flex justify-center items-center cursor-pointer", onClick: () => setIsOpen(false), children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "size-6", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18 18 6M6 6l12 12" }) }) })] }), _jsx("div", { className: "w-full flex flex-wrap max-h-100 overflow-scroll", children: contents }), btns && (_jsx("div", { className: "w-full flex justify-center gap-2 cursor-pointer flex-col sm:flex-row", children: btns.map((btn, index) => btn ? (_jsx("div", { className: cn(buttonStyles(btn), btns.length === 1 ? "w-full" : "w-1/2 sm:w-full"), onClick: btn.active ? btn.options?.onClick : undefined, children: btn.options?.title }, index)) : null) }))] }) }) }));
|
|
50
|
-
}
|
|
51
|
-
export default ModalV2;
|