@edu-tosel/design 1.0.113 → 1.0.115

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.
@@ -43,8 +43,8 @@ export function Board({ children, action, option, debug, buttons, }) {
43
43
  positions: "fixed bottom-20 right-4 xl:absolute xl:-bottom-18.5 xl:right-0",
44
44
  };
45
45
  return (_jsxs("div", { className: cn(container), children: [_jsx(Action.Show, { actions: shows, children: _jsx("div", { className: cn(body), children: children }) }), _jsx("div", { className: cn(button), children: buttons?.map(({ title, onClick, option }) => (_jsx(Label.Button, { title: title, onClick: onClick, option: {
46
- ...option,
47
46
  text: "text-white",
48
47
  background: "bg-crimson-burgundy",
48
+ ...option,
49
49
  } }))) })] }));
50
50
  }
@@ -22,7 +22,7 @@ interface ModalProps {
22
22
  debug?: string;
23
23
  }
24
24
  interface ConfirmModalProps<T = any> extends ModalProps {
25
- buttons: [Button, Button];
25
+ buttons: [Button] | [Button, Button];
26
26
  widgets?: ConfirmModalWidget<T>[];
27
27
  }
28
28
  type ConfirmModalWidget<T = string> = ConfirmModalSelectSwitchProps<T> | ConfirmModalSelectHandleProps<T> | ConfirmModalSelectTagProps<T> | ConfirmModalPaginationProps<T> | ConfirmModalInputFormProps | ConfirmModalNodeProps;
@@ -1,8 +1,3 @@
1
- type Tag = "NEW" | "REG";
2
- interface Styles {
3
- title: string;
4
- background: string;
5
- }
6
- declare const TagStyles: Record<Tag, Styles>;
1
+ type Tag = "NEW" | "REG" | "RCU";
2
+ export declare const tagString: Record<Tag, string>;
7
3
  export type { Tag };
