1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-18 07:23:21 +01:00
metamask-extension/ui/pages/swaps/dropdown-search-list/dropdown-search-list.stories.js

149 lines
3.5 KiB
JavaScript
Raw Normal View History

import React from 'react';
import DropdownSearchList from '.';
2020-10-06 20:28:38 +02:00
const tokens = [
2020-11-03 00:41:28 +01:00
{
primaryLabel: 'MetaMark (META)',
name: 'MetaMark',
iconUrl: 'metamark.svg',
2020-11-03 00:41:28 +01:00
erc20: true,
decimals: 18,
symbol: 'META',
address: '0x617b3f8050a0BD94b6b1da02B4384eE5B4DF13F4',
},
{
primaryLabel: '0x (ZRX)',
name: '0x',
iconUrl: '0x.svg',
2020-11-03 00:41:28 +01:00
erc20: true,
symbol: 'ZRX',
decimals: 18,
address: '0xE41d2489571d322189246DaFA5ebDe1F4699F498',
},
{
primaryLabel: 'AirSwap Token (AST)',
name: 'AirSwap Token',
iconUrl: 'AST.png',
2020-11-03 00:41:28 +01:00
erc20: true,
symbol: 'AST',
decimals: 4,
address: '0x27054b13b1B798B345b591a4d22e6562d47eA75a',
},
{
primaryLabel: 'Basic Attention Token (BAT)',
name: 'Basic Attention Token',
iconUrl: 'BAT_icon.svg',
2020-11-03 00:41:28 +01:00
erc20: true,
symbol: 'BAT',
decimals: 18,
address: '0x0D8775F648430679A709E98d2b0Cb6250d2887EF',
},
{
primaryLabel: 'Civil Token (CVL)',
name: 'Civil Token',
iconUrl: 'CVL_token.svg',
2020-11-03 00:41:28 +01:00
erc20: true,
symbol: 'CVL',
decimals: 18,
address: '0x01FA555c97D7958Fa6f771f3BbD5CCD508f81e22',
},
{
primaryLabel: 'Gladius (GLA)',
name: 'Gladius',
iconUrl: 'gladius.svg',
2020-11-03 00:41:28 +01:00
erc20: true,
symbol: 'GLA',
decimals: 8,
address: '0x71D01dB8d6a2fBEa7f8d434599C237980C234e4C',
},
{
primaryLabel: 'Gnosis Token (GNO)',
name: 'Gnosis Token',
iconUrl: 'gnosis.svg',
2020-11-03 00:41:28 +01:00
erc20: true,
symbol: 'GNO',
decimals: 18,
address: '0x6810e776880C02933D47DB1b9fc05908e5386b96',
},
{
primaryLabel: 'OmiseGO (OMG)',
name: 'OmiseGO',
iconUrl: 'omg.jpg',
2020-11-03 00:41:28 +01:00
erc20: true,
symbol: 'OMG',
decimals: 18,
address: '0xd26114cd6EE289AccF82350c8d8487fedB8A0C07',
},
{
primaryLabel: 'Sai Stablecoin v1.0 (SAI)',
name: 'Sai Stablecoin v1.0',
iconUrl: 'sai.svg',
2020-11-03 00:41:28 +01:00
erc20: true,
symbol: 'SAI',
decimals: 18,
address: '0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359',
},
{
primaryLabel: 'Tether USD (USDT)',
name: 'Tether USD',
iconUrl: 'tether_usd.png',
2020-11-03 00:41:28 +01:00
erc20: true,
symbol: 'USDT',
decimals: 6,
address: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
},
{
primaryLabel: 'WednesdayCoin (WED)',
name: 'WednesdayCoin',
iconUrl: 'wed.png',
2020-11-03 00:41:28 +01:00
erc20: true,
symbol: 'WED',
decimals: 18,
address: '0x7848ae8F19671Dc05966dafBeFbBbb0308BDfAbD',
},
{
primaryLabel: 'Wrapped BTC (WBTC)',
name: 'Wrapped BTC',
iconUrl: 'wbtc.png',
2020-11-03 00:41:28 +01:00
erc20: true,
symbol: 'WBTC',
decimals: 8,
address: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
},
];
2020-10-06 20:28:38 +02:00
export default {
title: 'Pages/Swaps/DropdownSearchList',
id: __filename,
};
2020-10-06 20:28:38 +02:00
const tokensToSearch = tokens.map((token) => ({
...token,
primaryLabel: token.symbol,
secondaryLabel: token.name,
2020-11-03 00:41:28 +01:00
rightPrimaryLabel: `${(Math.random() * 100).toFixed(
Math.floor(Math.random() * 6),
)} ${token.symbol}`,
2020-10-06 20:28:38 +02:00
rightSecondaryLabel: `$${(Math.random() * 1000).toFixed(2)}`,
}));
2020-10-06 20:28:38 +02:00
export const DefaultStory = () => {
2020-10-06 20:28:38 +02:00
return (
<div style={{ height: '82vh', width: '357px' }}>
<DropdownSearchList
startingItem={tokensToSearch[0]}
itemsToSearch={tokensToSearch}
searchPlaceholderText="Search for a token"
2020-11-03 00:41:28 +01:00
fuseSearchKeys={[
{ name: 'name', weight: 0.5 },
{ name: 'symbol', weight: 0.5 },
]}
2020-10-06 20:28:38 +02:00
maxListItems={tokensToSearch.length}
defaultToAll
/>
</div>
);
};
DefaultStory.storyName = 'Default';