Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat/#385] 이미지 원본 보여주기 #386

Merged
merged 2 commits into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/pages/gig/components/showInfo/ShowInfo.styled.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ButtonDelete24 } from "@assets/svgs";
import { Generators } from "@styles/generator";
import styled from "styled-components";

Expand All @@ -12,9 +13,39 @@ export const Poster = styled.img`
object-fit: cover;
object-position: center;

cursor: pointer;
border-radius: 4px;
`;

export const ModalOverlay = styled.div`
position: fixed;
inset: 0;
z-index: 10;
${Generators.flexGenerator("column")};

background-color: rgb(15 15 15 / 70%);
`;

export const CloseBtn = styled.section`
position: absolute;
top: 1.6rem;
width: 37rem;

${Generators.flexGenerator("row", "center", "end")};
cursor: pointer;
`;

export const CloseIcon = styled(ButtonDelete24)`
width: 2.4rem;
height: 2.4rem;
margin-right: 1.3rem;
`;

export const ModalContent = styled.img`
max-width: 37rem;
max-height: 100%;
`;

export const Title = styled.h1`
margin-bottom: 0.6rem;

Expand Down
19 changes: 18 additions & 1 deletion src/pages/gig/components/showInfo/ShowInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { formatDate } from "@pages/gig/utils";
import IconText from "../iconText/IconText";
import ShowType from "../showType/ShowType";
import * as S from "./ShowInfo.styled";
import { useState } from "react";

export type SchelduleListType = {
scheduleId?: number;
Expand Down Expand Up @@ -34,11 +35,27 @@ const ShowInfo = ({
runningTime,
scheduleList,
}: ShowInfoProps) => {
const [isModalOpen, setIsModalOpen] = useState(false);

const openModal = () => setIsModalOpen(true);
const closeModal = () => setIsModalOpen(false);
const getShowTypeText = (key: SHOW_TYPE_KEY): ShowTypes => SHOW_TYPE[key];

return (
<S.ShowInfoWrapper>
<S.Poster src={posterImage} />
<S.Poster src={posterImage} onClick={openModal} />
{isModalOpen && (
<S.ModalOverlay>
<S.CloseBtn onClick={closeModal}>
<S.CloseIcon />
</S.CloseBtn>
<S.ModalContent
src={posterImage}
alt={title}
onClick={(e) => e.stopPropagation()}
></S.ModalContent>
</S.ModalOverlay>
)}
<ShowType type={getShowTypeText(genre)} />
<S.Title>{title}</S.Title>
<div>
Expand Down
Loading