diff --git a/src/components/Blog/ContentsTable/index.tsx b/src/components/Blog/ContentsTable/index.tsx index 9636ac896..c31114fd5 100644 --- a/src/components/Blog/ContentsTable/index.tsx +++ b/src/components/Blog/ContentsTable/index.tsx @@ -5,7 +5,7 @@ import { useMemo } from 'react' import { scrollToElement } from '@/lib/scrollSmooth' import { Typography } from '@mui/material' import Link from 'next/link' -import css from '../styles.module.css' +import css from './styles.module.css' const ContentsTable = ({ content }: { content: ContentfulDocument }) => { const handleContentTableClick = (e: React.MouseEvent, target: string) => { @@ -26,21 +26,27 @@ const ContentsTable = ({ content }: { content: ContentfulDocument }) => { ) return ( - +
    + {headings.map((heading) => { + const headingKey = kebabCase(heading.id) + + return ( +
  1. + + handleContentTableClick(e, headingKey)} href={`#${headingKey}`}> + {heading.text} + + +
  2. + ) + })} +
+ ) } diff --git a/src/components/Blog/ContentsTable/styles.module.css b/src/components/Blog/ContentsTable/styles.module.css new file mode 100644 index 000000000..e01caca5f --- /dev/null +++ b/src/components/Blog/ContentsTable/styles.module.css @@ -0,0 +1,30 @@ +.contentsTable { + margin: 0; + border: 1px solid var(--mui-palette-border-light); + border-radius: 8px; + padding: 24px; + margin-bottom: 24px; +} + +.contentsTable ol { + list-style-type: none; + padding-left: 0px; +} + +.contentsTable li { + counter-increment: step-counter; + display: flex; + align-items: flex-start; + gap: 8px; +} + +.contentsTable li::before { + content: counter(step-counter) ' '; + white-space: pre; + color: var(--mui-palette-primary-light); +} + +.contentsTable a:hover { + text-decoration: underline; + color: var(--mui-palette-primary-main); +} diff --git a/src/components/Blog/Post/index.tsx b/src/components/Blog/Post/index.tsx index c3c997233..5826aac61 100644 --- a/src/components/Blog/Post/index.tsx +++ b/src/components/Blog/Post/index.tsx @@ -104,7 +104,9 @@ const Sidebar = ({