diff --git a/src/components/organisms/AssetActions/Pool/Actions.module.css b/src/components/organisms/AssetActions/Pool/Actions.module.css new file mode 100644 index 000000000..225705529 --- /dev/null +++ b/src/components/organisms/AssetActions/Pool/Actions.module.css @@ -0,0 +1,17 @@ +.actions { + margin-left: -2rem; + margin-right: -2rem; + padding-left: var(--spacer); + padding-right: var(--spacer); + margin-top: calc(var(--spacer) / 2); + padding-top: calc(var(--spacer) / 1.5); + border-top: 1px solid var(--brand-grey-lighter); + text-align: center; + display: flex; + justify-content: center; +} + +.actions button { + margin-left: calc(var(--spacer) / 4); + margin-right: calc(var(--spacer) / 4); +} diff --git a/src/components/organisms/AssetActions/Pool/Actions.tsx b/src/components/organisms/AssetActions/Pool/Actions.tsx new file mode 100644 index 000000000..20a3ff32e --- /dev/null +++ b/src/components/organisms/AssetActions/Pool/Actions.tsx @@ -0,0 +1,32 @@ +import React, { ReactElement } from 'react' +import Loader from '../../../atoms/Loader' +import Button from '../../../atoms/Button' +import Alert from '../../../atoms/Alert' +import styles from './Actions.module.css' + +export default function Actions({ + isLoading, + loaderMessage, + txId, + actionName, + action +}: { + isLoading: boolean + loaderMessage: string + txId: string + actionName: string + action: () => void +}): ReactElement { + return ( +
+ {isLoading ? ( + + ) : ( + + )} + {txId && } +
+ ) +} diff --git a/src/components/organisms/AssetActions/Pool/Add.tsx b/src/components/organisms/AssetActions/Pool/Add.tsx index edbef0192..68e7ad0b2 100644 --- a/src/components/organisms/AssetActions/Pool/Add.tsx +++ b/src/components/organisms/AssetActions/Pool/Add.tsx @@ -1,16 +1,13 @@ import React, { ReactElement, useState, ChangeEvent } from 'react' import styles from './Add.module.css' -import stylesIndex from './index.module.css' -import Button from '../../../atoms/Button' import { useOcean } from '@oceanprotocol/react' import Header from './Header' -import Loader from '../../../atoms/Loader' import { toast } from 'react-toastify' import InputElement from '../../../atoms/Input/InputElement' import Token from './Token' import { Balance } from './' import PriceUnit from '../../../atoms/Price/PriceUnit' -import Alert from '../../../atoms/Alert' +import Actions from './Actions' // TODO: handle and display all fees somehow @@ -86,25 +83,13 @@ export default function Add({ -
- {isLoading ? ( - - ) : ( - - )} - {txId && ( - - )} -
+ ) } diff --git a/src/components/organisms/AssetActions/Pool/Remove.tsx b/src/components/organisms/AssetActions/Pool/Remove.tsx index 27a57f7af..7097f3728 100644 --- a/src/components/organisms/AssetActions/Pool/Remove.tsx +++ b/src/components/organisms/AssetActions/Pool/Remove.tsx @@ -1,13 +1,10 @@ import React, { ReactElement, useState, ChangeEvent } from 'react' import styles from './Remove.module.css' -import stylesIndex from './index.module.css' -import Button from '../../../atoms/Button' import { useOcean } from '@oceanprotocol/react' import Header from './Header' import { toast } from 'react-toastify' -import Loader from '../../../atoms/Loader' import InputElement from '../../../atoms/Input/InputElement' -import Alert from '../../../atoms/Alert' +import Actions from './Actions' export default function Remove({ setShowRemove, @@ -68,25 +65,13 @@ export default function Remove({

You will receive

-
- {isLoading ? ( - - ) : ( - - )} - {txId && ( - - )} -
+ ) } diff --git a/src/components/organisms/AssetActions/Pool/index.module.css b/src/components/organisms/AssetActions/Pool/index.module.css index 0f04fb576..7c9cd90bc 100644 --- a/src/components/organisms/AssetActions/Pool/index.module.css +++ b/src/components/organisms/AssetActions/Pool/index.module.css @@ -32,26 +32,3 @@ font-size: var(--font-size-base); margin-bottom: calc(var(--spacer) / 1.5); } - -.tokens { -} - -/* Shared Styles for all screens */ - -.actions { - margin-left: -2rem; - margin-right: -2rem; - padding-left: var(--spacer); - padding-right: var(--spacer); - margin-top: calc(var(--spacer) / 2); - padding-top: calc(var(--spacer) / 1.5); - border-top: 1px solid var(--brand-grey-lighter); - text-align: center; - display: flex; - justify-content: center; -} - -.actions button { - margin-left: calc(var(--spacer) / 4); - margin-right: calc(var(--spacer) / 4); -} diff --git a/src/components/organisms/AssetActions/Pool/index.tsx b/src/components/organisms/AssetActions/Pool/index.tsx index 4728593a2..0f64d5200 100644 --- a/src/components/organisms/AssetActions/Pool/index.tsx +++ b/src/components/organisms/AssetActions/Pool/index.tsx @@ -2,6 +2,7 @@ import React, { ReactElement, useEffect, useState } from 'react' import { useOcean, useMetadata } from '@oceanprotocol/react' import { DDO } from '@oceanprotocol/lib' import styles from './index.module.css' +import stylesActions from './Actions.module.css' import Token from './Token' import PriceUnit from '../../../atoms/Price/PriceUnit' import Loader from '../../../atoms/Loader' @@ -160,7 +161,7 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement { -
+