@edu-tosel/design 1.0.117 → 1.0.118

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.
@@ -0,0 +1 @@
1
+ export default function SomeCardDesign(): null;
@@ -0,0 +1,3 @@
1
+ export default function SomeCardDesign() {
2
+ return null;
3
+ }
@@ -1,2 +1,3 @@
1
- declare const useMobile: () => boolean;
2
- export default useMobile;
1
+ import { Size } from "../interface";
2
+ declare const useResponsive: (size?: Size) => boolean;
3
+ export default useResponsive;
package/hook/useMobile.js CHANGED
@@ -1,8 +1,21 @@
1
1
  import { useEffect, useState } from "react";
2
- const useMobile = () => {
2
+ const screen = {
3
+ xxxs: "(min-width: 332px)",
4
+ xxs: "(min-width: 393px)",
5
+ xs: "(min-width: 480px)",
6
+ sm: "(min-width: 640px)",
7
+ md: "(min-width: 768px)", // IPad Mini
8
+ mmd: "(min-width: 840px)",
9
+ xm: "(min-width: 964px)", // IPad Air, IPad Pro 11.
10
+ lg: "(min-width: 1024px)", // IPad Mini Horizontal Viewport
11
+ ml: "(min-width: 1160px)", // IPad Air, IPad Pro 11.
12
+ xl: "(min-width: 1280px)",
13
+ "2xl": "(min-width: 1536px)",
14
+ };
15
+ const useResponsive = (size) => {
3
16
  const [isMobile, setIsMobile] = useState(false);
4
17
  useEffect(() => {
5
- const mediaQuery = window.matchMedia("(max-width: 768px)");
18
+ const mediaQuery = window.matchMedia(screen[size ?? "xxs"]);
6
19
  setIsMobile(mediaQuery.matches);
7
20
  const handleResize = () => {
8
21
  setIsMobile(mediaQuery.matches);
@@ -14,4 +27,4 @@ const useMobile = () => {
14
27
  }, []);
15
28
  return isMobile;
16
29
  };
17
- export default useMobile;
30
+ export default useResponsive;
@@ -31,7 +31,7 @@ export type State<T> = [T, StateAction<T>];
31
31
  * @property {"full"} full - Full size
32
32
  * @property {"full"} full - Full size
33
33
  */
34
- export type Size = "5xs" | "4xs" | "3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "full" | "auto";
34
+ export type Size = "xxxs" | "xxs" | "mmd" | "xm" | "ml" | "5xs" | "4xs" | "3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "full" | "auto";
35
35
  /**
36
36
  * Image size type
37
37
  * @enum {string}
@@ -5,6 +5,7 @@ import { useEase } from "../../../../hook";
5
5
  import { LineBreaks } from "../../../../text";
6
6
  import SVG from "../../../../asset/SVG";
7
7
  import { tagString } from "../../../../interface/domain";
8
+ import useResponsive from "../../../../hook/useMobile";
8
9
  export default function Carousel({ contents, }) {
9
10
  const [index, setIndex] = useState(0);
10
11
  const [flag, inTime] = useEase(10000, 1000);
@@ -16,12 +17,17 @@ export default function Carousel({ contents, }) {
16
17
  const { tag, titles, image, option } = contents[index];
17
18
  const { text, background } = option ?? {};
18
19
  const container = {
19
- displays: "flex justify-center items-center",
20
- sizes: "w-full h-fit sm:h-80 ml:h-100",
20
+ displays: "relative flex justify-center items-center",
21
+ sizes: "w-full h-fit md:h-80 ml:h-100",
22
+ textstyle: "break-keep",
21
23
  background,
22
24
  };
25
+ const titleSet = {
26
+ displays: "flex items-center lex gap-4 flex-row xxs:gap-4 xxs:items-start xxs:flex-col md:gap-2",
27
+ sizes: "w-fit md:w-full h-fit",
28
+ };
23
29
  const body = {
24
- displays: "flex flex-none items-center justify-center",
30
+ displays: "flex flex-none flex-col items-center justify-center md:flex-row",
25
31
  sizes: "w-full max-w-256 h-full",
26
32
  text: text ?? "text-gray-dark",
27
33
  };
@@ -32,10 +38,19 @@ export default function Carousel({ contents, }) {
32
38
  fonts: "text-white font-pretendard-medium text-sm md:text-base leading-none",
33
39
  styles: "rounded-md",
34
40
  };
41
+ const isMD = useResponsive("md");
42
+ const isXL = useResponsive("xl");
43
+ const test = {
44
+ postions: "absolute left-0 top-0 border-2 border-red-500",
45
+ sizes: "w-full",
46
+ displays: "flex justify-center",
47
+ };
35
48
  const buttonBox = {
36
- displays: "flex justify-center items-center gap-1",
49
+ positions: !isMD && "absolute bottom-5 left-5 sm:bottom-10 sm:left-10",
50
+ animations: "duration-500",
51
+ displays: "justify-center items-center gap-1 flex",
37
52
  sizes: "w-23.25 h-6.25 bg-gray-dark rounded-full",
38
53
  paddings: "px-1.5 mt-12",
39
54
  };
40
- return (_jsx("div", { className: cn(container), children: _jsxs("div", { className: cn(body), children: [_jsxs("div", { className: "w-72 h-50 flex flex-col flex-none pl-7.5", children: [_jsx("div", { className: cn(tagBox), children: tagString[tag.type] }), _jsx("div", { className: "font-pretendard-bold text-xl mt-2 md:text-2xl", children: titles.title }), _jsx(LineBreaks, { className: "mt-6 text-sm md:text-base", 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, {}) })] })] }), _jsx("div", { className: "h-full overflow-hidden w-fit", children: image && (_jsx("img", { src: image, alt: "carousel-image", className: "object-cover h-full" })) })] }) }));
55
+ return (_jsx("div", { className: cn(container), children: _jsxs("div", { className: cn(body), children: [_jsxs("div", { className: "w-fit h-fit flex flex-col mt-4 xxs:mt-8 xxs:flex-row xxs:gap-8 md:flex-col md:flex-none md:w-72 md:pl-7.5 md:gap-6 md:mt-0", children: [_jsxs("div", { className: cn(titleSet), children: [_jsx("div", { className: cn(tagBox), children: tagString[tag.type] }), _jsx("div", { className: "font-pretendard-bold text-xl md:text-2xl", children: titles.title })] }), _jsx(LineBreaks, { className: "w-fit flex flex-col justify-center text-sm my-2 xxs:mt-0 md:text-base", 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, {}) })] })] }), _jsx("div", { className: "h-full overflow-hidden w-fit", children: image && (_jsx("img", { src: image, alt: "carousel-image", className: "object-cover h-full" })) })] }) }));
41
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edu-tosel/design",
3
- "version": "1.0.117",
3
+ "version": "1.0.118",
4
4
  "description": "UI components for International TOSEL Committee",
5
5
  "keywords": [
6
6
  "jsx",
package/version.txt CHANGED
@@ -1 +1 @@
1
- 1.0.117
1
+ 1.0.118