fix: storybook font rendering and shared fonts module #1
@@ -1,4 +1,5 @@
|
||||
import parse from 'html-react-parser';
|
||||
import { cn } from '$shared/lib';
|
||||
|
||||
type Props = {
|
||||
/**
|
||||
@@ -6,24 +7,19 @@ type Props = {
|
||||
*/
|
||||
html: string;
|
||||
/**
|
||||
* CSS classes applied to the wrapper div
|
||||
* Additional CSS classes merged onto the wrapper div
|
||||
*/
|
||||
className?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Renders a PocketBase rich-text HTML string as React elements.
|
||||
* Always applies editorial magazine typography via the rich-text CSS class.
|
||||
*/
|
||||
export function RichText({ html, className }: Props) {
|
||||
if (!html) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const parsed = parse(html);
|
||||
|
||||
if (className) {
|
||||
return <div className={className}>{parsed}</div>;
|
||||
}
|
||||
|
||||
return <>{parsed}</>;
|
||||
return <div className={cn('rich-text', className)}>{parse(html)}</div>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user