supermemory/apps/web/app/components/plate-ui/code-leaf.tsx
2025-01-20 17:50:45 -07:00

24 lines
546 B
TypeScript

'use client';
import React from 'react';
import { cn, withRef } from '@udecode/cn';
import { PlateLeaf } from '@udecode/plate-common/react';
export const CodeLeaf = withRef<typeof PlateLeaf>(
({ children, className, ...props }, ref) => {
return (
<PlateLeaf
ref={ref}
asChild
className={cn(
'whitespace-pre-wrap rounded-md bg-muted px-[0.3em] py-[0.2em] font-mono text-sm',
className
)}
{...props}
>
<code>{children}</code>
</PlateLeaf>
);
}
);