2022-11-09 12:28:04 +08:00
|
|
|
import React, { useRef, useState } from 'react';
|
2023-07-28 16:17:43 +08:00
|
|
|
import { EllipsisOutlined } from '@ant-design/icons';
|
2022-11-09 12:28:04 +08:00
|
|
|
import { Button, Divider, Space, Tour } from 'antd';
|
|
|
|
import type { TourProps } from 'antd';
|
|
|
|
|
|
|
|
const App: React.FC = () => {
|
|
|
|
const ref1 = useRef(null);
|
|
|
|
const ref2 = useRef(null);
|
|
|
|
const ref3 = useRef(null);
|
|
|
|
|
|
|
|
const [open, setOpen] = useState<boolean>(false);
|
|
|
|
|
|
|
|
const steps: TourProps['steps'] = [
|
|
|
|
{
|
|
|
|
title: 'Upload File',
|
|
|
|
description: 'Put your files here.',
|
|
|
|
cover: (
|
|
|
|
<img
|
|
|
|
alt="tour.png"
|
|
|
|
src="https://user-images.githubusercontent.com/5378891/197385811-55df8480-7ff4-44bd-9d43-a7dade598d70.png"
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
target: () => ref1.current,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Save',
|
|
|
|
description: 'Save your changes.',
|
|
|
|
target: () => ref2.current,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Other Actions',
|
|
|
|
description: 'Click to see other actions.',
|
|
|
|
target: () => ref3.current,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Button type="primary" onClick={() => setOpen(true)}>
|
|
|
|
Begin non-modal Tour
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
<Divider />
|
|
|
|
|
|
|
|
<Space>
|
|
|
|
<Button ref={ref1}> Upload</Button>
|
|
|
|
<Button ref={ref2} type="primary">
|
|
|
|
Save
|
|
|
|
</Button>
|
|
|
|
<Button ref={ref3} icon={<EllipsisOutlined />} />
|
|
|
|
</Space>
|
|
|
|
|
|
|
|
<Tour open={open} onClose={() => setOpen(false)} mask={false} type="primary" steps={steps} />
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default App;
|