-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathCustomButton.tsx
More file actions
46 lines (43 loc) · 1.36 KB
/
CustomButton.tsx
File metadata and controls
46 lines (43 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import React from 'react';
import { Tour, Button } from '@tiny-design/react';
import type { TourStepProps } from '../../tour/types';
export default function CustomButtonDemo() {
const [open, setOpen] = React.useState(false);
const ref1 = React.useRef<HTMLButtonElement>(null);
const ref2 = React.useRef<HTMLButtonElement>(null);
const ref3 = React.useRef<HTMLButtonElement>(null);
const steps: TourStepProps[] = [
{
title: 'Upload File',
description: 'Put your files here.',
target: () => ref1.current,
nextButtonProps: { children: 'Go Next' },
},
{
title: 'Save',
description: 'Save your changes.',
target: () => ref2.current,
prevButtonProps: { children: 'Go Back' },
nextButtonProps: { children: 'Continue' },
},
{
title: 'Other Actions',
description: 'Click to see other actions.',
target: () => ref3.current,
prevButtonProps: { children: 'Go Back' },
nextButtonProps: { children: 'Done!' },
},
];
return (
<>
<div style={{ display: 'flex', gap: 16 }}>
<Button ref={ref1}>Upload</Button>
<Button ref={ref2}>Save</Button>
<Button ref={ref3} btnType="primary" onClick={() => setOpen(true)}>
Start Tour
</Button>
</div>
<Tour open={open} steps={steps} onClose={() => setOpen(false)} />
</>
);
}