2023-08-02 03:48:10 +02:00
|
|
|
import { HoverCard, useMantineTheme} from '@mantine/core';
|
|
|
|
|
import { RichTextEditor, Link } from '@mantine/tiptap';
|
|
|
|
|
import { useEditor } from '@tiptap/react';
|
|
|
|
|
import StarterKit from '@tiptap/starter-kit';
|
|
|
|
|
import { IconInfoCircle } from '@tabler/icons-react';
|
|
|
|
|
|
|
|
|
|
interface InfoCardProps {
|
|
|
|
|
content: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const InfoCard = ({ content }: InfoCardProps) => {
|
|
|
|
|
const { colorScheme } = useMantineTheme();
|
|
|
|
|
const editor = useEditor({
|
|
|
|
|
content,
|
|
|
|
|
editable: false,
|
2023-08-02 04:32:20 +02:00
|
|
|
editorProps: { attributes: { style: 'padding: 0;' }, },
|
2023-08-02 03:48:10 +02:00
|
|
|
extensions: [
|
|
|
|
|
StarterKit,
|
|
|
|
|
Link,
|
|
|
|
|
],
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return (
|
2023-08-02 04:32:20 +02:00
|
|
|
<HoverCard position="top" withArrow withinPortal>
|
2023-08-02 03:48:10 +02:00
|
|
|
<HoverCard.Target>
|
|
|
|
|
<IconInfoCircle size="1.25rem" style={{ display: 'block', opacity: 0.5 }} />
|
|
|
|
|
</HoverCard.Target>
|
|
|
|
|
<HoverCard.Dropdown
|
2023-08-02 04:32:20 +02:00
|
|
|
bg={colorScheme === 'light' ? "gray.2" : "dark.8"}
|
2023-08-02 03:48:10 +02:00
|
|
|
maw={400}
|
2023-08-02 04:32:20 +02:00
|
|
|
px="10px"
|
|
|
|
|
py="5px"
|
2023-08-02 03:48:10 +02:00
|
|
|
>
|
2023-08-02 04:32:20 +02:00
|
|
|
<RichTextEditor editor={editor} style={{ border:"0", }}>
|
|
|
|
|
<RichTextEditor.Content bg="transparent"/>
|
2023-08-02 03:48:10 +02:00
|
|
|
</RichTextEditor>
|
|
|
|
|
</HoverCard.Dropdown>
|
|
|
|
|
</HoverCard>
|
|
|
|
|
)
|
|
|
|
|
};
|