@rango-dev/ui 0.1.10-next.69
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 +6 -0
- package/dist/components/Alert/Alert.stories.d.ts +4 -0
- package/dist/components/Alert/index.d.ts +1 -0
- package/dist/components/BestRoute/BestRoute.d.ts +8 -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 +14 -0
- package/dist/components/BlockchainSelector/BlockchainSelector.stories.d.ts +4 -0
- package/dist/components/BlockchainSelector/index.d.ts +1 -0
- package/dist/components/BlockchainsList/BlockchainsList.d.ts +7 -0
- package/dist/components/BlockchainsList/BlockchainsList.stories.d.ts +4 -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 +6 -0
- package/dist/components/Chip/index.d.ts +1 -0
- package/dist/components/ConnectWalletsModal/ConnectWallets.stories.d.ts +4 -0
- package/dist/components/ConnectWalletsModal/ConnectWalletsModal.d.ts +10 -0
- package/dist/components/ConnectWalletsModal/index.d.ts +1 -0
- package/dist/components/ConnectWalletsModal/mockData.d.ts +2 -0
- package/dist/components/Drawer/Drawer.d.ts +12 -0
- package/dist/components/Drawer/Drawer.stories.d.ts +7 -0
- package/dist/components/Drawer/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/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/CloseIcon.d.ts +1 -0
- package/dist/components/Icon/DeleteCircleIcon.d.ts +3 -0
- package/dist/components/Icon/DeleteWalletIcon.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 +36 -0
- package/dist/components/Icon/types.d.ts +6 -0
- package/dist/components/LiquiditySourceList/LiquiditySource.stories.d.ts +4 -0
- package/dist/components/LiquiditySourceList/LiquiditySourceList.d.ts +8 -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 +11 -0
- package/dist/components/LiquiditySourcesSelector/LiquiditySourcesSelector.stories.d.ts +4 -0
- package/dist/components/LiquiditySourcesSelector/index.d.ts +1 -0
- package/dist/components/Modal/Modal.d.ts +11 -0
- package/dist/components/Modal/Modal.stories.d.ts +4 -0
- package/dist/components/Modal/index.d.ts +1 -0
- package/dist/components/Radio/Radio.d.ts +12 -0
- package/dist/components/Radio/Radio.stories.d.ts +4 -0
- package/dist/components/Radio/index.d.ts +1 -0
- package/dist/components/SecondaryPage/SecondaryPage.d.ts +18 -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 +19 -0
- package/dist/components/Settings/Settings.stories.d.ts +4 -0
- package/dist/components/Settings/index.d.ts +1 -0
- package/dist/components/Skeleton/Skeleton.d.ts +5 -0
- package/dist/components/Skeleton/Skeleton.stories.d.ts +4 -0
- package/dist/components/Skeleton/index.d.ts +1 -0
- package/dist/components/Spacer/Spacer.d.ts +5 -0
- package/dist/components/Spacer/Spacer.stories.d.ts +4 -0
- package/dist/components/Spacer/index.d.ts +1 -0
- package/dist/components/Spinner/Spinner.d.ts +5 -0
- package/dist/components/Spinner/Spinner.stories.d.ts +4 -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 +4 -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 +6 -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/index.d.ts +1 -0
- package/dist/components/SwapDetail/mock.d.ts +2 -0
- package/dist/components/Switch/Switch.d.ts +5 -0
- package/dist/components/Switch/Switch.stories.d.ts +4 -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/TokenList.d.ts +14 -0
- package/dist/components/TokenList/TokenList.stories.d.ts +4 -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 +10 -0
- package/dist/components/TokenSelector/TokenSelector.stories.d.ts +4 -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 +14 -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 +18 -0
- package/dist/components/Wallet/State.d.ts +6 -0
- package/dist/components/Wallet/Wallet.d.ts +6 -0
- package/dist/components/Wallet/Wallet.stories.d.ts +4 -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 +24 -0
- package/dist/containers/ConfirmSwap/ConfirmSwap.d.ts +23 -0
- package/dist/containers/ConfirmSwap/ConfirmSwap.stories.d.ts +5 -0
- package/dist/containers/ConfirmSwap/index.d.ts +1 -0
- package/dist/containers/ConfirmSwap/mock.d.ts +2 -0
- package/dist/containers/ConfirmWallets/ConfirmWallets.d.ts +14 -0
- package/dist/containers/ConfirmWallets/ConfirmWallets.stories.d.ts +6 -0
- package/dist/containers/ConfirmWallets/index.d.ts +1 -0
- package/dist/containers/ConfirmWallets/mock.d.ts +5 -0
- package/dist/containers/ConfirmWallets/types.d.ts +8 -0
- package/dist/containers/History/History.d.ts +8 -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 +59 -0
- package/dist/containers/SwapHistory/SwapHistory.d.ts +7 -0
- package/dist/containers/SwapHistory/SwapHistory.stories.d.ts +4 -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 +4 -0
- package/dist/helper/index.d.ts +6 -0
- package/dist/helper/swaps.d.ts +5 -0
- package/dist/helpers.d.ts +1 -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 +1 -0
- package/dist/types/meta.d.ts +22 -0
- package/dist/types/swaps.d.ts +22 -0
- package/dist/types/wallet.d.ts +14 -0
- package/dist/ui.cjs.development.js +4103 -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 +4028 -0
- package/dist/ui.esm.js.map +1 -0
- package/package.json +89 -0
- package/src/components/Alert/Alert.stories.tsx +22 -0
- package/src/components/Alert/Alert.tsx +78 -0
- package/src/components/Alert/index.ts +1 -0
- package/src/components/BestRoute/BestRoute.stories.tsx +31 -0
- package/src/components/BestRoute/BestRoute.tsx +189 -0
- package/src/components/BestRoute/index.ts +1 -0
- package/src/components/BestRoute/mock.ts +544 -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 +60 -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 +407 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +22 -0
- package/src/components/Checkbox/Checkbox.tsx +54 -0
- package/src/components/Checkbox/index.ts +1 -0
- package/src/components/Chip/Chip.stories.tsx +37 -0
- package/src/components/Chip/Chip.tsx +45 -0
- package/src/components/Chip/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 +118 -0
- package/src/components/Drawer/Drawer.stories.tsx +86 -0
- package/src/components/Drawer/Drawer.tsx +128 -0
- package/src/components/Drawer/index.ts +1 -0
- package/src/components/Icon/AddCircleIcon.tsx +29 -0
- package/src/components/Icon/AddIcon.tsx +28 -0
- package/src/components/Icon/AddWalletIcon.tsx +48 -0
- package/src/components/Icon/AngleDownIcon.tsx +30 -0
- package/src/components/Icon/AngleLeftIcon.tsx +31 -0
- package/src/components/Icon/AngleRightIcon.tsx +30 -0
- package/src/components/Icon/AngleUpIcon.tsx +30 -0
- package/src/components/Icon/BagIcon.tsx +37 -0
- package/src/components/Icon/BanIcon.tsx +30 -0
- package/src/components/Icon/CheckCircleIcon.tsx +37 -0
- package/src/components/Icon/CheckIcon.tsx +28 -0
- package/src/components/Icon/CheckSquareIcon.tsx +35 -0
- package/src/components/Icon/CheckWalletIcon.tsx +43 -0
- package/src/components/Icon/CloseIcon.tsx +9 -0
- package/src/components/Icon/DeleteCircleIcon.tsx +29 -0
- package/src/components/Icon/DeleteWalletIcon.tsx +48 -0
- package/src/components/Icon/DownloadIcon.tsx +35 -0
- package/src/components/Icon/GasIcon.tsx +35 -0
- package/src/components/Icon/HistoryIcon.tsx +38 -0
- package/src/components/Icon/HorizontalSwapIcon.tsx +36 -0
- package/src/components/Icon/Icons.stories.tsx +44 -0
- package/src/components/Icon/InfoCircleIcon.tsx +37 -0
- package/src/components/Icon/MinusCircleIcon.tsx +29 -0
- package/src/components/Icon/RetryIcon.tsx +30 -0
- package/src/components/Icon/RetryLeftIcon.tsx +29 -0
- package/src/components/Icon/RetryRightIcon.tsx +29 -0
- package/src/components/Icon/SearchIcon.tsx +29 -0
- package/src/components/Icon/SearchMinusIcon.tsx +29 -0
- package/src/components/Icon/SettingIcon.tsx +37 -0
- package/src/components/Icon/SignatureIcon.tsx +30 -0
- package/src/components/Icon/SwapWalletIcon.tsx +48 -0
- package/src/components/Icon/TimeIcon.tsx +29 -0
- package/src/components/Icon/TrashIcon.tsx +29 -0
- package/src/components/Icon/TryAgainIcon.tsx +29 -0
- package/src/components/Icon/VerticalSwapIcon.tsx +36 -0
- package/src/components/Icon/WalletIconIcon.tsx +38 -0
- package/src/components/Icon/WarningIcon.tsx +35 -0
- package/src/components/Icon/common.ts +69 -0
- package/src/components/Icon/index.ts +44 -0
- package/src/components/Icon/types.tsx +44 -0
- package/src/components/LiquiditySourceList/LiquiditySource.stories.tsx +13 -0
- package/src/components/LiquiditySourceList/LiquiditySourceList.tsx +114 -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 +55 -0
- package/src/components/LiquiditySourcesSelector/index.ts +1 -0
- package/src/components/Modal/Modal.stories.tsx +22 -0
- package/src/components/Modal/Modal.tsx +76 -0
- package/src/components/Modal/index.ts +1 -0
- package/src/components/Radio/Radio.stories.tsx +23 -0
- package/src/components/Radio/Radio.tsx +95 -0
- package/src/components/Radio/index.ts +1 -0
- package/src/components/SecondaryPage/SecondaryPage.stories.tsx +7 -0
- package/src/components/SecondaryPage/SecondaryPage.tsx +95 -0
- package/src/components/SecondaryPage/index.ts +1 -0
- package/src/components/SelectableWalletList/SelectableWalletList.stories.tsx +14 -0
- package/src/components/SelectableWalletList/SelectableWalletList.tsx +113 -0
- package/src/components/SelectableWalletList/index.ts +1 -0
- package/src/components/SelectableWalletList/mock.ts +12 -0
- package/src/components/Settings/Settings.stories.tsx +34 -0
- package/src/components/Settings/Settings.tsx +160 -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 +18 -0
- package/src/components/Spacer/Spacer.tsx +98 -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 +81 -0
- package/src/components/StatusDrawer/index.ts +1 -0
- package/src/components/StepDetail/StepDetail.stories.tsx +37 -0
- package/src/components/StepDetail/StepDetail.tsx +97 -0
- package/src/components/StepDetail/index.ts +1 -0
- package/src/components/SwapContainer/SwapContainer.stories.tsx +13 -0
- package/src/components/SwapContainer/SwapContainer.tsx +35 -0
- package/src/components/SwapContainer/index.ts +1 -0
- package/src/components/SwapDetail/SwapDetail.stories.tsx +19 -0
- package/src/components/SwapDetail/SwapDetail.tsx +150 -0
- package/src/components/SwapDetail/index.ts +1 -0
- package/src/components/SwapDetail/mock.ts +275 -0
- package/src/components/Switch/Switch.stories.tsx +9 -0
- package/src/components/Switch/Switch.tsx +52 -0
- package/src/components/Switch/index.ts +1 -0
- package/src/components/TextField/TextField.stories.tsx +31 -0
- package/src/components/TextField/TextField.tsx +129 -0
- package/src/components/TextField/index.ts +1 -0
- package/src/components/TokenList/TokenList.stories.tsx +18 -0
- package/src/components/TokenList/TokenList.tsx +180 -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 +35 -0
- package/src/components/TokenSelector/index.ts +1 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +52 -0
- package/src/components/Tooltip/Tooltip.tsx +110 -0
- package/src/components/Tooltip/index.ts +1 -0
- package/src/components/Typography/Typography.stories.tsx +68 -0
- package/src/components/Typography/Typography.tsx +199 -0
- package/src/components/Typography/index.ts +1 -0
- package/src/components/VirtualizedList/VirtualizedList.tsx +78 -0
- package/src/components/Wallet/State.tsx +36 -0
- package/src/components/Wallet/Wallet.stories.tsx +36 -0
- package/src/components/Wallet/Wallet.tsx +42 -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 +24 -0
- package/src/containers/ConfirmSwap/ConfirmSwap.stories.tsx +13 -0
- package/src/containers/ConfirmSwap/ConfirmSwap.tsx +154 -0
- package/src/containers/ConfirmSwap/index.ts +1 -0
- package/src/containers/ConfirmSwap/mock.ts +146 -0
- package/src/containers/ConfirmWallets/ConfirmWallets.stories.tsx +26 -0
- package/src/containers/ConfirmWallets/ConfirmWallets.tsx +98 -0
- package/src/containers/ConfirmWallets/index.ts +1 -0
- package/src/containers/ConfirmWallets/mock.ts +222 -0
- package/src/containers/ConfirmWallets/types.ts +9 -0
- package/src/containers/History/History.stories.tsx +14 -0
- package/src/containers/History/History.tsx +93 -0
- package/src/containers/History/index.ts +1 -0
- package/src/containers/History/mock.ts +825 -0
- package/src/containers/History/types.tsx +66 -0
- package/src/containers/SwapHistory/SwapHistory.stories.tsx +13 -0
- package/src/containers/SwapHistory/SwapHistory.tsx +165 -0
- package/src/containers/SwapHistory/index.ts +1 -0
- package/src/containers/SwapHistory/mock.ts +275 -0
- package/src/containers/index.ts +4 -0
- package/src/helper/index.ts +23 -0
- package/src/helper/swaps.ts +23 -0
- package/src/helpers.ts +2 -0
- package/src/index.ts +4 -0
- package/src/theme.ts +161 -0
- package/src/types/index.ts +1 -0
- package/src/types/meta.ts +20 -0
- package/src/types/swaps.tsx +36 -0
- package/src/types/wallet.ts +20 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
// import { ChevronLeftIcon } from '@radix-ui/react-icons';
|
|
3
|
+
import { styled } from '../../theme';
|
|
4
|
+
import { AngleLeftIcon, SearchIcon } from '../Icon';
|
|
5
|
+
import { TextField } from '../TextField/TextField';
|
|
6
|
+
import { Typography } from '../Typography';
|
|
7
|
+
|
|
8
|
+
export type PropTypes = (
|
|
9
|
+
| {
|
|
10
|
+
textField: true;
|
|
11
|
+
Content: React.ElementType<{ searchedFor: string }>;
|
|
12
|
+
textFieldPlaceholder: string;
|
|
13
|
+
}
|
|
14
|
+
| {
|
|
15
|
+
textField: false;
|
|
16
|
+
Content: React.ReactNode;
|
|
17
|
+
}
|
|
18
|
+
) & {
|
|
19
|
+
title: string;
|
|
20
|
+
onBack?: () => void;
|
|
21
|
+
TopButton?: React.ReactNode;
|
|
22
|
+
Footer?: React.ReactNode;
|
|
23
|
+
hasHeader?: boolean;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const Container = styled('div', {
|
|
27
|
+
display: 'flex',
|
|
28
|
+
flexDirection: 'column',
|
|
29
|
+
height: '100%',
|
|
30
|
+
width: '100%',
|
|
31
|
+
padding: '$12 0',
|
|
32
|
+
|
|
33
|
+
'@lg': {
|
|
34
|
+
padding: '$16 0',
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const HeaderContainer = styled('div', {
|
|
39
|
+
display: 'flex',
|
|
40
|
+
justifyContent: 'center',
|
|
41
|
+
alignItems: 'center',
|
|
42
|
+
marginBottom: '$16',
|
|
43
|
+
position: 'relative',
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const BackIcon = styled(AngleLeftIcon, {
|
|
47
|
+
position: 'absolute',
|
|
48
|
+
left: '0',
|
|
49
|
+
});
|
|
50
|
+
const StyledBackIcon = styled(BackIcon, {
|
|
51
|
+
cursor: 'pointer',
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const ContentContainer = styled('div', {
|
|
55
|
+
flex: '1',
|
|
56
|
+
overflowY: 'auto',
|
|
57
|
+
overflowX: 'hidden',
|
|
58
|
+
marginTop: '$16',
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export function SecondaryPage(props: PropTypes) {
|
|
62
|
+
const { title, Footer, TopButton, onBack, hasHeader = true } = props;
|
|
63
|
+
const [searchedFor, setSearchedFor] = useState('');
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<Container>
|
|
67
|
+
{hasHeader && (
|
|
68
|
+
<HeaderContainer>
|
|
69
|
+
<StyledBackIcon size={24} onClick={onBack} />
|
|
70
|
+
<Typography variant="h4">{title}</Typography>
|
|
71
|
+
{TopButton}
|
|
72
|
+
</HeaderContainer>
|
|
73
|
+
)}
|
|
74
|
+
|
|
75
|
+
{props.textField && (
|
|
76
|
+
<div>
|
|
77
|
+
<TextField
|
|
78
|
+
size="large"
|
|
79
|
+
prefix={<SearchIcon size={24} />}
|
|
80
|
+
placeholder={props.textFieldPlaceholder}
|
|
81
|
+
onChange={(event) => setSearchedFor(event.target.value)}
|
|
82
|
+
value={searchedFor}
|
|
83
|
+
autoFocus
|
|
84
|
+
/>
|
|
85
|
+
</div>
|
|
86
|
+
)}
|
|
87
|
+
<ContentContainer>
|
|
88
|
+
{props.textField && <props.Content searchedFor={searchedFor} />}
|
|
89
|
+
{!props.textField && props.Content}
|
|
90
|
+
</ContentContainer>
|
|
91
|
+
|
|
92
|
+
{Footer}
|
|
93
|
+
</Container>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SecondaryPage } from './SecondaryPage';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentMeta } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { SelectableWalletList, PropTypes } from './SelectableWalletList';
|
|
5
|
+
import { data } from './mock';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Components/SelectableWalletList',
|
|
9
|
+
component: SelectableWalletList,
|
|
10
|
+
} as ComponentMeta<typeof SelectableWalletList>;
|
|
11
|
+
|
|
12
|
+
export const Main = (props: PropTypes) => (
|
|
13
|
+
<SelectableWalletList {...props} list={data} />
|
|
14
|
+
);
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import React, { PropsWithChildren, useEffect, useState } from 'react';
|
|
2
|
+
import { SelectableWallet } from '../../containers/ConfirmWallets/types';
|
|
3
|
+
import { styled } from '../../theme';
|
|
4
|
+
import { Typography } from '../Typography';
|
|
5
|
+
|
|
6
|
+
const Row = styled('div', {
|
|
7
|
+
display: 'flex',
|
|
8
|
+
flexWrap: 'wrap',
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const Circle = styled('div', {
|
|
12
|
+
width: 12,
|
|
13
|
+
height: 12,
|
|
14
|
+
borderRadius: 6,
|
|
15
|
+
border: '1px solid $neutrals400',
|
|
16
|
+
position: 'absolute',
|
|
17
|
+
top: 12,
|
|
18
|
+
right: 12,
|
|
19
|
+
variants: {
|
|
20
|
+
checked: {
|
|
21
|
+
true: {
|
|
22
|
+
borderColor: '$success',
|
|
23
|
+
},
|
|
24
|
+
false: {
|
|
25
|
+
borderColor: '$neutrals400',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const SolidCircle = styled('div', {
|
|
31
|
+
width: 6,
|
|
32
|
+
margin: '20% auto',
|
|
33
|
+
height: 6,
|
|
34
|
+
borderRadius: 3,
|
|
35
|
+
variants: {
|
|
36
|
+
checked: {
|
|
37
|
+
true: {
|
|
38
|
+
backgroundColor: '$success',
|
|
39
|
+
},
|
|
40
|
+
false: {
|
|
41
|
+
backgroundColor: '$neutrals400',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
const Container = styled('div', {
|
|
47
|
+
border: '1.5px solid',
|
|
48
|
+
borderRadius: '$5',
|
|
49
|
+
padding: '$12',
|
|
50
|
+
flexBasis: 'calc(33.33% - 10px)',
|
|
51
|
+
margin: 5,
|
|
52
|
+
display: 'flex',
|
|
53
|
+
flexDirection: 'column',
|
|
54
|
+
justifyContent: 'space-between',
|
|
55
|
+
width: 124,
|
|
56
|
+
height: 92,
|
|
57
|
+
cursor: 'pointer',
|
|
58
|
+
position: 'relative',
|
|
59
|
+
variants: {
|
|
60
|
+
checked: {
|
|
61
|
+
true: {
|
|
62
|
+
borderColor: '$success',
|
|
63
|
+
color: '$success',
|
|
64
|
+
},
|
|
65
|
+
false: {
|
|
66
|
+
borderColor: '$neutrals400',
|
|
67
|
+
color: '$neutrals400',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
export interface PropTypes {
|
|
73
|
+
list: SelectableWallet[];
|
|
74
|
+
onChange: (w: SelectableWallet) => void;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function SelectableWalletList({
|
|
78
|
+
list,
|
|
79
|
+
onChange,
|
|
80
|
+
}: PropsWithChildren<PropTypes>) {
|
|
81
|
+
const [active, setActive] = useState<string>(
|
|
82
|
+
list.find((item) => item.selected)?.walletType || ''
|
|
83
|
+
);
|
|
84
|
+
const onClick = (w: SelectableWallet) => {
|
|
85
|
+
setActive(w.walletType);
|
|
86
|
+
onChange(w);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
setActive(list.find((item) => item.selected)?.walletType || '');
|
|
91
|
+
}, [list]);
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<Row>
|
|
95
|
+
{list.map((w, index) => {
|
|
96
|
+
const checked = active === w.walletType;
|
|
97
|
+
return (
|
|
98
|
+
<Container
|
|
99
|
+
checked={checked}
|
|
100
|
+
onClick={onClick.bind(null, w)}
|
|
101
|
+
key={index}
|
|
102
|
+
>
|
|
103
|
+
<img src={w.image} alt={w.walletType} width={24} height={24} />
|
|
104
|
+
<Typography variant="body2">{w.walletType}</Typography>
|
|
105
|
+
<Circle checked={checked}>
|
|
106
|
+
<SolidCircle checked={checked} />
|
|
107
|
+
</Circle>
|
|
108
|
+
</Container>
|
|
109
|
+
);
|
|
110
|
+
})}
|
|
111
|
+
</Row>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SelectableWalletList } from './SelectableWalletList';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { WalletType } from '@rango-dev/wallets-shared';
|
|
2
|
+
import { SelectableWallet } from '../../containers/ConfirmWallets/types';
|
|
3
|
+
|
|
4
|
+
export const data: SelectableWallet[] = [
|
|
5
|
+
{
|
|
6
|
+
blockchain: 'BSC',
|
|
7
|
+
walletType: WalletType.META_MASK,
|
|
8
|
+
address: '0x5423e28219d6d568dcf62a8134d623e6f4a1c2df',
|
|
9
|
+
image: 'https://app.rango.exchange/wallets/metamask.svg',
|
|
10
|
+
selected: true,
|
|
11
|
+
},
|
|
12
|
+
];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentMeta } from '@storybook/react';
|
|
3
|
+
import { Settings, PropTypes } from './Settings';
|
|
4
|
+
import { SwapContainer } from '../SwapContainer/SwapContainer';
|
|
5
|
+
import { liquiditySources } from '../LiquiditySourceList/mockData';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Settings',
|
|
9
|
+
component: Settings,
|
|
10
|
+
argTypes: {
|
|
11
|
+
slippages: {
|
|
12
|
+
defaultValue: [0.5, 1, 3, 5, 8, 13, 20],
|
|
13
|
+
},
|
|
14
|
+
selectedSlippage: { defaultValue: 3 },
|
|
15
|
+
liquiditySources: {
|
|
16
|
+
defaultValue: liquiditySources,
|
|
17
|
+
},
|
|
18
|
+
selectedLiquiditySources: {
|
|
19
|
+
defaultValue: liquiditySources.slice(0, 5),
|
|
20
|
+
},
|
|
21
|
+
minSlippage: {
|
|
22
|
+
defaultValue: 1,
|
|
23
|
+
},
|
|
24
|
+
maxSlippage: {
|
|
25
|
+
defaultValue: 10,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
} as ComponentMeta<typeof Settings>;
|
|
29
|
+
|
|
30
|
+
export const Main = (args: PropTypes) => (
|
|
31
|
+
<SwapContainer>
|
|
32
|
+
<Settings {...args} />
|
|
33
|
+
</SwapContainer>
|
|
34
|
+
);
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { styled } from '../../theme';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { AngleRightIcon } from '../Icon';
|
|
4
|
+
import { SecondaryPage } from '../SecondaryPage/SecondaryPage';
|
|
5
|
+
import { Typography } from '../Typography';
|
|
6
|
+
import { Chip } from '../Chip';
|
|
7
|
+
import { LiquiditySource } from '../../types/meta';
|
|
8
|
+
import { TextField } from '../TextField';
|
|
9
|
+
import { Radio } from '../Radio';
|
|
10
|
+
|
|
11
|
+
const BaseContainer = styled('div', {
|
|
12
|
+
borderRadius: '$5',
|
|
13
|
+
backgroundColor: '$neutrals200',
|
|
14
|
+
padding: '$16',
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const SlippageChipsContainer = styled('div', {
|
|
18
|
+
display: 'flex',
|
|
19
|
+
flexWrap: 'wrap',
|
|
20
|
+
marginTop: '$16',
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const LiquiditySourceContainer = styled(BaseContainer, {
|
|
24
|
+
display: 'flex',
|
|
25
|
+
justifyContent: 'space-between',
|
|
26
|
+
marginTop: '$32',
|
|
27
|
+
cursor: 'pointer',
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const StyledAngleRight = styled(AngleRightIcon, { marginLeft: '8px' });
|
|
31
|
+
|
|
32
|
+
const LiquiditySourceNumber = styled('div', {
|
|
33
|
+
display: 'flex',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
justifyContent: 'center',
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const ThemesContainer = styled(BaseContainer, {
|
|
39
|
+
marginTop: '$32',
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
type Theme = 'dark' | 'light' | 'auto';
|
|
43
|
+
|
|
44
|
+
export interface PropTypes {
|
|
45
|
+
slippages: number[];
|
|
46
|
+
selectedSlippage: number;
|
|
47
|
+
customSlippage: number;
|
|
48
|
+
maxSlippage: number;
|
|
49
|
+
minSlippage: number;
|
|
50
|
+
liquiditySources: LiquiditySource[];
|
|
51
|
+
onLiquiditySourcesClick: () => void;
|
|
52
|
+
selectedLiquiditySources: LiquiditySource[];
|
|
53
|
+
onSlippageChange: (slippage: number) => void;
|
|
54
|
+
onCustomSlippageChange: (customSlippage: number | null) => void;
|
|
55
|
+
selectedTheme: Theme;
|
|
56
|
+
onThemeChange: (theme: Theme) => void;
|
|
57
|
+
onBack: () => void;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function Settings(props: PropTypes) {
|
|
61
|
+
const {
|
|
62
|
+
slippages,
|
|
63
|
+
selectedLiquiditySources,
|
|
64
|
+
liquiditySources,
|
|
65
|
+
onSlippageChange,
|
|
66
|
+
onLiquiditySourcesClick,
|
|
67
|
+
onBack,
|
|
68
|
+
customSlippage,
|
|
69
|
+
onCustomSlippageChange,
|
|
70
|
+
maxSlippage,
|
|
71
|
+
minSlippage,
|
|
72
|
+
selectedTheme,
|
|
73
|
+
onThemeChange,
|
|
74
|
+
} = props;
|
|
75
|
+
|
|
76
|
+
const [selectedSlippage, setSelectedSlippage] = useState(
|
|
77
|
+
props.selectedSlippage
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const changeSlippage = (slippage: number) => {
|
|
81
|
+
setSelectedSlippage(slippage);
|
|
82
|
+
onSlippageChange(slippage);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const PageContent = (
|
|
86
|
+
<>
|
|
87
|
+
<BaseContainer>
|
|
88
|
+
<Typography variant="body1">Slippage tolerance per swap</Typography>
|
|
89
|
+
<SlippageChipsContainer>
|
|
90
|
+
{slippages.map((slippage, index) => (
|
|
91
|
+
<Chip
|
|
92
|
+
key={index}
|
|
93
|
+
onClick={() => {
|
|
94
|
+
if (customSlippage) onCustomSlippageChange(null);
|
|
95
|
+
changeSlippage(slippage);
|
|
96
|
+
}}
|
|
97
|
+
selected={!customSlippage && slippage === selectedSlippage}
|
|
98
|
+
label={`${slippage.toString()} %`}
|
|
99
|
+
style={{
|
|
100
|
+
marginRight: '8px',
|
|
101
|
+
}}
|
|
102
|
+
/>
|
|
103
|
+
))}
|
|
104
|
+
<TextField
|
|
105
|
+
type="number"
|
|
106
|
+
value={customSlippage}
|
|
107
|
+
onChange={(event) => {
|
|
108
|
+
const parsedValue = parseFloat(event.target.value);
|
|
109
|
+
if (
|
|
110
|
+
!parsedValue ||
|
|
111
|
+
(parsedValue >= minSlippage && parsedValue <= maxSlippage)
|
|
112
|
+
)
|
|
113
|
+
onCustomSlippageChange(parsedValue);
|
|
114
|
+
}}
|
|
115
|
+
suffix={
|
|
116
|
+
customSlippage && <Typography variant="body2">%</Typography>
|
|
117
|
+
}
|
|
118
|
+
size="small"
|
|
119
|
+
placeholder="Custom"
|
|
120
|
+
style={{
|
|
121
|
+
width: '128px',
|
|
122
|
+
flexGrow: 'initial',
|
|
123
|
+
borderColor: customSlippage ? '$success' : 'initial',
|
|
124
|
+
}}
|
|
125
|
+
/>
|
|
126
|
+
</SlippageChipsContainer>
|
|
127
|
+
</BaseContainer>
|
|
128
|
+
<ThemesContainer>
|
|
129
|
+
<Typography variant="body2">Theme</Typography>
|
|
130
|
+
<Radio
|
|
131
|
+
defaultValue={selectedTheme}
|
|
132
|
+
options={[
|
|
133
|
+
{ value: 'dark', label: 'Dark' },
|
|
134
|
+
{ value: 'light', label: 'Light' },
|
|
135
|
+
{ value: 'auto', label: 'Auto' },
|
|
136
|
+
]}
|
|
137
|
+
onChange={(value) => onThemeChange(value as Theme)}
|
|
138
|
+
direction="horizontal"
|
|
139
|
+
style={{ marginTop: '$24' }}
|
|
140
|
+
/>
|
|
141
|
+
</ThemesContainer>
|
|
142
|
+
<LiquiditySourceContainer onClick={onLiquiditySourcesClick}>
|
|
143
|
+
<Typography variant="body1">Liquidity Sources</Typography>
|
|
144
|
+
<LiquiditySourceNumber onClick={onLiquiditySourcesClick}>
|
|
145
|
+
<Typography variant="body2">{`( ${selectedLiquiditySources.length} / ${liquiditySources.length} )`}</Typography>
|
|
146
|
+
<StyledAngleRight />
|
|
147
|
+
</LiquiditySourceNumber>
|
|
148
|
+
</LiquiditySourceContainer>
|
|
149
|
+
</>
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
return (
|
|
153
|
+
<SecondaryPage
|
|
154
|
+
title="Settings"
|
|
155
|
+
textField={false}
|
|
156
|
+
Content={PageContent}
|
|
157
|
+
onBack={onBack}
|
|
158
|
+
/>
|
|
159
|
+
);
|
|
160
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Settings } from './Settings';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ComponentMeta } from '@storybook/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Skeleton, PropTypes } from './Skeleton';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/Skeleton',
|
|
7
|
+
component: Skeleton,
|
|
8
|
+
argTypes: {
|
|
9
|
+
width: {
|
|
10
|
+
name: 'width',
|
|
11
|
+
control: { type: 'select' },
|
|
12
|
+
options: [20, 24, 36, 48],
|
|
13
|
+
defaultValue: 20,
|
|
14
|
+
},
|
|
15
|
+
height: {
|
|
16
|
+
name: 'height',
|
|
17
|
+
control: { type: 'select' },
|
|
18
|
+
options: [20, 24, 36, 48],
|
|
19
|
+
defaultValue: 20,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
} as ComponentMeta<typeof Skeleton>;
|
|
23
|
+
|
|
24
|
+
export const Main = (props: PropTypes) => <Skeleton {...props} />;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { keyframes, styled } from '../../theme';
|
|
3
|
+
|
|
4
|
+
const waveSquares = keyframes({
|
|
5
|
+
'0%': {
|
|
6
|
+
backgroundPosition: '-468px 0',
|
|
7
|
+
},
|
|
8
|
+
'100%': {
|
|
9
|
+
backgroundPosition: '468px 0',
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const SkeletonContainer = styled('div', {
|
|
14
|
+
borderRadius: '$5',
|
|
15
|
+
backgroundColor: '$neutrals300',
|
|
16
|
+
background: `linear-gradient(to right, rgba(130, 130, 130, 0.2) 8%, rgba(130, 130, 130, 0.3) 18%, rgba(130, 130, 130, 0.2) 33%)`,
|
|
17
|
+
backgroundSize: '800px 100px',
|
|
18
|
+
animation: `${waveSquares} 2s infinite ease-out`,
|
|
19
|
+
variants: {
|
|
20
|
+
width: {
|
|
21
|
+
16: {
|
|
22
|
+
width: '$16',
|
|
23
|
+
},
|
|
24
|
+
20: {
|
|
25
|
+
width: '$20',
|
|
26
|
+
},
|
|
27
|
+
24: {
|
|
28
|
+
width: '$24',
|
|
29
|
+
},
|
|
30
|
+
36: {
|
|
31
|
+
width: '$36',
|
|
32
|
+
},
|
|
33
|
+
48: {
|
|
34
|
+
width: '$48',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
height: {
|
|
38
|
+
16: {
|
|
39
|
+
height: '$16',
|
|
40
|
+
},
|
|
41
|
+
20: {
|
|
42
|
+
height: '$20',
|
|
43
|
+
},
|
|
44
|
+
24: {
|
|
45
|
+
height: '$24',
|
|
46
|
+
},
|
|
47
|
+
36: {
|
|
48
|
+
height: '$36',
|
|
49
|
+
},
|
|
50
|
+
48: {
|
|
51
|
+
height: '$48',
|
|
52
|
+
},
|
|
53
|
+
94: {
|
|
54
|
+
height: 94,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
export interface PropTypes {
|
|
60
|
+
width?: 20 | 24 | 36 | 48;
|
|
61
|
+
height?: 20 | 24 | 36 | 48 | 94;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function Skeleton({ width = 20, height = 20 }: PropTypes) {
|
|
65
|
+
return <SkeletonContainer width={width} height={height} />;
|
|
66
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Skeleton } from './Skeleton';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ComponentMeta } from '@storybook/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Spacer, PropTypes } from './Spacer';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/Spacer',
|
|
7
|
+
component: Spacer,
|
|
8
|
+
argTypes: {
|
|
9
|
+
size: {
|
|
10
|
+
name: 'size',
|
|
11
|
+
control: { type: 'select' },
|
|
12
|
+
options: [12, 16, 18, 20],
|
|
13
|
+
defaultValue: 12,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
} as ComponentMeta<typeof Spacer>;
|
|
17
|
+
|
|
18
|
+
export const Main = (props: PropTypes) => <Spacer {...props} />;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { styled } from '../../theme';
|
|
3
|
+
|
|
4
|
+
const SpacerContainer = styled('div', {
|
|
5
|
+
variants: {
|
|
6
|
+
size: {
|
|
7
|
+
12: {},
|
|
8
|
+
16: {},
|
|
9
|
+
18: {},
|
|
10
|
+
20: {},
|
|
11
|
+
24: {},
|
|
12
|
+
},
|
|
13
|
+
direction: {
|
|
14
|
+
vertical: {},
|
|
15
|
+
horizontal: {},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
compoundVariants: [
|
|
19
|
+
{
|
|
20
|
+
size: 12,
|
|
21
|
+
direction: 'horizontal',
|
|
22
|
+
css: {
|
|
23
|
+
width: '$12',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
size: 12,
|
|
28
|
+
direction: 'vertical',
|
|
29
|
+
css: {
|
|
30
|
+
height: '$12',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
size: 16,
|
|
35
|
+
direction: 'horizontal',
|
|
36
|
+
css: {
|
|
37
|
+
width: '$16',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
size: 16,
|
|
42
|
+
direction: 'vertical',
|
|
43
|
+
css: {
|
|
44
|
+
height: '$16',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
size: 18,
|
|
49
|
+
direction: 'horizontal',
|
|
50
|
+
css: {
|
|
51
|
+
width: '$18',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
size: 18,
|
|
56
|
+
direction: 'vertical',
|
|
57
|
+
css: {
|
|
58
|
+
height: '$18',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
size: 20,
|
|
63
|
+
direction: 'horizontal',
|
|
64
|
+
css: {
|
|
65
|
+
width: '$20',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
size: 20,
|
|
70
|
+
direction: 'vertical',
|
|
71
|
+
css: {
|
|
72
|
+
height: '$20',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
size: 24,
|
|
77
|
+
direction: 'horizontal',
|
|
78
|
+
css: {
|
|
79
|
+
width: '$24',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
size: 24,
|
|
84
|
+
direction: 'vertical',
|
|
85
|
+
css: {
|
|
86
|
+
height: '$24',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
});
|
|
91
|
+
export interface PropTypes {
|
|
92
|
+
size?: 12 | 16 | 18 | 20 | 24;
|
|
93
|
+
direction?: 'vertical' | 'horizontal';
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function Spacer({ size = 12, direction = 'horizontal' }: PropTypes) {
|
|
97
|
+
return <SpacerContainer size={size} direction={direction} />;
|
|
98
|
+
}
|
|
@@ -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} />;
|