ente/src/components/SubmitButton.tsx

34 lines
766 B
TypeScript
Raw Normal View History

2021-04-11 05:02:32 +00:00
import React from 'react';
2021-05-29 06:27:52 +00:00
import {Button, Spinner} from 'react-bootstrap';
2021-04-11 05:02:32 +00:00
interface Props {
loading: boolean;
buttonText: string;
2021-04-26 07:37:34 +00:00
inline?: any;
2021-05-23 15:34:26 +00:00
disabled?: boolean;
2021-04-11 05:02:32 +00:00
}
2021-05-29 06:27:52 +00:00
const SubmitButton = ({
loading, buttonText, inline, disabled,
}: Props) => (
2021-04-11 10:07:57 +00:00
<Button
2021-04-25 15:01:44 +00:00
className="submitButton"
variant="outline-success"
2021-04-11 10:07:57 +00:00
type="submit"
2021-04-26 07:37:34 +00:00
block={!inline}
2021-05-23 15:34:26 +00:00
disabled={loading || disabled}
2021-05-29 06:27:52 +00:00
style={{padding: '6px 1em'}}
2021-04-11 10:07:57 +00:00
>
2021-04-11 05:02:32 +00:00
{loading ? (
<Spinner
as="span"
animation="border"
2021-05-29 06:27:52 +00:00
style={{width: '22px', height: '22px', borderWidth: '0.20em'}}
2021-04-11 05:02:32 +00:00
/>
) : (
buttonText
)}
</Button>
);
export default SubmitButton;