Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/website/portal-onboarding-polish
This commit is contained in:
		
							
								
								
									
										40
									
								
								packages/website/ts/components/ui/account_connection.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								packages/website/ts/components/ui/account_connection.tsx
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
			
		||||
import * as React from 'react';
 | 
			
		||||
 | 
			
		||||
import { Circle } from 'ts/components/ui/circle';
 | 
			
		||||
import { Container } from 'ts/components/ui/container';
 | 
			
		||||
import { Text } from 'ts/components/ui/text';
 | 
			
		||||
import { colors } from 'ts/style/colors';
 | 
			
		||||
import { AccountState } from 'ts/types';
 | 
			
		||||
 | 
			
		||||
export interface AccountConnectionProps {
 | 
			
		||||
    accountState: AccountState;
 | 
			
		||||
    injectedProviderName: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export const AccountConnection: React.StatelessComponent<AccountConnectionProps> = ({
 | 
			
		||||
    accountState,
 | 
			
		||||
    injectedProviderName,
 | 
			
		||||
}) => {
 | 
			
		||||
    return (
 | 
			
		||||
        <Container className="flex items-center">
 | 
			
		||||
            <Circle diameter={6} fillColor={getInjectedProviderColor(accountState)} />
 | 
			
		||||
            <Container marginLeft="6px">
 | 
			
		||||
                <Text fontSize="12px" lineHeight="14px" fontColor={colors.darkGrey}>
 | 
			
		||||
                    {injectedProviderName}
 | 
			
		||||
                </Text>
 | 
			
		||||
            </Container>
 | 
			
		||||
        </Container>
 | 
			
		||||
    );
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const getInjectedProviderColor = (accountState: AccountState) => {
 | 
			
		||||
    switch (accountState) {
 | 
			
		||||
        case AccountState.Ready:
 | 
			
		||||
            return colors.limeGreen;
 | 
			
		||||
        case AccountState.Locked:
 | 
			
		||||
        case AccountState.Loading:
 | 
			
		||||
        case AccountState.Disconnected:
 | 
			
		||||
        default:
 | 
			
		||||
            return colors.red;
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										16
									
								
								packages/website/ts/components/ui/circle.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								packages/website/ts/components/ui/circle.tsx
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
import * as React from 'react';
 | 
			
		||||
 | 
			
		||||
export interface CircleProps {
 | 
			
		||||
    className?: string;
 | 
			
		||||
    diameter: number;
 | 
			
		||||
    fillColor: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export const Circle: React.StatelessComponent<CircleProps> = ({ className, diameter, fillColor }) => {
 | 
			
		||||
    const radius = diameter / 2;
 | 
			
		||||
    return (
 | 
			
		||||
        <svg className={className} height={diameter} width={diameter}>
 | 
			
		||||
            <circle cx={radius} cy={radius} r={radius} fill={fillColor} />
 | 
			
		||||
        </svg>
 | 
			
		||||
    );
 | 
			
		||||
};
 | 
			
		||||
@@ -14,7 +14,9 @@ export interface ContainerProps {
 | 
			
		||||
    backgroundColor?: string;
 | 
			
		||||
    borderRadius?: StringOrNum;
 | 
			
		||||
    maxWidth?: StringOrNum;
 | 
			
		||||
    maxHeight?: StringOrNum;
 | 
			
		||||
    width?: StringOrNum;
 | 
			
		||||
    height?: StringOrNum;
 | 
			
		||||
    minHeight?: StringOrNum;
 | 
			
		||||
    isHidden?: boolean;
 | 
			
		||||
    className?: string;
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@ import blockies = require('blockies');
 | 
			
		||||
import * as _ from 'lodash';
 | 
			
		||||
import * as React from 'react';
 | 
			
		||||
 | 
			
		||||
import { Circle } from 'ts/components/ui/circle';
 | 
			
		||||
import { Image } from 'ts/components/ui/image';
 | 
			
		||||
import { colors } from 'ts/style/colors';
 | 
			
		||||
 | 
			
		||||
@@ -20,7 +21,6 @@ export class Identicon extends React.Component<IdenticonProps, IdenticonState> {
 | 
			
		||||
    public render(): React.ReactNode {
 | 
			
		||||
        const address = this.props.address;
 | 
			
		||||
        const diameter = this.props.diameter;
 | 
			
		||||
        const radius = diameter / 2;
 | 
			
		||||
        return (
 | 
			
		||||
            <div
 | 
			
		||||
                className="circle relative transitionFix"
 | 
			
		||||
@@ -40,9 +40,7 @@ export class Identicon extends React.Component<IdenticonProps, IdenticonState> {
 | 
			
		||||
                        width={diameter}
 | 
			
		||||
                    />
 | 
			
		||||
                ) : (
 | 
			
		||||
                    <svg height={diameter} width={diameter}>
 | 
			
		||||
                        <circle cx={radius} cy={radius} r={radius} fill={colors.grey200} />
 | 
			
		||||
                    </svg>
 | 
			
		||||
                    <Circle diameter={diameter} fillColor={colors.grey200} />
 | 
			
		||||
                )}
 | 
			
		||||
            </div>
 | 
			
		||||
        );
 | 
			
		||||
 
 | 
			
		||||
@@ -15,6 +15,7 @@ export interface TextProps {
 | 
			
		||||
    minHeight?: string;
 | 
			
		||||
    center?: boolean;
 | 
			
		||||
    fontWeight?: number | string;
 | 
			
		||||
    textDecorationLine?: string;
 | 
			
		||||
    onClick?: () => void;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -28,6 +29,7 @@ export const Text = styled(PlainText)`
 | 
			
		||||
    font-family: ${props => props.fontFamily};
 | 
			
		||||
    font-weight: ${props => props.fontWeight};
 | 
			
		||||
    font-size: ${props => props.fontSize};
 | 
			
		||||
    text-decoration-line: ${props => props.textDecorationLine};
 | 
			
		||||
    ${props => (props.lineHeight ? `line-height: ${props.lineHeight}` : '')};
 | 
			
		||||
    ${props => (props.center ? 'text-align: center' : '')};
 | 
			
		||||
    color: ${props => props.fontColor};
 | 
			
		||||
@@ -45,6 +47,7 @@ Text.defaultProps = {
 | 
			
		||||
    fontColor: colors.black,
 | 
			
		||||
    fontSize: '15px',
 | 
			
		||||
    lineHeight: '1.5em',
 | 
			
		||||
    textDecorationLine: 'none',
 | 
			
		||||
    Tag: 'div',
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user