diff --git a/components/Alert.js b/components/Alert.js new file mode 100644 index 0000000..cf50ec8 --- /dev/null +++ b/components/Alert.js @@ -0,0 +1,47 @@ +import { Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, Button, cn } from "@nextui-org/react"; + +export default function Alert({ + title = "", + content = "", + disclosure, + callback, + placement = "center", + className = "", + color = "primary", + isDismissable = true +}) { + const dismissableProp = { + isDismissable: false, + isKeyboardDismissDisabled: true + } + return ( + + + { + onClose => ( + <> + {title} + +

{content}

+
+ + + + + ) + } +
+
+ ) +} \ No newline at end of file diff --git a/components/Confirm.js b/components/Confirm.js new file mode 100644 index 0000000..e16a2fe --- /dev/null +++ b/components/Confirm.js @@ -0,0 +1,40 @@ +import { + Modal, + ModalContent, + ModalHeader, + ModalBody, + ModalFooter, + Button, + cn +} from "@nextui-org/react"; + +export default function Confirm({ title, content, disclosure, confirm, placement = "center", className = "" }) { + return ( + + + { + onClose => ( + <> + {title} + {content} + + + + + + ) + } + + + ) +} \ No newline at end of file diff --git a/components/ConfirmComponent.js b/components/ConfirmComponent.js deleted file mode 100644 index 9a6a292..0000000 --- a/components/ConfirmComponent.js +++ /dev/null @@ -1,21 +0,0 @@ -import styles from '../styles/ConfirmComponent.module.css'; - -import coverStyles from '../styles/cover.module.css'; - -export default function Confirm({ title, content, btn, onClick, show, theme, size }) { - return ( -
-
-
{title}
-
{content}
-
- { - btn.map((item, index) => { - return (
{item}
) - }) - } -
-
-
- ) -} \ No newline at end of file diff --git a/components/CourseCardComponent.js b/components/CourseCardComponent.js index b696f5a..7cfeaa7 100644 --- a/components/CourseCardComponent.js +++ b/components/CourseCardComponent.js @@ -1,73 +1,108 @@ import Link from 'next/link'; +import { Card, CardHeader, CardBody, CardFooter, Progress, CheckboxGroup } from "@nextui-org/react"; +import examString from '@/data/exam.json'; +import { WayCheckbox } from '@/components/WayCheckbox'; +import { WayChip } from '@/components/WayChip'; -import styles from '../styles/CourseCardComponent.module.css'; - -export default function CourseCard({ e, isDemo, theme, setRevelationConfirmShow, setRevelationID }) { +export default function CourseCard({ e, isDemo, setRevelationConfirmShow, setRevelationID, setShareErrorConfirmShow }) { function shareOnClick(shareData) { if (navigator.share) { navigator.share(shareData); } else { - setShareErrorConfirmShow(true); - setShareErrorText('您的瀏覽器不支援分享功能,請使用其他瀏覽器。'); + setShareErrorConfirmShow(); } } return ( -
-
-
{e.className}
-
-
{ } : - () => shareOnClick({ - title: `${e.teacher.join('和')}的${e.className} 的課程評價`, - text: `在每日文大課程評價中,查看${e.teacher.join('和')}的${e.className}。`, - url: 'https://daily-pccu.web.app/course/' + e.id, - }) - }> - + + +
{e.className}
+
+
shareOnClick({ + title: `${e.teacher.join('和')}的${e.className} 的課程評價`, + text: `在每日文大課程評價中,查看${e.teacher.join('和')}的${e.className}。`, + url: 'https://daily-pccu.web.app/course/' + e.id, + }) + }> +
-
{ } : - () => { - setRevelationConfirmShow(true); - setRevelationID(e.id); - } - }> - +
{ + setRevelationConfirmShow(); + setRevelationID(e.id); + } + }> +
-
-
{e.department}
-
- { - e.teacher.map(teacher => { - return ( - {teacher} - ) - }) - } -
-
-
-
= 80 ? 'var(--green)' : (e.point >= 60 ? 'var(--yellow)' : 'var(--red)')) }}>
+ + +
{e.department}
+
+ { + e.teacher.map(teacher => {teacher}) + }
-
= 80 ? 'var(--green)' : (e.point >= 60 ? 'var(--yellow)' : 'var(--red)')) }}>{e.point}
-
-
{ - (e.exam != '' ? e.exam.split(',').map((exam, index) =>
{exam}
) : '') + e.point >= 80 ? + + : + e.point >= 60 ? + + : + } -
-
授課方式:
- {e.way} -
-
課程評語:
- {e.evaluation.replaceAll('\\n', '\n')} -
-
+
+ { + examString.map((exam, index) => ( + e.exam.includes(exam) ? + {exam} + : + {exam} + )) + } +
+
授課方式:
+ {e.way} +
+
課程評語:
+ {e.evaluation.replaceAll('\\n', '\n')} +
+ +
{e.year}學年
{new Date(e.date).toLocaleDateString()}
-
-
+ +
) } \ No newline at end of file diff --git a/components/FooterComponent.js b/components/FooterComponent.js index f282921..2bb8d00 100644 --- a/components/FooterComponent.js +++ b/components/FooterComponent.js @@ -1,31 +1,35 @@ import Link from 'next/link'; -import styles from '../styles/FooterComponent.module.css'; +import styles from '@/styles/FooterComponent.module.css'; -export default function Footer() { +export default function Footer({ options = {} }) { + if (options.hidden == true) return null; return ( -