feat(instant): Add failure state and icon
This commit is contained in:
		@@ -1,24 +1,11 @@
 | 
				
			|||||||
import * as React from 'react';
 | 
					import * as React from 'react';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { ColorOption } from '../style/theme';
 | 
					import { SecondaryButton } from './secondary_button';
 | 
				
			||||||
 | 
					 | 
				
			||||||
import { Button, Text } from './ui';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface RetryButtonProps {
 | 
					export interface RetryButtonProps {
 | 
				
			||||||
    onClick: () => void;
 | 
					    onClick: () => void;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const RetryButton: React.StatelessComponent<RetryButtonProps> = props => {
 | 
					export const RetryButton: React.StatelessComponent<RetryButtonProps> = props => {
 | 
				
			||||||
    return (
 | 
					    return <SecondaryButton text="Try Again" onClick={props.onClick} />;
 | 
				
			||||||
        <Button
 | 
					 | 
				
			||||||
            backgroundColor={ColorOption.white}
 | 
					 | 
				
			||||||
            borderColor={ColorOption.lightGrey}
 | 
					 | 
				
			||||||
            width="100%"
 | 
					 | 
				
			||||||
            onClick={props.onClick}
 | 
					 | 
				
			||||||
        >
 | 
					 | 
				
			||||||
            <Text fontColor={ColorOption.primaryColor} fontWeight={600} fontSize="16px">
 | 
					 | 
				
			||||||
                Try Again
 | 
					 | 
				
			||||||
            </Text>
 | 
					 | 
				
			||||||
        </Button>
 | 
					 | 
				
			||||||
    );
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										28
									
								
								packages/instant/src/components/secondary_button.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								packages/instant/src/components/secondary_button.tsx
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
				
			|||||||
 | 
					import * as _ from 'lodash';
 | 
				
			||||||
 | 
					import * as React from 'react';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import { ColorOption } from '../style/theme';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import { Button, ButtonProps } from './ui/button';
 | 
				
			||||||
 | 
					import { Text } from './ui/text';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface SecondaryButtonProps extends ButtonProps {
 | 
				
			||||||
 | 
					    text: string;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const SecondaryButton: React.StatelessComponent<SecondaryButtonProps> = props => {
 | 
				
			||||||
 | 
					    const buttonProps = _.omit(props, 'text');
 | 
				
			||||||
 | 
					    return (
 | 
				
			||||||
 | 
					        <Button
 | 
				
			||||||
 | 
					            backgroundColor={ColorOption.white}
 | 
				
			||||||
 | 
					            borderColor={ColorOption.lightGrey}
 | 
				
			||||||
 | 
					            width="100%"
 | 
				
			||||||
 | 
					            onClick={props.onClick}
 | 
				
			||||||
 | 
					            {...buttonProps}
 | 
				
			||||||
 | 
					        >
 | 
				
			||||||
 | 
					            <Text fontColor={ColorOption.primaryColor} fontWeight={600} fontSize="16px">
 | 
				
			||||||
 | 
					                {props.text}
 | 
				
			||||||
 | 
					            </Text>
 | 
				
			||||||
 | 
					        </Button>
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
@@ -2,6 +2,7 @@ import * as _ from 'lodash';
 | 
				
			|||||||
import * as React from 'react';
 | 
					import * as React from 'react';
 | 
				
			||||||
import { connect } from 'react-redux';
 | 
					import { connect } from 'react-redux';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import { SecondaryButton } from '../components/secondary_button';
 | 
				
			||||||
import { State } from '../redux/reducer';
 | 
					import { State } from '../redux/reducer';
 | 
				
			||||||
import { AsyncProcessState } from '../types';
 | 
					import { AsyncProcessState } from '../types';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -21,6 +22,10 @@ const SelectedAssetButtonPresentationComponent: React.StatelessComponent<{
 | 
				
			|||||||
}> = props => {
 | 
					}> = props => {
 | 
				
			||||||
    if (props.buyOrderState === AsyncProcessState.FAILURE) {
 | 
					    if (props.buyOrderState === AsyncProcessState.FAILURE) {
 | 
				
			||||||
        return <SelectedAssetRetryButton />;
 | 
					        return <SelectedAssetRetryButton />;
 | 
				
			||||||
 | 
					    } else if (props.buyOrderState === AsyncProcessState.SUCCESS) {
 | 
				
			||||||
 | 
					        return <SecondaryButton text="Success" isDisabled={true} />;
 | 
				
			||||||
 | 
					    } else if (props.buyOrderState === AsyncProcessState.PENDING) {
 | 
				
			||||||
 | 
					        return <SecondaryButton text="Processing" isDisabled={true} />;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return <SelectedAssetBuyButton />;
 | 
					    return <SelectedAssetBuyButton />;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user