Created
March 2, 2017 17:03
-
-
Save yantakus/c22894d27518d8d7ecf5bf055133d794 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import React from 'react' | |
import { Button } from 'react-formal' | |
import Spinner from 'components/Spinner' | |
type Props = { | |
messages: Object, | |
hint: string | HTMLElement, | |
text: string | HTMLElement, | |
isLoading: boolean, | |
disabled: boolean | |
} | |
const AuthButton = ({ messages, hint, text, isLoading, disabled }: Props) => { | |
const content = <div>{hint && <span className='button__hint'>{hint} </span>}{text}</div> | |
const hasValidationErrors = messages && !!Object.keys(messages).length | |
return ( | |
<Button | |
className='button large expanded' | |
type='submit' | |
disabled={disabled || hasValidationErrors} | |
>{isLoading ? <Spinner /> : content}</Button> | |
) | |
} | |
export default AuthButton |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment