aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/components/ui/account_connection.tsx
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-06-29 14:24:57 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-06-29 14:24:57 +0800
commit08f7666d210317d8caaca72f5a81c860478a2387 (patch)
tree1018b711ce8e8d51f5bb83fe5a2185180ae9281c /packages/website/ts/components/ui/account_connection.tsx
parent81ff99276bec5420fd3822925e63b6ed60510b1c (diff)
downloaddexon-0x-contracts-08f7666d210317d8caaca72f5a81c860478a2387.tar.gz
dexon-0x-contracts-08f7666d210317d8caaca72f5a81c860478a2387.tar.zst
dexon-0x-contracts-08f7666d210317d8caaca72f5a81c860478a2387.zip
Create AccountConnection component
Diffstat (limited to 'packages/website/ts/components/ui/account_connection.tsx')
-rw-r--r--packages/website/ts/components/ui/account_connection.tsx40
1 files changed, 40 insertions, 0 deletions
diff --git a/packages/website/ts/components/ui/account_connection.tsx b/packages/website/ts/components/ui/account_connection.tsx
new file mode 100644
index 000000000..0f61ecde4
--- /dev/null
+++ b/packages/website/ts/components/ui/account_connection.tsx
@@ -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>
+ );
+};
+
+function getInjectedProviderColor(accountState: AccountState): string {
+ switch (accountState) {
+ case AccountState.Ready:
+ return colors.limeGreen;
+ case AccountState.Locked:
+ case AccountState.Loading:
+ case AccountState.Disconnected:
+ default:
+ return colors.red;
+ }
+}