RezinaLMS-Admin/src/components/ui/rich-text-content.tsx
Yared Yemane 8649348120 Always show practice story fields on step 1 and add rich text editors.
Remove lesson-only field hiding from ContextStep and use TipTap for story description and quick tips in create/edit practice flows.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-20 15:08:26 +03:00

34 lines
809 B
TypeScript

import { cn } from "../../lib/utils"
import { looksLikeHtml, stripHtml } from "../../lib/richText"
export interface RichTextContentProps {
html?: string | null
className?: string
emptyLabel?: string
}
export function RichTextContent({
html,
className,
emptyLabel = "—",
}: RichTextContentProps) {
const trimmed = html?.trim() ?? ""
if (!trimmed) {
return <span className={cn("text-grayScale-400", className)}>{emptyLabel}</span>
}
if (looksLikeHtml(trimmed)) {
return (
<div
className={cn(
"prose prose-sm max-w-none text-grayScale-700 prose-p:my-1 prose-ul:my-1 prose-ol:my-1",
className,
)}
dangerouslySetInnerHTML={{ __html: trimmed }}
/>
)
}
return <span className={className}>{stripHtml(trimmed)}</span>
}