11'use client' ;
22import Link from 'next/link' ;
33import { useEffect , useState } from 'react' ;
4+ import { FaTree } from 'react-icons/fa' ;
45import { FaBookBible , FaX } from 'react-icons/fa6' ;
6+ import { GiLog } from 'react-icons/gi' ;
7+ import { MdPushPin } from 'react-icons/md' ;
8+ import { PiAxeFill } from 'react-icons/pi' ;
59
610const PostTOC = ( { postContent } : { postContent : string } ) => {
711 const [ activeId , setActiveId ] = useState ( '' ) ;
812 const [ isTOCVisible , setIsTOCVisible ] = useState ( false ) ;
913 const [ isScrolled , setIsScrolled ] = useState ( false ) ;
1014 const [ tocPosition , setTocPosition ] = useState ( 0 ) ;
11- const [ isMobile , setIsMobile ] = useState ( false ) ;
15+ const [ isMobile , setIsMobile ] = useState ( true ) ;
1216
1317 const parseHeadings = ( content : string ) => {
1418 const headings = content . match ( / # { 1 , 6 } .+ / g) ;
@@ -78,13 +82,13 @@ const PostTOC = ({ postContent }: { postContent: string }) => {
7882 const renderEmoji = ( type : number ) => {
7983 switch ( type ) {
8084 case 1 :
81- return '🌲 ' ;
85+ return < FaTree /> ;
8286 case 2 :
83- return '🪓 ' ;
87+ return < PiAxeFill /> ;
8488 case 3 :
85- return '🪵 ' ;
89+ return < GiLog /> ;
8690 default :
87- return '🪵 ' ;
91+ return < GiLog /> ;
8892 }
8993 } ;
9094
@@ -96,7 +100,7 @@ const PostTOC = ({ postContent }: { postContent: string }) => {
96100 < >
97101 { /* 모바일용 토글 버튼 */ }
98102 < button
99- className = "fixed bottom-4 right-4 md:hidden bg-green-500 text-white p-4 rounded-full shadow-lg z-10"
103+ className = "fixed bottom-4 right-4 md:hidden bg-primary-dark text-white p-4 rounded-full shadow-lg z-10"
100104 onClick = { ( ) => setIsTOCVisible ( ! isTOCVisible ) }
101105 aria-label = "목차 열기/닫기"
102106 >
@@ -105,9 +109,9 @@ const PostTOC = ({ postContent }: { postContent: string }) => {
105109
106110 < div
107111 className = { `
108- post-toc text-sm
112+ post-toc text-sm border dark:border-gray-100/30
109113 transition-all duration-300
110- ${ isScrolled ? 'bg-gray-100/95 dark:bg-neutral-700/95 shadow-md' : 'bg-gray-100/80 dark:bg-neutral-700/80' }
114+ ${ isScrolled ? 'bg-gray-100/80 dark:bg-neutral-700/80 md:bg-gray-100/35 md:dark:bg-neutral-700/35 shadow-md' : 'bg-gray-100/80 dark:bg-neutral-700/80' }
111115 rounded-md p-4 text-black dark:text-white z-[2]
112116
113117 fixed bottom-0 left-0 right-0 max-h-[50vh] md:max-h-none
@@ -123,7 +127,12 @@ const PostTOC = ({ postContent }: { postContent: string }) => {
123127 top : ! isMobile ? `${ tocPosition } px` : 'auto' ,
124128 } }
125129 >
126- < h4 className = { `text-xl font-bold mb-2 ` } > 📌 Table of Contents</ h4 >
130+ < h4
131+ className = { `inline-flex items-center gap-1 text-lg font-bold mb-2 ` }
132+ >
133+ < MdPushPin size = { 24 } color = "red" />
134+ Table of Contents
135+ </ h4 >
127136 < ul
128137 className = { `list-none transition-all duration-300 overflow-hidden ` }
129138 >
@@ -132,21 +141,21 @@ const PostTOC = ({ postContent }: { postContent: string }) => {
132141 return (
133142 < li
134143 key = { heading . id }
135- style = { { marginLeft : `${ ( heading . type - 1 ) * 16 } px` } }
144+ style = { { marginLeft : `${ ( heading . type - 1 ) * 12 } px` } }
136145 className = { `${ heading . type === 1 ? 'font-bold mb-1' : '' } ` }
137146 >
138147 < Link
139148 scroll = { false }
140149 className = { `
141- p-1 block transition-all
150+ p-1 flex gap-1 transition-all
142151 ${
143152 isActive
144- ? 'bg-green-200 text-green-800 '
145- : 'hover:bg-green-50 dark: hover:bg -green-800 dark:hover:text-white'
153+ ? 'border-l-4 rounded-none border-primary-bangladesh text-primary-rich dark:text-primary-caribbean '
154+ : ' hover:border-b hover:rounded-none hover:text -green-800 dark:hover:text-white'
146155 }
147- rounded-md overflow-hidden whitespace-nowrap text-ellipsis
156+ rounded-md overflow-hidden whitespace-nowrap text-ellipsis transition-transform hover:scale-105 duration-300 hover:z-30
148157 ` }
149- onClick = { ( e ) => {
158+ onClick = { ( e : React . MouseEvent ) => {
150159 e . preventDefault ( ) ;
151160 document . getElementById ( heading . id ) ?. scrollIntoView ( {
152161 behavior : 'smooth' ,
0 commit comments