8
- export { TagStyles };
@@ -1,11 +1,5 @@
1
- const TagStyles = {
2
- NEW: {
3
- title: "신규론칭",
4
- background: "bg-blue-navy",
5
- },
6
- REG: {
7
- title: "정기시험",
8
- background: "bg-crimson-burgundy",
9
- },
1
+ export const tagString = {
2
+ NEW: "신규론칭",
3
+ REG: "정기시험",
4
+ RCU: "모집 중"
10
5
  };
11
- export { TagStyles };
@@ -1,11 +1,15 @@
1
1
  import { Titles } from "../Property";
2
2
  export type { CarouselContent };
3
+ type Tag = "NEW" | "REG" | "RCU";
3
4
  interface Option {
4
5
  background: string;
5
6
  text: string;
6
7
  }
7
- interface CarouselContent<T> {
8
- tag: T;
8
+ interface CarouselContent {
9
+ tag: {
10
+ type: Tag;
11
+ background: string;
12
+ };
9
13
  titles: Titles;
10
14
  image?: string;
11
15
  option?: Partial<Option>;
@@ -1,5 +1,4 @@
1
1
  import { CarouselContent } from "../../../../interface";
2
- import { Tag } from "../../../../interface/domain";
3
2
  export default function Carousel({ contents, }: {
4
- contents: CarouselContent<Tag>[];
3
+ contents: CarouselContent[];
5
4
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,18 +1,21 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from "react";
2
+ import { useState, useEffect } from "react";
3
+ import { useTransition } from "react-spring";
3
4
  import { cn } from "../../../../util";
4
5
  import { useEase } from "../../../../hook";
5
6
  import { LineBreaks } from "../../../../text";
6
7
  import SVG from "../../../../asset/SVG";
7
- import { TagStyles } from "../../../../interface/domain";
8
+ import { tagString } from "../../../../interface/domain";
8
9
  export default function Carousel({ contents, }) {
9
10
  const [index, setIndex] = useState(0);
10
11
  const [flag, inTime] = useEase(10000, 1000);
11
- // useEffect(() => {
12
- // if (flag) {
13
- // setIndex((index + 1) % contents.length);
14
- // }
15
- // }, [flag]);
12
+ useEffect(() => {
13
+ // Automatically change index every 5 seconds
14
+ const interval = setInterval(() => {
15
+ setIndex((prevIndex) => (prevIndex + 1) % contents.length);
16
+ }, 5000);
17
+ return () => clearInterval(interval);
18
+ }, [contents.length]);
16
19
  const { tag, titles, image, option } = contents[index];
17
20
  const { text, background } = option ?? {};
18
21
  const container = {
@@ -29,15 +32,21 @@ export default function Carousel({ contents, }) {
29
32
  const tagBox = {
30
33
  displays: "flex justify-center items-center",
31
34
  sizes: "w-20 h-8",
32
- background: TagStyles[tag].background,
35
+ background: tag.background,
33
36
  fonts: "text-white font-pretendard-bold text-lg leading-none",
34
37
  styles: "rounded-md",
35
38
  };
36
39
  const buttonBox = {
37
40
  positions: "absolute bottom-0 left-0",
38
- displays: "flex justify-between items-center",
41
+ displays: "flex justify-center items-center gap-1",
39
42
  sizes: "w-23.25 h-6.25 bg-gray-dark rounded-full",
40
43
  paddings: "px-1.5 ml-7.5",
41
44
  };
42
- return (_jsx("div", { className: cn(container), children: _jsxs("div", { className: cn(body), children: [_jsxs("div", { className: "relative w-64 h-50 flex flex-col pl-7.5", children: [_jsx("div", { className: cn(tagBox), children: TagStyles[tag].title }), _jsx("div", { className: "font-pretendard-bold text-2xl mt-2", children: titles.title }), _jsx(LineBreaks, { className: "mt-7.5", texts: titles.subtitle }), _jsxs("div", { className: cn(buttonBox), children: [_jsx("button", { onClick: () => setIndex((index - 1 + contents.length) % contents.length), className: "w-5 h-5 flex justify-center items-center", children: _jsx(SVG.Symbol.LessThan, {}) }), _jsxs("div", { className: "text-white", children: [index + 1, "/", contents.length] }), _jsx("button", { onClick: () => setIndex((index + 1) % contents.length), className: "w-5 h-5 flex justify-center items-center", children: _jsx(SVG.Symbol.GreaterThan, {}) })] })] }), image && (_jsx("img", { src: image, alt: "carousel-image", className: "absolute bottom-0 right-0 w-3/5 " }))] }) }));
45
+ const transitions = useTransition(!!image, {
46
+ from: { opacity: 0 },
47
+ enter: { opacity: 1 },
48
+ leave: { opacity: 0 },
49
+ config: { duration: 200 },
50
+ });
51
+ return (_jsx("div", { className: cn(container), children: _jsxs("div", { className: cn(body), children: [_jsxs("div", { className: "relative w-72 h-50 flex flex-col pl-7.5", children: [_jsx("div", { className: `${cn(tagBox)} duration-1000 transition-all`, children: tagString[tag.type] }), _jsx("div", { className: "font-pretendard-bold text-2xl mt-2 duration-200 transition-all", children: titles.title }), _jsx(LineBreaks, { className: "mt-7.5 duration-1000 transition-all", texts: titles.subtitle }), _jsxs("div", { className: cn(buttonBox), children: [_jsx("button", { onClick: () => setIndex((index - 1 + contents.length) % contents.length), className: "w-5 h-5 flex justify-center items-center", children: _jsx(SVG.Symbol.LessThan, {}) }), _jsxs("div", { className: "flex flex-row gap-2 justify-center items-center", children: [_jsx("div", { className: "text-white w-2 text-sm", children: index + 1 }), _jsx("div", { className: "w-0.5 h-3 bg-gray-medium" }), _jsx("div", { className: "text-white w-2 text-sm", children: contents.length })] }), _jsx("button", { onClick: () => setIndex((index + 1) % contents.length), className: "w-5 h-5 flex justify-center items-center", children: _jsx(SVG.Symbol.GreaterThan, {}) })] })] }), image && (_jsx("img", { src: image, alt: "carousel-image", className: "absolute bottom-0 right-0 object-cover sm:h-full duration-2000 transition-all" }))] }) }));
43
52
  }
@@ -5,16 +5,19 @@ export default function Header({ logo, rightButton, contents, }) {
5
5
  const container = {
6
6
  displays: "flex justify-center items-center",
7
7
  sizes: "w-full",
8
- styles: "bg-white box-shadow ",
8
+ styles: "bg-white box-shadow ",
9
9
  };
10
10
  const body = {
11
11
  displays: "flex items-center justify-center md:justify-between",
12
12
  className: "w-full max-w-[1200px] h-15",
13
- boundaries: "md:px-12",
13
+ boundaries: "md:px-12 py-2.5",
14
14
  };
15
15
  const buttonBox = {
16
16
  fonts: "text-[9px] xs:text-[10px] sm:text-[11px] md:text-[16px] leading-tight",
17
- texts: "text-gray-dark",
17
+ texts: "text-gray-dark hover:text-black",
18
+ backgrounds: "hover:bg-[#F0F0F0]/50",
19
+ animations: "duration-300",
20
+ sizes: "h-10 rounded-md",
18
21
  boundaries: "px-0.5 md:px-2.5",
19
22
  };
20
23
  return (_jsx("div", { className: cn(container), children: _jsxs("div", { className: cn(body), children: [_jsx("div", { className: "hidden md:block", onClick: logo.onClick, children: logo.node }), _jsxs("div", { className: "flex items-center gap-x-7.5 md:gap-x-12", children: [_jsx("div", { className: "flex items-center gap-2.5", children: contents.map((button, index) => (_jsx("button", { onClick: button.onClick, className: cn(buttonBox), children: button.title }, index))) }), rightButton && (_jsx(Label.Button, { title: rightButton.title, onClick: rightButton?.onClick, option: {
@@ -7,7 +7,7 @@ export default function ConfirmModalDesign({ titles, showAction, buttons, childr
7
7
  displays: "flex flex-col",
8
8
  };
9
9
  const buttonBox = {
10
- positions: "absolute bottom-4 md:bottom-5 left-2 md:left-5",
10
+ positions: "absolute bottom-4 md:bottom-5 right-2 md:right-5",
11
11
  displays: "flex gap-1 md:gap-2.5",
12
12
  };
13
13
  return (_jsx(ModalDesign, { titles: titles, showAction: showAction, option: option, children: _jsxs("div", { className: cn(container), children: [children, _jsx("div", { className: cn(buttonBox), children: buttons.map(({ title, onClick, option }) => (_jsx(Label.Button, { title: title, onClick: onClick, option: {
@@ -69,5 +69,5 @@ function ModalDesign({ titles, showAction, children, option, debug, }) {
69
69
  displays: "flex flex-col items-end",
70
70
  sizes: "w-full min-h-[83px]",
71
71
  };
72
- return (_jsxs("div", { className: cn(container), children: [_jsxs("div", { className: cn(titleBox), children: [_jsx("div", { className: "text-xl leading-none font-pretendard-bold", children: titles.title }), _jsx("div", { className: "bg-gray-light w-13.75 h-2 mt-3" }), _jsx(LineBreaks, { texts: titles.subtitle, className: "mt-5 text-base leading-none text-end font-pretendard-bold" })] }), children, !noClose && event && (_jsx(SVG.Close, { onClick: () => removeModal(event), className: "absolute top-1 left-1" }))] }));
72
+ return (_jsxs("div", { className: cn(container), children: [_jsxs("div", { className: cn(titleBox), children: [_jsx("div", { className: "text-xl leading-none font-pretendard-bold", children: titles.title }), _jsx("div", { className: "bg-gray-light w-13.75 h-2 mt-3" }), _jsx(LineBreaks, { texts: titles.subtitle, className: "mt-5 text-base leading-none text-end " })] }), _jsx("div", { className: "overflow-hidden", children: children }), !noClose && event && (_jsx(SVG.Close, { onClick: () => removeModal(event), className: "absolute top-2.5 left-2.5 md:top-5 md:left-5" }))] }));
73
73
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edu-tosel/design",
3
- "version": "1.0.113",
3
+ "version": "1.0.115",
4
4
  "description": "UI components for International TOSEL Committee",
5
5
  "keywords": [
6
6
  "jsx",
package/version.txt CHANGED
@@ -1 +1 @@
1
- 1.0.113
1
+ 1.0.115