summaryrefslogtreecommitdiff
path: root/components/notice/notice-view-dialog.tsx
blob: 9b42311ad4aaddcff9033870326cc1d130cd11ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
"use client"

import * as React from "react"
import {
  Dialog,
  DialogContent,
  DialogHeader,
  DialogTitle,
} from "@/components/ui/dialog"
import type { Notice } from "@/db/schema/notice"

type NoticeWithAuthor = Notice & {
  authorName: string | null
  authorEmail: string | null
}

interface NoticeViewDialogProps {
  open: boolean
  onOpenChange: (open: boolean) => void
  notice: NoticeWithAuthor | null
}

export function NoticeViewDialog({
  open,
  onOpenChange,
  notice,
}: NoticeViewDialogProps) {

  if (!notice) return null

  return (
    <Dialog open={open} onOpenChange={onOpenChange}>
      <DialogContent className="max-w-4xl max-h-[80vh] overflow-y-auto">
        <DialogHeader>
          <div className="flex items-start justify-between">
            <div className="space-y-2 flex-1">
              <div className="flex items-center gap-2">
                <DialogTitle className="text-xl font-bold">
                  제목: {notice.title}
                </DialogTitle>
              </div>              
            </div>
          </div>
        </DialogHeader>
        
        <div className="mt-6 rounded-lg border border-gray-200 p-4">
          <div 
            className="prose prose-sm max-w-none"
            dangerouslySetInnerHTML={{ __html: notice.content }}
          />
        </div>
      </DialogContent>

    </Dialog>
  )
}