Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/examples/basic.less
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,20 @@
}
}

&-buttons {
display: flex;
}

&-prev-btn,&-next-btn,&-finish-btn{
display: inline-block;
margin-left: 8px;
}

&-prompt-btn {
display: inline-block;
min-width: 80px;
}

.ant-btn-primary {
color: #fff;
border: 1px solid #1890ff;
Expand Down
5 changes: 5 additions & 0 deletions src/Tour.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const Tour: React.FC<TourProps> = props => {
open,
mask = true,
arrow = true,
prompt= false,
rootClassName,
placement,
renderPanel,
Expand Down Expand Up @@ -167,6 +168,10 @@ const Tour: React.FC<TourProps> = props => {
handleClose();
onFinish?.();
}}
onNoPrompt={() => {
handleClose();
onFinish?.();
}}
{...steps[mergedCurrent]}
closable={mergedClosable}
/>
Expand Down
24 changes: 17 additions & 7 deletions src/TourStep/DefaultPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export default function DefaultPanel(props: DefaultPanelProps) {
onFinish,
className,
closable,
prompt = true,
onNoPrompt
} = props;
const ariaProps = pickAttrs(closable || {}, true);
const closeIcon = closable?.closeIcon ?? <span className={`${prefixCls}-close-x`}>&times;</span>;
Expand Down Expand Up @@ -47,16 +49,24 @@ export default function DefaultPanel(props: DefaultPanelProps) {
<div className={`${prefixCls}-sliders`}>
{total > 1
? [...Array.from({ length: total }).keys()].map((item, index) => {
return (
<span
key={item}
className={index === current ? 'active' : ''}
/>
);
})
return (
<span
key={item}
className={index === current ? 'active' : ''}
/>
);
})
: null}
</div>
<div className={`${prefixCls}-buttons`}>
{prompt && (
<button
className={`${prefixCls}-prompt-btn`}
onClick={onNoPrompt}
>
No Prompt
</button>
)}
{current !== 0 ? (
<button className={`${prefixCls}-prev-btn`} onClick={onPrev}>
Prev
Expand Down
2 changes: 2 additions & 0 deletions src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ export interface TourStepProps extends TourStepInfo {
prefixCls?: string;
total?: number;
current?: number;
prompt?: boolean;
onClose?: () => void;
onFinish?: () => void;
renderPanel?: (step: TourStepProps, current: number) => ReactNode;
onPrev?: () => void;
onNext?: () => void;
onNoPrompt?: () => void;
}

export interface TourProps extends Pick<TriggerProps, 'onPopupAlign'> {
Expand Down