computer-scienceangular-roadmapbackend-roadmapblockchain-roadmapdba-roadmapdeveloper-roadmapdevops-roadmapfrontend-roadmapgo-roadmaphactoberfestjava-roadmapjavascript-roadmapnodejs-roadmappython-roadmapqa-roadmapreact-roadmaproadmapstudy-planvue-roadmapweb3-roadmap
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.
45 lines
987 B
45 lines
987 B
2 years ago
|
import { Spinner } from '../ReactIcons/Spinner';
|
||
|
|
||
|
type NextButtonProps = {
|
||
|
isLoading?: boolean;
|
||
|
loadingMessage?: string;
|
||
|
text: string;
|
||
|
hasNextArrow?: boolean;
|
||
|
onClick?: () => void;
|
||
|
type?: string;
|
||
|
};
|
||
|
|
||
|
export function NextButton(props: NextButtonProps) {
|
||
|
const {
|
||
|
isLoading = false,
|
||
|
text = 'Next Step',
|
||
|
type = 'button',
|
||
|
loadingMessage = 'Please wait ..',
|
||
|
onClick = () => null,
|
||
|
hasNextArrow = true,
|
||
|
} = props;
|
||
|
|
||
|
return (
|
||
|
<button
|
||
|
type={type}
|
||
|
onClick={onClick}
|
||
|
disabled={isLoading}
|
||
|
className={
|
||
|
'rounded-md border border-black bg-black px-4 py-2 text-white disabled:opacity-50'
|
||
|
}
|
||
|
>
|
||
|
{isLoading ? (
|
||
|
<span className={'flex items-center justify-center'}>
|
||
|
<Spinner />
|
||
|
<span className="ml-2">{loadingMessage}</span>
|
||
|
</span>
|
||
|
) : (
|
||
|
<>
|
||
|
{text}
|
||
|
{hasNextArrow && <span className="ml-1">→</span>}
|
||
|
</>
|
||
|
)}
|
||
|
</button>
|
||
|
);
|
||
|
}
|