Skip to content

Commit

Permalink
Test:셰어페이지 test
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaem03 committed Aug 5, 2024
1 parent 8dffdb9 commit 0991394
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 31 deletions.
43 changes: 14 additions & 29 deletions src/pages/Share/Share.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,11 @@ import ClearStarPIcon2 from "@/assets/starclearPicon2.svg";

const SharePage = ({ onBack }) => {
const captureRef = useRef();
const { starP } = useMoveonStarP();
const [isButtonVisible, setIsButtonVisible] = useState(true);

useEffect(() => {
setIsButtonVisible(true);
}, []);
const handleCapture = async () => {
setIsButtonVisible(false);

try {
const canvas = await html2canvas(captureRef.current);
await captureScreenshot(canvas);
} catch (err) {
console.log("캡처 중 오류가 발생했습니다.");
} finally {
setIsButtonVisible(true);
}
const canvas = await html2canvas(captureRef.current);
await captureScreenshot(canvas);
};

const starData = starP && starP.data ? starP.data : null;
if (!starData) {
return <p>데이터를 불러오는 중입니다...</p>; // theme이 null인 경우 처리
Expand Down Expand Up @@ -59,19 +46,17 @@ const SharePage = ({ onBack }) => {
</S.ClearCantainr>
</S.Wrapper>
<div id="share-button">
{isButtonVisible && (
<S.shareContainr>
<S.shareBtn onClick={handleCapture}>
<div className="ImgSave">
이미지 저장하고 공유하기
<img src={shareIcon} />
</div>
</S.shareBtn>
<button className="backBtn" onClick={onBack}>
뒤로가기
</button>
</S.shareContainr>
)}
<S.shareContainr>
<S.shareBtn onClick={handleCapture}>
<div className="ImgSave">
이미지 저장하고 공유하기
<img src={shareIcon} />
</div>
</S.shareBtn>
<button className="backBtn" onClick={onBack}>
뒤로가기
</button>
</S.shareContainr>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Share/styled.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ export const ClearMain = styled.div`
}
.textOverlay {
position: absolute;
top: 54%;
left: 49%;
top: 50%;
left: 50%;
z-index: 5;
font-weight: bold;
text-align: center;
Expand Down
1 change: 1 addition & 0 deletions src/router.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { SearchResultP } from "./pages/SearchPage/SearchResultP";
import { Test } from "./pages/TestPage/Test";
import { NotFound } from "./pages/NotFound/NotFount";
import { AgreePage } from "./pages/AgreePage/AgreePage";
import SharePage from "@/pages/Share/Share";
const router = createBrowserRouter([
{
path: "/",
Expand Down

0 comments on commit 0991394

Please sign in to comment.