Skip to content

Commit

Permalink
[#47] Feat CheckSignUpPage
Browse files Browse the repository at this point in the history
  • Loading branch information
JoGeumJu committed Jul 25, 2023
1 parent 9779207 commit 7cfa222
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/components/adminPage/AdminDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import { useQueryGetSignUpDetail } from "../../hooks/query/adminSignUp/useQueryG
export const AdminDetailPage = () => {
const { id } = Router.query;
const { isLoading, data } = useQueryGetSignUpDetail(Number(id));

console.log(data);

return (
<Wrapper>
<WrapperInner>
Expand All @@ -36,6 +33,7 @@ export const AdminDetailPage = () => {
page={data?.page}
login={data?.login}
database={data?.database}
files={data?.files}
etc={data?.etc}
meeting={data?.meeting}
isLoading={isLoading}
Expand Down
37 changes: 35 additions & 2 deletions src/components/adminPage/SignUpAddInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import styled from "styled-components";
import { MdTune } from "react-icons/md";
import { useEffect, useState } from "react";
import { customColor } from "../customColor";
import { TwoRadioBoxs } from "./components/TwoRadioBoxs";
import { ColorPalette } from "./components/ColorPalette";
import { saveAs } from "file-saver";

interface Props {
mainColor: string[] | undefined;
subColor: string[] | undefined;
page: number | undefined;
login: boolean | undefined;
database: boolean | undefined;
files: { fileName: string; id: number; s3Url: string }[] | undefined;
etc: string | undefined;
meeting: string | undefined;
isLoading: boolean;
Expand All @@ -20,6 +21,17 @@ export const SignUpAddInfo = (props: Props) => {
const daysOfWeek = ["일", "월", "화", "수", "목", "금", "토"];
const date = props.meeting?.split("T");
const time = new Date(props.meeting!);

const handleDownload = (url: string) => {
const link = document.createElement("a");
link.href = url;
link.download = "downloaded_image.jpg";
link.target = "_blank"; // Optional: 이미지를 새 탭에서 열기
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
};

return (
<Content>
<Lbel>
Expand Down Expand Up @@ -57,7 +69,14 @@ export const SignUpAddInfo = (props: Props) => {
</BoxItem>
<BoxItem>
<BoxItemLabel>사이트 컨셉 참고자료 첨부</BoxItemLabel>
<BoxItemContent>&[수정필요]&</BoxItemContent>
<BoxItemContent>
{date !== undefined &&
props.files?.map((i, id) => (
<FileButton key={id} onClick={() => handleDownload(i.s3Url)}>
{i.fileName}
</FileButton>
))}
</BoxItemContent>
</BoxItem>
<BoxItem>
<BoxItemLabel>기타사항</BoxItemLabel>
Expand Down Expand Up @@ -104,6 +123,7 @@ const BoxItem = styled.div`
display: flex;
flex-direction: column;
position: relative;
width: 100%;
gap: 6px 0;
`;
const BoxItemLabel = styled.div`
Expand All @@ -127,3 +147,16 @@ const BoxItemContent = styled.div`
border-top-right-radius: 20px;
border-bottom-right-radius: 20px;
`;
const FileButton = styled.button`
display: block;
width: calc(100vw - 402px);
font-size: 14px;
color: ${customColor.white};
letter-spacing: -1px;
text-decoration: underline;
cursor: pointer;
text-align: start;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
`;
3 changes: 3 additions & 0 deletions src/hooks/query/adminSignUp/useQueryGetSignUpDetail.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { FieldErrors } from "react-hook-form";
import { useCallback } from "react";
import { useQuery } from "react-query";
import { AdminSignUpAPI } from "../../../apis/controller/adminSignUp.api";
Expand All @@ -17,6 +18,7 @@ export interface ResponseType {
siteName: string;
subColor: string[];
subLine: string;
files: { fileName: string; id: number; s3Url: string }[];
}

export const useQueryGetSignUpDetail = (id: number) => {
Expand All @@ -37,6 +39,7 @@ export const useQueryGetSignUpDetail = (id: number) => {
siteName: response.siteName,
subColor: response.subColor,
subLine: response.subLine,
files: response.files,
};
return signUpsRes;
}, []);
Expand Down

0 comments on commit 7cfa222

Please sign in to comment.