generated from template/astro-template
"feat: 改进 Markdown 渲染布局与工具提示组件,新增 kevisual 平台文档"
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import { Tooltip as UITooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
|
||||
import React from 'react';
|
||||
|
||||
export const Tooltip = (props: { children?: React.ReactNode; title?: React.ReactNode; placement?: 'top' | 'bottom' | 'left' | 'right' }) => {
|
||||
export const Tooltip = (props: { children?: React.ReactNode; title?: React.ReactNode }) => {
|
||||
return (
|
||||
<TooltipProvider>
|
||||
<UITooltip>
|
||||
<TooltipTrigger asChild>{props.children}</TooltipTrigger>
|
||||
<TooltipContent className='bg-gray-800 text-white' side={props.placement || 'top'}>
|
||||
<TooltipContent>
|
||||
<p>{props.title}</p>
|
||||
</TooltipContent>
|
||||
</UITooltip>
|
||||
|
||||
2
src/components/html/md/Preview.css
Normal file
2
src/components/html/md/Preview.css
Normal file
@@ -0,0 +1,2 @@
|
||||
img {
|
||||
}
|
||||
16
src/components/html/md/Preview.tsx
Normal file
16
src/components/html/md/Preview.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import { cn } from '@/lib/utils';
|
||||
// import './Preview.css';
|
||||
|
||||
type Props = {
|
||||
children?: React.ReactNode;
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
[key: string]: any; // Allow any additional props
|
||||
};
|
||||
export const MarkdownPreview = (props: Props) => {
|
||||
return (
|
||||
<div className={cn('markdown-body scrollbar h-full overflow-auto px-6 py-2 max-w-[800px] border my-4 flex flex-col justify-self-center rounded-md shadow-md', props.className)} style={props.style}>
|
||||
{props.children}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user