ant-design/components/tooltip/demo/_semantic.tsx
afc163 4546987d0c
chore: refactor .dumi code folders (#53437)
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-05-23 22:33:40 +08:00

51 lines
1.2 KiB
TypeScript

import React from 'react';
import { Tooltip } from 'antd';
import SemanticPreview from '../../../.dumi/theme/common/SemanticPreview';
import useLocale from '../../../.dumi/hooks/useLocale';
const locales = {
cn: {
root: '根元素 (包含箭头、内容元素)',
body: '内容元素',
},
en: {
root: 'Root element (including arrows, content elements)',
body: 'Body element',
},
};
const BlockList: React.FC<React.PropsWithChildren> = (props: any) => {
const divRef = React.useRef<HTMLDivElement>(null);
return (
<div ref={divRef} style={{ position: 'absolute', marginTop: 60 }}>
<Tooltip
title="prompt text"
open
placement="top"
autoAdjustOverflow={false}
getPopupContainer={() => divRef.current}
{...props}
/>
</div>
);
};
const App: React.FC = () => {
const [locale] = useLocale(locales);
return (
<SemanticPreview
componentName="Tooltip"
semantics={[
{ name: 'root', desc: locale.root, version: '5.23.0' },
{ name: 'body', desc: locale.body, version: '5.23.0' },
]}
>
<BlockList />
</SemanticPreview>
);
};
export default App;