import React, { useRef, useState } from 'react'; import { Button, Col, Row, Slider, Space, Tour, Typography } from 'antd'; import type { TourProps } from 'antd'; const { Text } = Typography; const App: React.FC = () => { const tourNodeRef = useRef(null); const [radius, setRadius] = useState(8); const [offsetX, setOffsetX] = useState(2); const [offsetY, setOffsetY] = useState(2); const [offset, setOffset] = useState(2); const [open, setOpen] = useState(false); const [offsetDirection, setOffsetDirection] = useState<'both' | 'individual'>('individual'); const steps: TourProps['steps'] = [ { title: 'Upload File', description: 'Put your files here.', cover: ( tour.png ), target: () => tourNodeRef.current, }, ]; const offsetGap = offsetDirection === 'both' ? { offset } : { offset: [offsetX, offsetY] as [number, number], }; return (
Radius: val && setRadius(val)} /> offset: val && setOffset(val)} onFocus={() => setOffsetDirection('both')} /> Horizontal offset: val && setOffsetX(val)} onFocus={() => setOffsetDirection('individual')} /> Vertical offset: val && setOffsetY(val)} onFocus={() => setOffsetDirection('individual')} /> setOpen(false)} steps={steps} gap={{ ...offsetGap, radius }} />
); }; export default App;