Skip to content

Commit

Permalink
fix: 이미지 테스트 페이지에서 버그 유발 로직 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
simeunseo committed Jan 23, 2025
1 parent 85eea08 commit 0bafca7
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions src/pages/test/image/index.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,24 @@
import { css } from '@emotion/react';
import styled from '@emotion/styled';
import { FC, useEffect, useState } from 'react';

import { ModalButton } from '@/components/common/Modal/parts';
import useImageDownload from '@/components/resolution/read/hooks/useImageDownload';
import ResolutionMessage from '@/components/resolution/read/ResolutionMessage';

const Image: FC<{}> = () => {
const [isDocumentLoadded, setIsDocumentLoadded] = useState(false);

useEffect(() => {
window.onload = () => {
setIsDocumentLoadded(true);
};
}, []);

return isDocumentLoadded ? <ImageContent /> : null;
};

function ImageContent() {
const { ref: imageRef, onClick: onDownloadButtonClick } = useImageDownload('now-sopt');

return (
<Content ref={imageRef}>
<ResolutionMessage />
<>
<Content ref={imageRef}>
<ResolutionWrapper>
<ResolutionMessage />
</ResolutionWrapper>
</Content>
<Footer align='stretch'>
<ModalButton onClick={onDownloadButtonClick}>이미지로 저장하기</ModalButton>
</Footer>
</Content>
</>
);
}

Expand All @@ -38,6 +29,10 @@ const Content = styled.div`
padding: 20px;
`;

const ResolutionWrapper = styled.div`
width: fit-content;
`;

const Footer = styled.div<{ align: 'left' | 'right' | 'stretch'; stack?: 'horizontal' | 'vertical' }>`
display: grid;
margin-top: 24px;
Expand All @@ -54,4 +49,4 @@ const Footer = styled.div<{ align: 'left' | 'right' | 'stretch'; stack?: 'horizo
}
`;

export default Image;
export default ImageContent;

0 comments on commit 0bafca7

Please sign in to comment.