|
| 1 | +import { CloudIcon, ColorSirenIcon, SnowIcon, ThermostatIcon, WarmIcon } from '@/assets/icons'; |
| 2 | +import { useState } from 'react'; |
| 3 | +import { twMerge } from 'tailwind-merge'; |
| 4 | + |
| 5 | +export default function LetterDetail({ title, text }: { title: string; text: string }) { |
| 6 | + const FONT = ''; |
| 7 | + const THEME = 'field'; |
| 8 | + const [degreeModalOpen, setDegreeModalOpen] = useState<boolean>(false); |
| 9 | + return ( |
| 10 | + <div className={twMerge(`flex grow flex-col gap-3 px-5 pb-7.5`, THEME)}> |
| 11 | + <div className="absolute top-5 right-5 flex gap-3"> |
| 12 | + <button |
| 13 | + className="flex items-center justify-center gap-1" |
| 14 | + onClick={() => { |
| 15 | + setDegreeModalOpen(true); |
| 16 | + }} |
| 17 | + > |
| 18 | + <img src={ThermostatIcon} alt="편지 온도 아이콘" /> |
| 19 | + <span className="caption-b text-primary-1">편지 온도</span> |
| 20 | + </button> |
| 21 | + <button onClick={() => {}}> |
| 22 | + <img src={ColorSirenIcon} alt="신고 아이콘" /> |
| 23 | + </button> |
| 24 | + {degreeModalOpen && ( |
| 25 | + <div className="caption-b text-primary-1 bg-primary-5 absolute top-7 z-40 flex flex-col gap-1 p-2 shadow"> |
| 26 | + <button |
| 27 | + className="flex items-center justify-center gap-1" |
| 28 | + onClick={() => { |
| 29 | + setDegreeModalOpen(false); |
| 30 | + }} |
| 31 | + > |
| 32 | + <img src={WarmIcon} alt="따뜻 아이콘" /> 따뜻해요 |
| 33 | + </button> |
| 34 | + <button |
| 35 | + className="flex items-center justify-center gap-1" |
| 36 | + onClick={() => { |
| 37 | + setDegreeModalOpen(false); |
| 38 | + }} |
| 39 | + > |
| 40 | + <img src={CloudIcon} alt="그럭저럭 아이콘" /> 그럭저럭 |
| 41 | + </button> |
| 42 | + <button |
| 43 | + className="flex items-center justify-center gap-1" |
| 44 | + onClick={() => { |
| 45 | + setDegreeModalOpen(false); |
| 46 | + }} |
| 47 | + > |
| 48 | + <img src={SnowIcon} alt="차가움 아이콘" /> 앗! 차가워 |
| 49 | + </button> |
| 50 | + </div> |
| 51 | + )} |
| 52 | + </div> |
| 53 | + <div className="flex flex-col gap-3 px-5"> |
| 54 | + <span className="body-b mt-[55px]">TO. 따숨이</span> |
| 55 | + <span className="body-sb">{title}</span> |
| 56 | + </div> |
| 57 | + <textarea |
| 58 | + readOnly |
| 59 | + value={text} |
| 60 | + className={twMerge( |
| 61 | + `body-r basic-theme min-h-full w-full grow px-6 focus:outline-none`, |
| 62 | + `${FONT}`, |
| 63 | + )} |
| 64 | + ></textarea> |
| 65 | + <span className="body-sb mt-10 flex justify-end">FROM. {'12E12'}</span> |
| 66 | + <button className="bg-primary-3 mt-3 w-full rounded-lg py-2">편지 작성하기</button> |
| 67 | + </div> |
| 68 | + ); |
| 69 | +} |
0 commit comments