-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
927cb85
commit 73a9496
Showing
19 changed files
with
316 additions
and
188 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { useNavigate } from "react-router-dom"; | ||
|
||
interface IBackspace { | ||
isHome?: boolean; | ||
} | ||
const BackSpace = ({ isHome }: IBackspace) => { | ||
const history = useNavigate(); | ||
|
||
return ( | ||
<button | ||
className="w-10 h-10 border-[1px] border-gray-400 rounded-md shadow-md hover:bg-gray-200 hover:rounded-md duration-500 text-lg" | ||
onClick={() => (isHome ? history("/") : history(-1))} | ||
> | ||
👈 | ||
</button> | ||
); | ||
}; | ||
|
||
export default BackSpace; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { Link } from "react-router-dom"; | ||
import { useRecoilValue } from "recoil"; | ||
import { diaryContent, diaryContentType } from "../../recoil/diary"; | ||
import Divider from "../common/Divider"; | ||
import GrayText from "../common/GrayText"; | ||
import JuiceFont from "../common/JuiceFont"; | ||
|
||
const DiaryCard = () => { | ||
const diary = useRecoilValue<diaryContentType[]>(diaryContent); | ||
return ( | ||
<div className="flex flex-col gap-6 justify-center items-center md:grid md:grid-cols-2 lg:grid-cols-3 bg-gray-300/[0.3]"> | ||
{diary.map((value) => ( | ||
<div | ||
className="flex flex-col w-full h-[calc(68vh)] rounded-lg bg-white shadow-lg p-4" | ||
key={value.day} | ||
> | ||
<JuiceFont isBig isBold> | ||
{value.day} | ||
</JuiceFont> | ||
<Divider /> | ||
<JuiceFont isSmall isBold others="my-2"> | ||
{value.title} | ||
</JuiceFont> | ||
<img | ||
src={value.template} | ||
className={`${ | ||
!value.template && "hidden" | ||
} flex justify-center items-center overflow-hidden w-[inherit] h-[inhrerit] rounded-sm shadow-md`} | ||
/> | ||
<div className="flex flex-col mt-2 px-2"> | ||
{value.content.map( | ||
(context, idx) => | ||
idx < 3 && ( | ||
<GrayText key={context.id}>{context.context}</GrayText> | ||
) | ||
)} | ||
{value.content && ( | ||
<Link to={`/diary/display/${value.day}`}> | ||
<JuiceFont isSmall isBold> | ||
자세히 | ||
</JuiceFont> | ||
</Link> | ||
)} | ||
</div> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default DiaryCard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { motion } from "framer-motion"; | ||
import { diaryItemType } from "../../recoil/diary"; | ||
import domtoimage from "dom-to-image"; | ||
import { saveAs } from "file-saver"; | ||
import { RefObject, useRef } from "react"; | ||
interface IDisplay { | ||
template?: string; | ||
title: string; | ||
day: string | undefined; | ||
content: diaryItemType[]; | ||
isDisplay?: boolean; | ||
} | ||
const diaryVariants = { | ||
normal: { | ||
scale: 1, | ||
}, | ||
hover: { | ||
scale: 1.025, | ||
transition: { | ||
duration: 0.3, | ||
}, | ||
}, | ||
}; | ||
|
||
const Display = ({ template, title, day, content }: IDisplay) => { | ||
const diaryRef: RefObject<HTMLDivElement> = useRef<HTMLDivElement>(null); | ||
// 컴포넌트 다운로드 함수 | ||
const onDownload = () => { | ||
const diary = diaryRef.current; | ||
if (!diary) return; | ||
domtoimage.toBlob(diary).then((blob) => { | ||
saveAs(blob, `${day}_${title}`); | ||
}); | ||
}; | ||
return ( | ||
<motion.div | ||
ref={diaryRef} | ||
variants={diaryVariants} | ||
whileHover="hover" | ||
initial="normal" | ||
onClick={onDownload} | ||
className={`${ | ||
template === "" && "bg-white" | ||
} w-[calc(75vw)] md:w-[calc(48vw)] h-[calc(80vh)] flex flex-col rounded-md shadow-lg `} | ||
> | ||
<img | ||
src={template} | ||
className={`${ | ||
template === "" && "hidden" | ||
} absolute flex overflow-hidden z-[-1] w-[inherit] h-[inherit] rounded-md `} | ||
/> | ||
<div className="flex justify-between p-2"> | ||
<div className="text-2xl font-bold">{title}</div> | ||
<div className="text-2xl font-bold">{day}</div> | ||
</div> | ||
|
||
<div className="p-2"> | ||
{content.map((context) => ( | ||
<div | ||
key={context.id} | ||
className={`w-fit h-fit p-1 rounded-md ${context.style.textBg} ${context.style.textColor} ${context.style.textSize}`} | ||
> | ||
{context.context} | ||
</div> | ||
))} | ||
</div> | ||
</motion.div> | ||
); | ||
}; | ||
|
||
export default Display; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.