@rango-dev/ui 0.1.10-next.102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +181 -0
- package/dist/components/Alert/Alert.d.ts +7 -0
- package/dist/components/Alert/Alert.stories.d.ts +5 -0
- package/dist/components/Alert/LoadingFailedAlert.d.ts +2 -0
- package/dist/components/Alert/NotFoundAlert.d.ts +7 -0
- package/dist/components/Alert/index.d.ts +2 -0
- package/dist/components/BestRoute/BestRoute.d.ts +12 -0
- package/dist/components/BestRoute/BestRoute.stories.d.ts +8 -0
- package/dist/components/BestRoute/index.d.ts +1 -0
- package/dist/components/BestRoute/mock.d.ts +4 -0
- package/dist/components/BlockchainSelector/BlockchainSelector.d.ts +17 -0
- package/dist/components/BlockchainSelector/BlockchainSelector.stories.d.ts +5 -0
- package/dist/components/BlockchainSelector/index.d.ts +1 -0
- package/dist/components/BlockchainsList/BlockchainsList.d.ts +10 -0
- package/dist/components/BlockchainsList/BlockchainsList.stories.d.ts +5 -0
- package/dist/components/BlockchainsList/index.d.ts +1 -0
- package/dist/components/BlockchainsList/mockData.d.ts +2 -0
- package/dist/components/Button/Button.d.ts +17 -0
- package/dist/components/Button/Button.stories.d.ts +8 -0
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +11 -0
- package/dist/components/Checkbox/Checkbox.stories.d.ts +5 -0
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/Chip/Chip.d.ts +12 -0
- package/dist/components/Chip/Chip.stories.d.ts +7 -0
- package/dist/components/Chip/index.d.ts +1 -0
- package/dist/components/ColorPicker/ColorPicker.d.ts +9 -0
- package/dist/components/ColorPicker/ColorPicker.stories.d.ts +5 -0
- package/dist/components/ColorPicker/index.d.ts +1 -0
- package/dist/components/ConnectWalletsModal/ConnectWallets.stories.d.ts +5 -0
- package/dist/components/ConnectWalletsModal/ConnectWalletsModal.d.ts +11 -0
- package/dist/components/ConnectWalletsModal/index.d.ts +1 -0
- package/dist/components/ConnectWalletsModal/mockData.d.ts +2 -0
- package/dist/components/Divider/Divider.d.ts +6 -0
- package/dist/components/Divider/index.d.ts +1 -0
- package/dist/components/Drawer/Drawer.d.ts +13 -0
- package/dist/components/Drawer/Drawer.stories.d.ts +8 -0
- package/dist/components/Drawer/index.d.ts +1 -0
- package/dist/components/Header/Header.d.ts +9 -0
- package/dist/components/Header/index.d.ts +1 -0
- package/dist/components/Icon/AddCircleIcon.d.ts +3 -0
- package/dist/components/Icon/AddIcon.d.ts +3 -0
- package/dist/components/Icon/AddWalletIcon.d.ts +3 -0
- package/dist/components/Icon/AngleDownIcon.d.ts +3 -0
- package/dist/components/Icon/AngleLeftIcon.d.ts +3 -0
- package/dist/components/Icon/AngleRightIcon.d.ts +3 -0
- package/dist/components/Icon/AngleUpIcon.d.ts +3 -0
- package/dist/components/Icon/ArrowRightIcon.d.ts +3 -0
- package/dist/components/Icon/BagIcon.d.ts +3 -0
- package/dist/components/Icon/BanIcon.d.ts +3 -0
- package/dist/components/Icon/CheckCircleIcon.d.ts +3 -0
- package/dist/components/Icon/CheckIcon.d.ts +3 -0
- package/dist/components/Icon/CheckSquareIcon.d.ts +3 -0
- package/dist/components/Icon/CheckWalletIcon.d.ts +3 -0
- package/dist/components/Icon/ChevronRightIcon.d.ts +3 -0
- package/dist/components/Icon/CloseIcon.d.ts +1 -0
- package/dist/components/Icon/CopyIcon.d.ts +3 -0
- package/dist/components/Icon/DeleteCircleIcon.d.ts +3 -0
- package/dist/components/Icon/DeleteWalletIcon.d.ts +3 -0
- package/dist/components/Icon/DisconnectIcon.d.ts +3 -0
- package/dist/components/Icon/DownloadIcon.d.ts +3 -0
- package/dist/components/Icon/GasIcon.d.ts +3 -0
- package/dist/components/Icon/HistoryIcon.d.ts +3 -0
- package/dist/components/Icon/HorizontalSwapIcon.d.ts +3 -0
- package/dist/components/Icon/Icons.stories.d.ts +5 -0
- package/dist/components/Icon/InfoCircleIcon.d.ts +3 -0
- package/dist/components/Icon/MinusCircleIcon.d.ts +3 -0
- package/dist/components/Icon/RetryIcon.d.ts +3 -0
- package/dist/components/Icon/RetryLeftIcon.d.ts +3 -0
- package/dist/components/Icon/RetryRightIcon.d.ts +3 -0
- package/dist/components/Icon/SearchIcon.d.ts +3 -0
- package/dist/components/Icon/SearchMinusIcon.d.ts +3 -0
- package/dist/components/Icon/SettingIcon.d.ts +3 -0
- package/dist/components/Icon/SignatureIcon.d.ts +3 -0
- package/dist/components/Icon/SwapWalletIcon.d.ts +3 -0
- package/dist/components/Icon/TimeIcon.d.ts +3 -0
- package/dist/components/Icon/TrashIcon.d.ts +3 -0
- package/dist/components/Icon/TryAgainIcon.d.ts +3 -0
- package/dist/components/Icon/VerticalSwapIcon.d.ts +3 -0
- package/dist/components/Icon/WalletIconIcon.d.ts +3 -0
- package/dist/components/Icon/WarningIcon.d.ts +3 -0
- package/dist/components/Icon/common.d.ts +2 -0
- package/dist/components/Icon/index.d.ts +40 -0
- package/dist/components/Icon/types.d.ts +6 -0
- package/dist/components/LiquiditySourceList/LiquiditySource.stories.d.ts +5 -0
- package/dist/components/LiquiditySourceList/LiquiditySourceList.d.ts +11 -0
- package/dist/components/LiquiditySourceList/index.d.ts +1 -0
- package/dist/components/LiquiditySourceList/mockData.d.ts +2 -0
- package/dist/components/LiquiditySourcesSelector/LiquiditySourcesSelector.d.ts +13 -0
- package/dist/components/LiquiditySourcesSelector/LiquiditySourcesSelector.stories.d.ts +5 -0
- package/dist/components/LiquiditySourcesSelector/index.d.ts +1 -0
- package/dist/components/Modal/Modal.d.ts +12 -0
- package/dist/components/Modal/Modal.stories.d.ts +5 -0
- package/dist/components/Modal/index.d.ts +1 -0
- package/dist/components/Radio/Radio.d.ts +13 -0
- package/dist/components/Radio/Radio.stories.d.ts +5 -0
- package/dist/components/Radio/index.d.ts +1 -0
- package/dist/components/SecondaryPage/SecondaryPage.d.ts +16 -0
- package/dist/components/SecondaryPage/SecondaryPage.stories.d.ts +2 -0
- package/dist/components/SecondaryPage/index.d.ts +1 -0
- package/dist/components/SelectableWalletList/SelectableWalletList.d.ts +7 -0
- package/dist/components/SelectableWalletList/SelectableWalletList.stories.d.ts +5 -0
- package/dist/components/SelectableWalletList/index.d.ts +1 -0
- package/dist/components/SelectableWalletList/mock.d.ts +2 -0
- package/dist/components/Settings/Settings.d.ts +23 -0
- package/dist/components/Settings/Settings.stories.d.ts +5 -0
- package/dist/components/Settings/index.d.ts +1 -0
- package/dist/components/Skeleton/Skeleton.d.ts +6 -0
- package/dist/components/Skeleton/Skeleton.stories.d.ts +5 -0
- package/dist/components/Skeleton/index.d.ts +1 -0
- package/dist/components/Spacer/Spacer.d.ts +6 -0
- package/dist/components/Spacer/Spacer.stories.d.ts +5 -0
- package/dist/components/Spacer/index.d.ts +1 -0
- package/dist/components/Spinner/Spinner.d.ts +6 -0
- package/dist/components/Spinner/Spinner.stories.d.ts +5 -0
- package/dist/components/Spinner/index.d.ts +1 -0
- package/dist/components/StatusDrawer/StatusDrawer.d.ts +11 -0
- package/dist/components/StatusDrawer/StatusDrawer.stories.d.ts +5 -0
- package/dist/components/StatusDrawer/index.d.ts +1 -0
- package/dist/components/StepDetail/StepDetail.d.ts +10 -0
- package/dist/components/StepDetail/StepDetail.stories.d.ts +5 -0
- package/dist/components/StepDetail/index.d.ts +1 -0
- package/dist/components/SwapContainer/SwapContainer.d.ts +7 -0
- package/dist/components/SwapContainer/SwapContainer.stories.d.ts +5 -0
- package/dist/components/SwapContainer/index.d.ts +1 -0
- package/dist/components/SwapDetail/SwapDetail.d.ts +8 -0
- package/dist/components/SwapDetail/SwapDetail.stories.d.ts +5 -0
- package/dist/components/SwapDetail/Token.d.ts +16 -0
- package/dist/components/SwapDetail/index.d.ts +1 -0
- package/dist/components/SwapDetail/mock.d.ts +2 -0
- package/dist/components/Switch/Switch.d.ts +6 -0
- package/dist/components/Switch/Switch.stories.d.ts +5 -0
- package/dist/components/Switch/index.d.ts +1 -0
- package/dist/components/TextField/TextField.d.ts +10 -0
- package/dist/components/TextField/TextField.stories.d.ts +7 -0
- package/dist/components/TextField/index.d.ts +1 -0
- package/dist/components/TokenList/TokenItem.d.ts +11 -0
- package/dist/components/TokenList/TokenList.d.ts +17 -0
- package/dist/components/TokenList/TokenList.stories.d.ts +5 -0
- package/dist/components/TokenList/index.d.ts +1 -0
- package/dist/components/TokenList/mockData.d.ts +2 -0
- package/dist/components/TokenSelector/TokenSelector.d.ts +16 -0
- package/dist/components/TokenSelector/TokenSelector.stories.d.ts +5 -0
- package/dist/components/TokenSelector/index.d.ts +1 -0
- package/dist/components/Tooltip/Tooltip.d.ts +7 -0
- package/dist/components/Tooltip/Tooltip.stories.d.ts +5 -0
- package/dist/components/Tooltip/index.d.ts +1 -0
- package/dist/components/Typography/Typography.d.ts +18 -0
- package/dist/components/Typography/Typography.stories.d.ts +5 -0
- package/dist/components/Typography/index.d.ts +1 -0
- package/dist/components/VirtualizedList/VirtualizedList.d.ts +17 -0
- package/dist/components/Wallet/State.d.ts +7 -0
- package/dist/components/Wallet/Wallet.d.ts +7 -0
- package/dist/components/Wallet/Wallet.stories.d.ts +5 -0
- package/dist/components/Wallet/index.d.ts +1 -0
- package/dist/components/common/FilledCircle.d.ts +1 -0
- package/dist/components/common/index.d.ts +1 -0
- package/dist/components/index.d.ts +31 -0
- package/dist/containers/ConfirmSwap/ConfirmSwap.d.ts +20 -0
- package/dist/containers/ConfirmSwap/ConfirmSwap.stories.d.ts +6 -0
- package/dist/containers/ConfirmSwap/index.d.ts +1 -0
- package/dist/containers/ConfirmSwap/mock.d.ts +5 -0
- package/dist/containers/History/History.d.ts +13 -0
- package/dist/containers/History/History.stories.d.ts +5 -0
- package/dist/containers/History/index.d.ts +1 -0
- package/dist/containers/History/mock.d.ts +2 -0
- package/dist/containers/History/types.d.ts +39 -0
- package/dist/containers/SwapHistory/SwapHistory.d.ts +24 -0
- package/dist/containers/SwapHistory/SwapHistory.stories.d.ts +5 -0
- package/dist/containers/SwapHistory/SwapMessages.d.ts +17 -0
- package/dist/containers/SwapHistory/index.d.ts +1 -0
- package/dist/containers/SwapHistory/mock.d.ts +2 -0
- package/dist/containers/index.d.ts +3 -0
- package/dist/helper/index.d.ts +2 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +8 -0
- package/dist/theme.d.ts +8 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/meta.d.ts +23 -0
- package/dist/types/swaps.d.ts +29 -0
- package/dist/types/wallet.d.ts +23 -0
- package/dist/ui.cjs.development.js +4956 -0
- package/dist/ui.cjs.development.js.map +1 -0
- package/dist/ui.cjs.production.min.js +2 -0
- package/dist/ui.cjs.production.min.js.map +1 -0
- package/dist/ui.esm.js +4870 -0
- package/dist/ui.esm.js.map +1 -0
- package/package.json +88 -0
- package/src/components/Alert/Alert.stories.tsx +22 -0
- package/src/components/Alert/Alert.tsx +102 -0
- package/src/components/Alert/LoadingFailedAlert.tsx +11 -0
- package/src/components/Alert/NotFoundAlert.tsx +19 -0
- package/src/components/Alert/index.ts +2 -0
- package/src/components/BestRoute/BestRoute.stories.tsx +31 -0
- package/src/components/BestRoute/BestRoute.tsx +232 -0
- package/src/components/BestRoute/index.ts +1 -0
- package/src/components/BestRoute/mock.ts +554 -0
- package/src/components/BlockchainSelector/BlockchainSelector.stories.tsx +25 -0
- package/src/components/BlockchainSelector/BlockchainSelector.tsx +93 -0
- package/src/components/BlockchainSelector/index.ts +1 -0
- package/src/components/BlockchainsList/BlockchainsList.stories.tsx +25 -0
- package/src/components/BlockchainsList/BlockchainsList.tsx +70 -0
- package/src/components/BlockchainsList/index.ts +1 -0
- package/src/components/BlockchainsList/mockData.ts +2972 -0
- package/src/components/Button/Button.stories.tsx +59 -0
- package/src/components/Button/Button.tsx +421 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +22 -0
- package/src/components/Checkbox/Checkbox.tsx +56 -0
- package/src/components/Checkbox/index.ts +1 -0
- package/src/components/Chip/Chip.stories.tsx +37 -0
- package/src/components/Chip/Chip.tsx +48 -0
- package/src/components/Chip/index.ts +1 -0
- package/src/components/ColorPicker/ColorPicker.stories.tsx +36 -0
- package/src/components/ColorPicker/ColorPicker.tsx +85 -0
- package/src/components/ColorPicker/index.ts +1 -0
- package/src/components/ConnectWalletsModal/ConnectWallets.stories.tsx +13 -0
- package/src/components/ConnectWalletsModal/ConnectWalletsModal.tsx +42 -0
- package/src/components/ConnectWalletsModal/index.ts +1 -0
- package/src/components/ConnectWalletsModal/mockData.ts +134 -0
- package/src/components/Divider/Divider.tsx +41 -0
- package/src/components/Divider/index.ts +1 -0
- package/src/components/Drawer/Drawer.stories.tsx +86 -0
- package/src/components/Drawer/Drawer.tsx +124 -0
- package/src/components/Drawer/index.ts +1 -0
- package/src/components/Header/Header.tsx +39 -0
- package/src/components/Header/index.ts +1 -0
- package/src/components/Icon/AddCircleIcon.tsx +31 -0
- package/src/components/Icon/AddIcon.tsx +31 -0
- package/src/components/Icon/AddWalletIcon.tsx +50 -0
- package/src/components/Icon/AngleDownIcon.tsx +30 -0
- package/src/components/Icon/AngleLeftIcon.tsx +33 -0
- package/src/components/Icon/AngleRightIcon.tsx +32 -0
- package/src/components/Icon/AngleUpIcon.tsx +32 -0
- package/src/components/Icon/ArrowRightIcon.tsx +31 -0
- package/src/components/Icon/BagIcon.tsx +39 -0
- package/src/components/Icon/BanIcon.tsx +32 -0
- package/src/components/Icon/CheckCircleIcon.tsx +39 -0
- package/src/components/Icon/CheckIcon.tsx +30 -0
- package/src/components/Icon/CheckSquareIcon.tsx +37 -0
- package/src/components/Icon/CheckWalletIcon.tsx +45 -0
- package/src/components/Icon/ChevronRightIcon.tsx +29 -0
- package/src/components/Icon/CloseIcon.tsx +9 -0
- package/src/components/Icon/CopyIcon.tsx +59 -0
- package/src/components/Icon/DeleteCircleIcon.tsx +31 -0
- package/src/components/Icon/DeleteWalletIcon.tsx +50 -0
- package/src/components/Icon/DisconnectIcon.tsx +31 -0
- package/src/components/Icon/DownloadIcon.tsx +37 -0
- package/src/components/Icon/GasIcon.tsx +37 -0
- package/src/components/Icon/HistoryIcon.tsx +34 -0
- package/src/components/Icon/HorizontalSwapIcon.tsx +38 -0
- package/src/components/Icon/Icons.stories.tsx +44 -0
- package/src/components/Icon/InfoCircleIcon.tsx +39 -0
- package/src/components/Icon/MinusCircleIcon.tsx +31 -0
- package/src/components/Icon/RetryIcon.tsx +30 -0
- package/src/components/Icon/RetryLeftIcon.tsx +31 -0
- package/src/components/Icon/RetryRightIcon.tsx +31 -0
- package/src/components/Icon/SearchIcon.tsx +31 -0
- package/src/components/Icon/SearchMinusIcon.tsx +31 -0
- package/src/components/Icon/SettingIcon.tsx +31 -0
- package/src/components/Icon/SignatureIcon.tsx +32 -0
- package/src/components/Icon/SwapWalletIcon.tsx +50 -0
- package/src/components/Icon/TimeIcon.tsx +29 -0
- package/src/components/Icon/TrashIcon.tsx +31 -0
- package/src/components/Icon/TryAgainIcon.tsx +31 -0
- package/src/components/Icon/VerticalSwapIcon.tsx +38 -0
- package/src/components/Icon/WalletIconIcon.tsx +40 -0
- package/src/components/Icon/WarningIcon.tsx +37 -0
- package/src/components/Icon/common.ts +69 -0
- package/src/components/Icon/index.ts +48 -0
- package/src/components/Icon/types.tsx +45 -0
- package/src/components/LiquiditySourceList/LiquiditySource.stories.tsx +13 -0
- package/src/components/LiquiditySourceList/LiquiditySourceList.tsx +195 -0
- package/src/components/LiquiditySourceList/index.ts +1 -0
- package/src/components/LiquiditySourceList/mockData.ts +316 -0
- package/src/components/LiquiditySourcesSelector/LiquiditySourcesSelector.stories.tsx +16 -0
- package/src/components/LiquiditySourcesSelector/LiquiditySourcesSelector.tsx +61 -0
- package/src/components/LiquiditySourcesSelector/index.ts +1 -0
- package/src/components/Modal/Modal.stories.tsx +22 -0
- package/src/components/Modal/Modal.tsx +93 -0
- package/src/components/Modal/index.ts +1 -0
- package/src/components/Radio/Radio.stories.tsx +23 -0
- package/src/components/Radio/Radio.tsx +100 -0
- package/src/components/Radio/index.ts +1 -0
- package/src/components/SecondaryPage/SecondaryPage.stories.tsx +7 -0
- package/src/components/SecondaryPage/SecondaryPage.tsx +68 -0
- package/src/components/SecondaryPage/index.ts +1 -0
- package/src/components/SelectableWalletList/SelectableWalletList.stories.tsx +14 -0
- package/src/components/SelectableWalletList/SelectableWalletList.tsx +118 -0
- package/src/components/SelectableWalletList/index.ts +1 -0
- package/src/components/SelectableWalletList/mock.ts +13 -0
- package/src/components/Settings/Settings.stories.tsx +34 -0
- package/src/components/Settings/Settings.tsx +208 -0
- package/src/components/Settings/index.ts +1 -0
- package/src/components/Skeleton/Skeleton.stories.tsx +24 -0
- package/src/components/Skeleton/Skeleton.tsx +66 -0
- package/src/components/Skeleton/index.ts +1 -0
- package/src/components/Spacer/Spacer.stories.tsx +31 -0
- package/src/components/Spacer/Spacer.tsx +128 -0
- package/src/components/Spacer/index.ts +1 -0
- package/src/components/Spinner/Spinner.stories.tsx +25 -0
- package/src/components/Spinner/Spinner.tsx +61 -0
- package/src/components/Spinner/index.ts +1 -0
- package/src/components/StatusDrawer/StatusDrawer.stories.tsx +38 -0
- package/src/components/StatusDrawer/StatusDrawer.tsx +82 -0
- package/src/components/StatusDrawer/index.ts +1 -0
- package/src/components/StepDetail/StepDetail.stories.tsx +37 -0
- package/src/components/StepDetail/StepDetail.tsx +109 -0
- package/src/components/StepDetail/index.ts +1 -0
- package/src/components/SwapContainer/SwapContainer.stories.tsx +13 -0
- package/src/components/SwapContainer/SwapContainer.tsx +43 -0
- package/src/components/SwapContainer/index.ts +1 -0
- package/src/components/SwapDetail/SwapDetail.stories.tsx +19 -0
- package/src/components/SwapDetail/SwapDetail.tsx +112 -0
- package/src/components/SwapDetail/Token.tsx +68 -0
- package/src/components/SwapDetail/index.ts +1 -0
- package/src/components/SwapDetail/mock.ts +276 -0
- package/src/components/Switch/Switch.stories.tsx +9 -0
- package/src/components/Switch/Switch.tsx +55 -0
- package/src/components/Switch/index.ts +1 -0
- package/src/components/TextField/TextField.stories.tsx +31 -0
- package/src/components/TextField/TextField.tsx +141 -0
- package/src/components/TextField/index.ts +1 -0
- package/src/components/TokenList/TokenItem.tsx +73 -0
- package/src/components/TokenList/TokenList.stories.tsx +18 -0
- package/src/components/TokenList/TokenList.tsx +95 -0
- package/src/components/TokenList/index.ts +1 -0
- package/src/components/TokenList/mockData.ts +1721 -0
- package/src/components/TokenSelector/TokenSelector.stories.tsx +18 -0
- package/src/components/TokenSelector/TokenSelector.tsx +95 -0
- package/src/components/TokenSelector/index.ts +1 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +52 -0
- package/src/components/Tooltip/Tooltip.tsx +116 -0
- package/src/components/Tooltip/index.ts +1 -0
- package/src/components/Typography/Typography.stories.tsx +72 -0
- package/src/components/Typography/Typography.tsx +216 -0
- package/src/components/Typography/index.ts +1 -0
- package/src/components/VirtualizedList/VirtualizedList.tsx +62 -0
- package/src/components/Wallet/State.tsx +34 -0
- package/src/components/Wallet/Wallet.stories.tsx +36 -0
- package/src/components/Wallet/Wallet.tsx +69 -0
- package/src/components/Wallet/index.ts +1 -0
- package/src/components/common/FilledCircle.tsx +8 -0
- package/src/components/common/index.ts +1 -0
- package/src/components/index.ts +31 -0
- package/src/containers/ConfirmSwap/ConfirmSwap.stories.tsx +22 -0
- package/src/containers/ConfirmSwap/ConfirmSwap.tsx +180 -0
- package/src/containers/ConfirmSwap/index.ts +1 -0
- package/src/containers/ConfirmSwap/mock.ts +223 -0
- package/src/containers/History/History.stories.tsx +14 -0
- package/src/containers/History/History.tsx +115 -0
- package/src/containers/History/index.ts +1 -0
- package/src/containers/History/mock.ts +826 -0
- package/src/containers/History/types.tsx +47 -0
- package/src/containers/SwapHistory/SwapHistory.stories.tsx +13 -0
- package/src/containers/SwapHistory/SwapHistory.tsx +442 -0
- package/src/containers/SwapHistory/SwapMessages.tsx +116 -0
- package/src/containers/SwapHistory/index.ts +1 -0
- package/src/containers/SwapHistory/mock.ts +276 -0
- package/src/containers/index.ts +3 -0
- package/src/helper/index.ts +16 -0
- package/src/index.ts +4 -0
- package/src/theme.ts +163 -0
- package/src/types/index.ts +3 -0
- package/src/types/meta.ts +22 -0
- package/src/types/swaps.ts +44 -0
- package/src/types/wallet.ts +30 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { styled } from '../../theme';
|
|
3
|
+
|
|
4
|
+
const SpacerContainer = styled('div', {
|
|
5
|
+
variants: {
|
|
6
|
+
size: {
|
|
7
|
+
4: {},
|
|
8
|
+
8: {},
|
|
9
|
+
12: {},
|
|
10
|
+
16: {},
|
|
11
|
+
18: {},
|
|
12
|
+
20: {},
|
|
13
|
+
24: {},
|
|
14
|
+
},
|
|
15
|
+
direction: {
|
|
16
|
+
vertical: {},
|
|
17
|
+
horizontal: {},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
compoundVariants: [
|
|
21
|
+
{
|
|
22
|
+
size: 4,
|
|
23
|
+
direction: 'horizontal',
|
|
24
|
+
css: {
|
|
25
|
+
width: '$4',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
size: 4,
|
|
30
|
+
direction: 'vertical',
|
|
31
|
+
css: {
|
|
32
|
+
height: '$4',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
size: 8,
|
|
37
|
+
direction: 'horizontal',
|
|
38
|
+
css: {
|
|
39
|
+
width: '$8',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
size: 8,
|
|
44
|
+
direction: 'vertical',
|
|
45
|
+
css: {
|
|
46
|
+
height: '$8',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
size: 12,
|
|
51
|
+
direction: 'horizontal',
|
|
52
|
+
css: {
|
|
53
|
+
width: '$12',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
size: 12,
|
|
58
|
+
direction: 'vertical',
|
|
59
|
+
css: {
|
|
60
|
+
height: '$12',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
size: 16,
|
|
65
|
+
direction: 'horizontal',
|
|
66
|
+
css: {
|
|
67
|
+
width: '$16',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
size: 16,
|
|
72
|
+
direction: 'vertical',
|
|
73
|
+
css: {
|
|
74
|
+
height: '$16',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
size: 18,
|
|
79
|
+
direction: 'horizontal',
|
|
80
|
+
css: {
|
|
81
|
+
width: '$18',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
size: 18,
|
|
86
|
+
direction: 'vertical',
|
|
87
|
+
css: {
|
|
88
|
+
height: '$18',
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
size: 20,
|
|
93
|
+
direction: 'horizontal',
|
|
94
|
+
css: {
|
|
95
|
+
width: '$20',
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
size: 20,
|
|
100
|
+
direction: 'vertical',
|
|
101
|
+
css: {
|
|
102
|
+
height: '$20',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
size: 24,
|
|
107
|
+
direction: 'horizontal',
|
|
108
|
+
css: {
|
|
109
|
+
width: '$24',
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
size: 24,
|
|
114
|
+
direction: 'vertical',
|
|
115
|
+
css: {
|
|
116
|
+
height: '$24',
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
});
|
|
121
|
+
export interface PropTypes {
|
|
122
|
+
size?: 4 | 8 | 12 | 16 | 18 | 20 | 24;
|
|
123
|
+
direction?: 'vertical' | 'horizontal';
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function Spacer({ size = 12, direction = 'horizontal' }: PropTypes) {
|
|
127
|
+
return <SpacerContainer size={size} direction={direction} />;
|
|
128
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Spacer } from './Spacer';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ComponentMeta } from '@storybook/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Spinner, PropTypes } from './Spinner';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/Spinner',
|
|
7
|
+
component: Spinner,
|
|
8
|
+
argTypes: {
|
|
9
|
+
color: {
|
|
10
|
+
name: 'color',
|
|
11
|
+
control: { type: 'select' },
|
|
12
|
+
options: ['primary', 'error', 'warning', 'success', 'black', 'white'],
|
|
13
|
+
defaultValue: 'primary',
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
size: {
|
|
17
|
+
name: 'size',
|
|
18
|
+
control: { type: 'radio' },
|
|
19
|
+
options: [16, 20, 24],
|
|
20
|
+
defaultValue: 16,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
} as ComponentMeta<typeof Spinner>;
|
|
24
|
+
|
|
25
|
+
export const Main = (props: PropTypes) => <Spinner {...props} />;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { keyframes, styled } from '../../theme';
|
|
3
|
+
|
|
4
|
+
const spin = keyframes({
|
|
5
|
+
'100%': {
|
|
6
|
+
transform: 'rotate(360deg)',
|
|
7
|
+
},
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const SpinnerContainer = styled('div', {
|
|
11
|
+
borderRadius: '50%',
|
|
12
|
+
position: 'relative',
|
|
13
|
+
border: `2px solid $neutrals300`,
|
|
14
|
+
borderRight: `2px solid`,
|
|
15
|
+
animation: `${spin} 1.5s linear infinite`,
|
|
16
|
+
margin: `0px $8`,
|
|
17
|
+
variants: {
|
|
18
|
+
color: {
|
|
19
|
+
primary: {
|
|
20
|
+
borderRightColor: '$primary',
|
|
21
|
+
},
|
|
22
|
+
error: {
|
|
23
|
+
borderRightColor: '$error',
|
|
24
|
+
},
|
|
25
|
+
warning: {
|
|
26
|
+
borderRightColor: '$warning',
|
|
27
|
+
},
|
|
28
|
+
success: {
|
|
29
|
+
borderRightColor: '$success',
|
|
30
|
+
},
|
|
31
|
+
black: {
|
|
32
|
+
borderRightColor: '$black',
|
|
33
|
+
},
|
|
34
|
+
white: {
|
|
35
|
+
borderRightColor: '$white',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
size: {
|
|
39
|
+
16: {
|
|
40
|
+
width: '$16',
|
|
41
|
+
height: '$16',
|
|
42
|
+
},
|
|
43
|
+
20: {
|
|
44
|
+
width: '$20',
|
|
45
|
+
height: '$20',
|
|
46
|
+
},
|
|
47
|
+
24: {
|
|
48
|
+
width: '$24',
|
|
49
|
+
height: '$24',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
export interface PropTypes {
|
|
55
|
+
size?: 16 | 20 | 24;
|
|
56
|
+
color?: 'primary' | 'error' | 'warning' | 'success' | 'black' | 'white';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function Spinner({ size = 16, color = 'primary' }: PropTypes) {
|
|
60
|
+
return <SpinnerContainer size={size} color={color} />;
|
|
61
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Spinner } from './Spinner';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { ComponentMeta } from '@storybook/react';
|
|
3
|
+
import { StatusDrawer, PropTypes } from './StatusDrawer';
|
|
4
|
+
import { SwapContainer } from '../SwapContainer';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
name: 'Components/StatusDrawer',
|
|
8
|
+
component: StatusDrawer,
|
|
9
|
+
argTypes: {
|
|
10
|
+
status: {
|
|
11
|
+
name: 'status',
|
|
12
|
+
control: { type: 'select' },
|
|
13
|
+
options: ['continue', 'success', 'failed'],
|
|
14
|
+
defaultValue: 'success',
|
|
15
|
+
},
|
|
16
|
+
title: {
|
|
17
|
+
name: 'title',
|
|
18
|
+
control: { type: 'text' },
|
|
19
|
+
defaultValue: 'Swap successful',
|
|
20
|
+
},
|
|
21
|
+
subtitle: {
|
|
22
|
+
name: 'subtitle',
|
|
23
|
+
control: { type: 'text' },
|
|
24
|
+
defaultValue:
|
|
25
|
+
'There are now 0.0493 BNB in 0x542...C2Df wallet on BSC chain.',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
} as ComponentMeta<typeof StatusDrawer>;
|
|
29
|
+
|
|
30
|
+
export const Main = (args: PropTypes) => {
|
|
31
|
+
const [open, setOpen] = useState<boolean>(false);
|
|
32
|
+
return (
|
|
33
|
+
<SwapContainer>
|
|
34
|
+
<button onClick={() => setOpen(true)}>Open Drawer</button>
|
|
35
|
+
<StatusDrawer {...args} open={open} onClose={() => setOpen(false)} />
|
|
36
|
+
</SwapContainer>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { styled } from '../../theme';
|
|
3
|
+
import { Button } from '../Button';
|
|
4
|
+
import { Drawer } from '../Drawer';
|
|
5
|
+
import { CheckCircleIcon, InfoCircleIcon, WarningIcon } from '../Icon';
|
|
6
|
+
import { Spacer } from '../Spacer';
|
|
7
|
+
import { Typography } from '../Typography';
|
|
8
|
+
|
|
9
|
+
export interface PropTypes {
|
|
10
|
+
open: boolean;
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
status: 'continue' | 'success' | 'failed';
|
|
13
|
+
title: string;
|
|
14
|
+
subtitle: string;
|
|
15
|
+
onSubmit?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
16
|
+
onCancel?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
17
|
+
}
|
|
18
|
+
const Header = styled('div', {
|
|
19
|
+
textAlign: 'center',
|
|
20
|
+
display: 'flex',
|
|
21
|
+
justifyContent: 'center',
|
|
22
|
+
alignItems: 'center',
|
|
23
|
+
marginBottom: '$16',
|
|
24
|
+
});
|
|
25
|
+
const Footer = styled('div', {
|
|
26
|
+
padding: '$20',
|
|
27
|
+
display: 'flex',
|
|
28
|
+
alignItems: 'center',
|
|
29
|
+
});
|
|
30
|
+
export function StatusDrawer({
|
|
31
|
+
status = 'success',
|
|
32
|
+
title,
|
|
33
|
+
subtitle,
|
|
34
|
+
onSubmit,
|
|
35
|
+
onCancel,
|
|
36
|
+
...props
|
|
37
|
+
}: PropTypes) {
|
|
38
|
+
return (
|
|
39
|
+
<Drawer
|
|
40
|
+
container={document.body}
|
|
41
|
+
content={
|
|
42
|
+
<>
|
|
43
|
+
<Header>
|
|
44
|
+
{status === 'success' ? (
|
|
45
|
+
<CheckCircleIcon color="success" size={24} />
|
|
46
|
+
) : status === 'failed' ? (
|
|
47
|
+
<InfoCircleIcon color="error" size={24} />
|
|
48
|
+
) : (
|
|
49
|
+
<WarningIcon color="warning" size={24} />
|
|
50
|
+
)}
|
|
51
|
+
<Typography variant="h6">{title}</Typography>
|
|
52
|
+
</Header>
|
|
53
|
+
<Typography variant="body2">{subtitle}</Typography>
|
|
54
|
+
</>
|
|
55
|
+
}
|
|
56
|
+
footer={
|
|
57
|
+
<Footer>
|
|
58
|
+
{status !== 'failed' && (
|
|
59
|
+
<Button fullWidth onClick={onCancel}>
|
|
60
|
+
{status === 'success' ? 'Cancel' : 'See detailes'}
|
|
61
|
+
</Button>
|
|
62
|
+
)}
|
|
63
|
+
<Spacer size={16} />
|
|
64
|
+
<Button
|
|
65
|
+
fullWidth
|
|
66
|
+
onClick={onSubmit}
|
|
67
|
+
variant="contained"
|
|
68
|
+
type="primary"
|
|
69
|
+
>
|
|
70
|
+
{status === 'success'
|
|
71
|
+
? 'Done'
|
|
72
|
+
: status === 'continue'
|
|
73
|
+
? 'Continue'
|
|
74
|
+
: 'See detailes'}
|
|
75
|
+
</Button>
|
|
76
|
+
</Footer>
|
|
77
|
+
}
|
|
78
|
+
anchor="bottom"
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { StatusDrawer } from './StatusDrawer';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentMeta } from '@storybook/react';
|
|
3
|
+
import { StepDetail, PropTypes } from './StepDetail';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/StepDetail',
|
|
7
|
+
component: StepDetail,
|
|
8
|
+
argTypes: {
|
|
9
|
+
logo: {
|
|
10
|
+
name: 'logo',
|
|
11
|
+
control: { type: 'text' },
|
|
12
|
+
defaultValue: 'https://api.rango.exchange/tokens/COSMOS/JUNO.png',
|
|
13
|
+
},
|
|
14
|
+
chainLogo: {
|
|
15
|
+
name: 'chainLogo',
|
|
16
|
+
control: { type: 'text' },
|
|
17
|
+
defaultValue: 'https://api.rango.exchange/swappers/osmosis.png',
|
|
18
|
+
},
|
|
19
|
+
amount: {
|
|
20
|
+
name: 'amount',
|
|
21
|
+
control: { type: 'text' },
|
|
22
|
+
defaultValue: '1',
|
|
23
|
+
},
|
|
24
|
+
symbol: {
|
|
25
|
+
name: 'symbol',
|
|
26
|
+
control: { type: 'text' },
|
|
27
|
+
defaultValue: 'JUNO',
|
|
28
|
+
},
|
|
29
|
+
blockchain: {
|
|
30
|
+
name: 'chainAlt',
|
|
31
|
+
control: { type: 'text' },
|
|
32
|
+
defaultValue: 'OSMOSIS',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
} as ComponentMeta<typeof StepDetail>;
|
|
36
|
+
|
|
37
|
+
export const Main = (props: PropTypes) => <StepDetail {...props} />;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
import { styled } from '../../theme';
|
|
3
|
+
import { Typography } from '../Typography';
|
|
4
|
+
|
|
5
|
+
const StepLogoContainer = styled('div', {
|
|
6
|
+
position: 'relative',
|
|
7
|
+
width: '$28',
|
|
8
|
+
height: '$28',
|
|
9
|
+
variants: {
|
|
10
|
+
direction: {
|
|
11
|
+
vertical: {
|
|
12
|
+
margin: 'auto',
|
|
13
|
+
},
|
|
14
|
+
horizontal: {},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
const Logo = styled('img', {
|
|
19
|
+
width: '$28',
|
|
20
|
+
height: '$28',
|
|
21
|
+
borderRadius: '50%',
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const ChainLogo = styled('div', {
|
|
25
|
+
position: 'absolute',
|
|
26
|
+
right: -4,
|
|
27
|
+
bottom: -4,
|
|
28
|
+
width: '$16',
|
|
29
|
+
height: '$16',
|
|
30
|
+
padding: '$2',
|
|
31
|
+
borderRadius: '50%',
|
|
32
|
+
backgroundColor: '$background',
|
|
33
|
+
border: '1px solid $neutrals400',
|
|
34
|
+
|
|
35
|
+
img: {
|
|
36
|
+
width: '100%',
|
|
37
|
+
display: 'block',
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
const StepContainer = styled('div', {
|
|
41
|
+
display: 'flex',
|
|
42
|
+
variants: {
|
|
43
|
+
direction: {
|
|
44
|
+
horizontal: {
|
|
45
|
+
alignItems: 'center',
|
|
46
|
+
},
|
|
47
|
+
vertical: {
|
|
48
|
+
flexDirection: 'column',
|
|
49
|
+
textAlign: 'center',
|
|
50
|
+
justifyContent: 'center',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
const Detail = styled('div', {
|
|
56
|
+
variants: {
|
|
57
|
+
pl: {
|
|
58
|
+
true: {
|
|
59
|
+
paddingLeft: '$4',
|
|
60
|
+
'@lg': {
|
|
61
|
+
paddingLeft: '$8',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
false: {
|
|
65
|
+
paddingTop: '$8',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
const SubTitle = styled(Typography, {
|
|
71
|
+
color: '$neutrals600',
|
|
72
|
+
display: 'block',
|
|
73
|
+
});
|
|
74
|
+
export interface PropTypes {
|
|
75
|
+
logo: string;
|
|
76
|
+
chainLogo: string;
|
|
77
|
+
amount: string;
|
|
78
|
+
symbol: string;
|
|
79
|
+
blockchain: string;
|
|
80
|
+
direction?: 'horizontal' | 'vertical';
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function StepDetail({
|
|
84
|
+
logo,
|
|
85
|
+
chainLogo,
|
|
86
|
+
amount,
|
|
87
|
+
symbol,
|
|
88
|
+
blockchain,
|
|
89
|
+
direction = 'horizontal',
|
|
90
|
+
}: PropsWithChildren<PropTypes>) {
|
|
91
|
+
return (
|
|
92
|
+
<StepContainer direction={direction}>
|
|
93
|
+
<StepLogoContainer direction={direction}>
|
|
94
|
+
<Logo src={logo} alt={symbol} />
|
|
95
|
+
<ChainLogo>
|
|
96
|
+
<img src={chainLogo} alt={blockchain} />
|
|
97
|
+
</ChainLogo>
|
|
98
|
+
</StepLogoContainer>
|
|
99
|
+
<Detail pl={direction === 'horizontal'}>
|
|
100
|
+
<Typography noWrap variant={direction === 'vertical' ? 'body2' : 'h6'}>
|
|
101
|
+
{amount ? parseFloat(amount).toFixed(2) : '?'} {symbol}
|
|
102
|
+
</Typography>
|
|
103
|
+
<SubTitle noWrap variant="caption" color="neutrals800">
|
|
104
|
+
on {blockchain}
|
|
105
|
+
</SubTitle>
|
|
106
|
+
</Detail>
|
|
107
|
+
</StepContainer>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { StepDetail } from './StepDetail';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentMeta } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { SwapContainer, PropTypes } from './SwapContainer';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Components/Swap Box',
|
|
8
|
+
component: SwapContainer,
|
|
9
|
+
} as ComponentMeta<typeof SwapContainer>;
|
|
10
|
+
|
|
11
|
+
export const Main = (args: PropTypes) => (
|
|
12
|
+
<SwapContainer {...args}></SwapContainer>
|
|
13
|
+
);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { CSSProperties } from '@stitches/react';
|
|
2
|
+
import React, { PropsWithChildren } from 'react';
|
|
3
|
+
import { styled } from '../../theme';
|
|
4
|
+
|
|
5
|
+
const MainContainer = styled('div', {
|
|
6
|
+
position: 'relative',
|
|
7
|
+
display: 'flex',
|
|
8
|
+
flexDirection: 'column',
|
|
9
|
+
borderRadius: '$10',
|
|
10
|
+
boxShadow: '$s',
|
|
11
|
+
width: '100%',
|
|
12
|
+
minWidth: '375px',
|
|
13
|
+
maxWidth: '512px',
|
|
14
|
+
maxHeight: '595px',
|
|
15
|
+
padding: '$16',
|
|
16
|
+
boxSizing: 'border-box',
|
|
17
|
+
backgroundColor: '$background',
|
|
18
|
+
variants: {
|
|
19
|
+
fixedHeight: {
|
|
20
|
+
true: {
|
|
21
|
+
height: '595px',
|
|
22
|
+
},
|
|
23
|
+
false: {
|
|
24
|
+
height: 'auto',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export interface PropTypes {
|
|
31
|
+
style?: CSSProperties;
|
|
32
|
+
fixedHeight?: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function SwapContainer(props: PropsWithChildren<PropTypes>) {
|
|
36
|
+
const { children, style, fixedHeight = true } = props;
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<MainContainer style={style} id="swap-box" fixedHeight={fixedHeight}>
|
|
40
|
+
{children}
|
|
41
|
+
</MainContainer>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SwapContainer } from './SwapContainer';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentMeta } from '@storybook/react';
|
|
3
|
+
import { SwapDetail, PropTypes } from './SwapDetail';
|
|
4
|
+
import { swap } from './mock';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Components/Swap Detail',
|
|
8
|
+
component: SwapDetail,
|
|
9
|
+
argTypes: {
|
|
10
|
+
status: {
|
|
11
|
+
name: 'status',
|
|
12
|
+
control: { type: 'select' },
|
|
13
|
+
options: ['running', 'failed', 'success'],
|
|
14
|
+
defaultValue: 'running',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
} as ComponentMeta<typeof SwapDetail>;
|
|
18
|
+
|
|
19
|
+
export const Main = (props: PropTypes) => <SwapDetail {...props} swap={swap} />;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
import { PendingSwap } from '../../containers/History/types';
|
|
3
|
+
import { styled } from '../../theme';
|
|
4
|
+
import { Button } from '../Button';
|
|
5
|
+
import { ArrowRightIcon } from '../Icon';
|
|
6
|
+
import { Spacer } from '../Spacer';
|
|
7
|
+
import { Spinner } from '../Spinner';
|
|
8
|
+
import { Token } from './Token';
|
|
9
|
+
|
|
10
|
+
const Container = styled('div', {
|
|
11
|
+
position: 'relative',
|
|
12
|
+
display: 'flex',
|
|
13
|
+
justifyContent: 'space-between',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
padding: '$16 0',
|
|
16
|
+
borderBottom: '1px solid $neutrals300',
|
|
17
|
+
|
|
18
|
+
'& > .info': {
|
|
19
|
+
display: 'flex',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
'.status': {
|
|
24
|
+
textTransform: 'uppercase',
|
|
25
|
+
fontWeight: 'bold',
|
|
26
|
+
fontSize: '$12',
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
'&.running': {
|
|
30
|
+
color: '$foreground',
|
|
31
|
+
},
|
|
32
|
+
'&.failed,&.success': {
|
|
33
|
+
color: '$neutrals600',
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
'&.failed .status': {
|
|
37
|
+
color: '$error',
|
|
38
|
+
},
|
|
39
|
+
'&.success .status': {
|
|
40
|
+
color: '$success',
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export interface PropTypes {
|
|
45
|
+
swap: PendingSwap;
|
|
46
|
+
status: 'running' | 'failed' | 'success';
|
|
47
|
+
onClick: (requestId: string) => void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function SwapDetail({
|
|
51
|
+
swap,
|
|
52
|
+
status,
|
|
53
|
+
onClick,
|
|
54
|
+
}: PropsWithChildren<PropTypes>) {
|
|
55
|
+
const firstStep = swap.steps[0];
|
|
56
|
+
const lastStep = swap.steps[swap.steps.length - 1];
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<Button
|
|
60
|
+
variant="ghost"
|
|
61
|
+
size="free"
|
|
62
|
+
fullWidth
|
|
63
|
+
onClick={onClick.bind(null, swap.requestId)}
|
|
64
|
+
>
|
|
65
|
+
<Container className={`${status}`}>
|
|
66
|
+
<div className="info">
|
|
67
|
+
<Token
|
|
68
|
+
data={{
|
|
69
|
+
token: {
|
|
70
|
+
logo: firstStep.fromLogo,
|
|
71
|
+
symbol: firstStep.fromSymbol,
|
|
72
|
+
},
|
|
73
|
+
blockchain: {
|
|
74
|
+
// @ts-ignore
|
|
75
|
+
logo: firstStep.fromBlockchainLogo,
|
|
76
|
+
name: firstStep.fromBlockchain,
|
|
77
|
+
},
|
|
78
|
+
amount: swap.inputAmount,
|
|
79
|
+
}}
|
|
80
|
+
/>
|
|
81
|
+
<Spacer size={12} />
|
|
82
|
+
<ArrowRightIcon size={12} />
|
|
83
|
+
<Spacer size={12} />
|
|
84
|
+
<Token
|
|
85
|
+
data={{
|
|
86
|
+
token: {
|
|
87
|
+
logo: lastStep.toLogo,
|
|
88
|
+
symbol: lastStep.toSymbol,
|
|
89
|
+
},
|
|
90
|
+
blockchain: {
|
|
91
|
+
// @ts-ignore
|
|
92
|
+
logo: lastStep.toBlockchainLogo,
|
|
93
|
+
name: lastStep.toBlockchain,
|
|
94
|
+
},
|
|
95
|
+
amount:
|
|
96
|
+
lastStep.outputAmount ||
|
|
97
|
+
lastStep.expectedOutputAmountHumanReadable ||
|
|
98
|
+
'',
|
|
99
|
+
}}
|
|
100
|
+
/>
|
|
101
|
+
</div>
|
|
102
|
+
<div className={`status`}>
|
|
103
|
+
{status === 'running' ? (
|
|
104
|
+
<Spinner size={24} color="primary" />
|
|
105
|
+
) : (
|
|
106
|
+
status
|
|
107
|
+
)}
|
|
108
|
+
</div>
|
|
109
|
+
</Container>
|
|
110
|
+
</Button>
|
|
111
|
+
);
|
|
112
|
+
}
|