Skip to content

Commit

Permalink
feat :: 공지사항 코드 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
eejx0 committed Apr 19, 2024
1 parent 3bedc72 commit b7fa270
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
6 changes: 2 additions & 4 deletions src/app/mypage/notice/detail/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
'use client'

import { useGetNoticeDetailData, useGetNoticeListData } from "@/apis/notice";
import { useEffect, useState } from "react";
import { useGetNoticeDetailData } from "@/apis/notice";
import AttachedBox from "@/components/notice/AttachedBox";

export default function NoticeDetailPage(props:any) {
const noticeId = props.params.id
const {noticeDetail} = useGetNoticeDetailData(noticeId);
// const items = [noticeDetail]

return (
<div className="flex justify-cent4er items-center mt-[100px]">
Expand All @@ -18,7 +16,7 @@ export default function NoticeDetailPage(props:any) {
<h1 className="font-[700] text-[28px]">{noticeDetail?.title}</h1>
<h2 className="font-[500] text-[20px] mt-[20px]">{noticeDetail?.created_at.substring(0, 10)}</h2>
<p className="font-[400] text-[16px] mt-[28px] whitespace-pre-line">{noticeDetail?.content}</p>
<AttachedBox props={noticeDetail?.attachments || []} />
<AttachedBox attachmentProps = {noticeDetail?.attachments || []} />
</div>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/components/notice/AttachedBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { file_name_regex } from "@/util/regex";
import axios from "axios";

interface PropsType {
props: AttachmentResponse[]
attachmentProps: AttachmentResponse[]
}

export default function AttachedBox ({props}: PropsType) {
export default function AttachedBox ({attachmentProps}: PropsType) {
const downLoadFile = async (attachment: AttachmentResponse) => {
try {
const response = await axios.get(`${process.env.NEXT_PUBLIC_IMAGE_URL}/${attachment.url}`, {
Expand All @@ -34,7 +34,7 @@ export default function AttachedBox ({props}: PropsType) {
<div className="flex flex-row w-full h-auto mt-[32px] border-t-[2px] border-b-[1px] border-[#135C9D] p-[16px] gap-[20px]">
<div className="font-[500] text-[18px] ">첨부자료</div>
<div className="flex flex-col gap-[4px] justify-center ">
{props.map((attachment) => (
{attachmentProps && attachmentProps.map((attachment) => (
<div key={attachment.id} className="flex gap-[7px] items-center">
<div>{file_name_regex(attachment.url)}</div>
<Icon icon="Download" size={15} color="liteBlue" cursor="pointer" onClick={() => downLoadFile(attachment)} />
Expand Down
8 changes: 4 additions & 4 deletions src/components/notice/NoticeListTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ export default function NoticeListTable () {

return (
<>
{notices.map((notice, index) => (
<Link key={notice.id} href={`detail/${notice.id}`}>
{notices.map(({id, title, created_at}, index) => (
<Link key={id} href={`detail/${id}`}>
<tbody className="flex justify-center items-center border-collapse">
<tr className="h-[60px] border-b-[0.5px] border-[#7F7F7F]">
<td className="border-none w-[192px] text-[16px] text-[#135C9D] flex justify-center">{index+1}</td>
<td className="border-none w-[735px] text-[16px] flex justify-center">{notice.title}</td>
<td className="border-none w-[192px] text-[16px] flex justify-center">{notice.created_at.substring(0, 10)}</td>
<td className="border-none w-[735px] text-[16px] flex justify-center">{title}</td>
<td className="border-none w-[192px] text-[16px] flex justify-center">{created_at.substring(0, 10)}</td>
</tr>
</tbody>
</Link>
Expand Down

0 comments on commit b7fa270

Please sign in to comment.