You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.4 KiB
58 lines
1.4 KiB
import { EllipsisOutlined } from '@ant-design/icons';
|
|
import type { TourProps } from 'antd';
|
|
import { Button, Divider, Space, Tour } from 'antd';
|
|
import React, { useRef, useState } from 'react';
|
|
|
|
const App: React.FC = () => {
|
|
const ref1 = useRef<HTMLButtonElement>(null);
|
|
const ref2 = useRef<HTMLButtonElement>(null);
|
|
const ref3 = useRef<HTMLButtonElement>(null);
|
|
|
|
const [open, setOpen] = useState<boolean>(false);
|
|
|
|
const steps: TourProps['steps'] = [
|
|
{
|
|
title: 'Upload File',
|
|
description: 'Put your files here.',
|
|
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 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)}
|
|
steps={steps}
|
|
indicatorsRender={(current, total) => (
|
|
<span>
|
|
{current + 1} / {total}
|
|
</span>
|
|
)}
|
|
/>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default App;
|
|
|