@edu-tosel/design 1.0.210 → 1.0.212
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/Event/One.js +3 -50
- package/package.json +1 -1
- package/tailwind.config.ts +5 -5
- package/version.txt +1 -1
|
@@ -1,52 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
import {
|
|
3
|
-
import { StatusText } from "./StatusText";
|
|
4
|
-
import { useState, useEffect } from "react";
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { isHTMLString } from "../../../util";
|
|
5
3
|
export default function One({ event }) {
|
|
6
|
-
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
const timer = setInterval(() => setCurrentTime(new Date()), 1000);
|
|
9
|
-
return () => clearInterval(timer);
|
|
10
|
-
}, []);
|
|
11
|
-
// 현재는 startedAt과 expiredAt 모두 시각은 09:00:00 으로 설정되어 있습니다.
|
|
12
|
-
const startedAt = event.startedAt ? new Date(event.startedAt) : null;
|
|
13
|
-
const expiredAt = event.expiredAt ? new Date(event.expiredAt) : null;
|
|
14
|
-
const timeDiff = startedAt
|
|
15
|
-
? startedAt.getTime() - currentTime.getTime()
|
|
16
|
-
: expiredAt
|
|
17
|
-
? expiredAt.getTime() - currentTime.getTime()
|
|
18
|
-
: 0;
|
|
19
|
-
const daysRemaining = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
|
|
20
|
-
const hoursRemaining = Math.floor((timeDiff / (1000 * 60 * 60)) % 24);
|
|
21
|
-
const minutesRemaining = Math.floor((timeDiff / (1000 * 60)) % 60);
|
|
22
|
-
const secondsRemaining = Math.floor((timeDiff / 1000) % 60);
|
|
23
|
-
// NOTE: let 쓰지 마세요 없어도 코드 짜는데 문제 없습니다. 스코프 이슈 생기면 답없습니다.
|
|
24
|
-
// NOTE: 컴포넌트 내부에서 if else 문 쓰지 마세요 가독성 떨어지고 버그납니다. 예외처리는 함수로 빼서 처리하세요.
|
|
25
|
-
// NOTE: 절대 같은 코드 복붙하지마세요. 성능떨어지고 보기 안좋습니다.
|
|
26
|
-
const lines = event.title.split("\n");
|
|
27
|
-
const countdownText = daysRemaining > 0
|
|
28
|
-
? `오픈까지 D-${daysRemaining}`
|
|
29
|
-
: `오픈까지 ${hoursRemaining
|
|
30
|
-
.toString()
|
|
31
|
-
.padStart(2, "0")}:${minutesRemaining
|
|
32
|
-
.toString()
|
|
33
|
-
.padStart(2, "0")}:${secondsRemaining
|
|
34
|
-
.toString()
|
|
35
|
-
.padStart(2, "0")} 남음`;
|
|
36
|
-
const button = {
|
|
37
|
-
sizes: "w-full h-12 flex items-center justify-center rounded-md cursor-pointer font-bold gap-3 text-sm xs:text-md",
|
|
38
|
-
backgrounds: expiredAt && expiredAt < currentTime
|
|
39
|
-
? " bg-gray-light text-gray-medium"
|
|
40
|
-
: expiredAt && expiredAt > currentTime
|
|
41
|
-
? "bg-gray-light text-green-dark"
|
|
42
|
-
: "bg-gradient-to-l from-crimson-burgundy to-green-dark text-white",
|
|
43
|
-
};
|
|
44
|
-
const buttonText = expiredAt && expiredAt < currentTime
|
|
45
|
-
? "종료된 이벤트입니다"
|
|
46
|
-
: startedAt && startedAt > currentTime
|
|
47
|
-
? countdownText
|
|
48
|
-
: event.button?.title;
|
|
49
|
-
return (_jsxs("div", { className: "flex flex-col mmd:flex-row", children: [_jsx("div", { className: "min-w-[320px] h-auto p-5 mmd:sticky mmd:top-20 mmd:self-start", children: _jsxs("div", { className: "w-full h-auto rounded-xl sm:flex mmd:flex-col", children: [_jsx("div", { className: "w-full mmd:h-50 overflow-hidden", children: _jsx("img", { src: event.thumbnail, alt: event.title, className: "rounded-xl h-full object-cover w-full" }) }), _jsxs("div", { className: "w-full h-auto pt-5 sm:p-5 mmd:p-0 mmd:pt-5 gap-3 flex flex-col", children: [_jsx("div", { className: "flex items-center", children: _jsx(StatusText, { event: event }) }), _jsx("div", { className: "text-sm font-bold text-gray-dark flex flex-col items-start mb-2", children: lines.map((line, index) => (_jsxs("span", { children: [line, _jsx("br", {})] }, index))) }), event.button && (_jsx("div", { className: cn(button), onClick: () => {
|
|
50
|
-
event.button?.onClick && event.button.onClick();
|
|
51
|
-
}, children: buttonText }))] })] }, event.id) }), _jsxs("div", { className: "flex-grow p-5", children: [_jsx("div", { className: "w-full rounded-xl object-cover overflow-hidden max-w-[810px]", children: isHTMLString(event.content) ? (_jsx("div", { dangerouslySetInnerHTML: { __html: event.content } })) : (_jsx("div", { children: event.content })) }), _jsx("button", { onClick: () => history.back(), className: "mt-8 p-5 bg-green-dark/5 text-green-dark rounded-xl flex items-center justify-center hover:bg-green-dark/20 transition-all", children: "\uBAA9\uB85D\uC73C\uB85C \uB3CC\uC544\uAC00\uAE30" })] })] }));
|
|
4
|
+
return (_jsx("div", { children: isHTMLString(event.content) ? (_jsx("div", { dangerouslySetInnerHTML: { __html: event.content } })) : (_jsx("div", { children: event.content })) }));
|
|
52
5
|
}
|
package/package.json
CHANGED
package/tailwind.config.ts
CHANGED
|
@@ -677,11 +677,11 @@ export default {
|
|
|
677
677
|
"-ms-overflow-style": "none", // For Internet Explorer and Edge
|
|
678
678
|
"scrollbar-width": "none", // For Firefox
|
|
679
679
|
},
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
680
|
+
".page-break": {
|
|
681
|
+
"@media print": {
|
|
682
|
+
"page-break-before": "always",
|
|
683
|
+
},
|
|
684
|
+
},
|
|
685
685
|
},
|
|
686
686
|
{
|
|
687
687
|
respectPrefix: false,
|
package/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.212
|