From ea243eed09ec1c4b7e693159d797c38897fd288f Mon Sep 17 00:00:00 2001 From: jonybur Date: Thu, 2 Mar 2023 14:46:45 +0000 Subject: [PATCH 1/6] Replace Button --- package.json | 1 + .../defi_card_content/defi_card_content.tsx | 3 +- .../defi_investment_interaction_fields.tsx | 3 +- src/components/holdings_list/holding.tsx | 3 +- .../report_error_button.tsx | 2 +- src/components/shield_more/shield_more.tsx | 3 +- src/components/template/user_account_menu.tsx | 3 +- .../transaction_history_section.tsx | 3 +- .../wallet_interaction_toast.tsx | 2 +- src/toolbox/signer_submit/signer_submit.tsx | 2 +- .../components/button/button.module.scss | 105 ------- .../components/button/button.stories.tsx | 44 --- .../components/button/button.tsx | 89 ------ src/ui-components/components/button/index.ts | 1 - .../signing_request/signing_request.tsx | 2 +- src/ui-components/components/toast/toast.tsx | 2 +- .../account/dashboard/access_account_form.tsx | 3 +- .../defi_confirmation_page.tsx | 2 +- .../retry_signing_button.tsx | 2 +- .../footer_section/footer_section.tsx | 3 +- .../send_modal/send_confirmation_page.tsx | 2 +- .../shield_confirmation_page.tsx | 2 +- src/views/account/dashboard/trade.tsx | 2 +- src/views/home.tsx | 3 +- src/views/toasts/toast_configurations.tsx | 3 +- .../unsupported_popup/unsupported_popup.tsx | 2 +- yarn.lock | 297 ++++++++++++++++-- 27 files changed, 311 insertions(+), 278 deletions(-) delete mode 100644 src/ui-components/components/button/button.module.scss delete mode 100644 src/ui-components/components/button/button.stories.tsx delete mode 100644 src/ui-components/components/button/button.tsx delete mode 100644 src/ui-components/components/button/index.ts diff --git a/package.json b/package.json index fec52215..b0d52012 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ }, "type": "module", "dependencies": { + "@aztec/aztec-ui": "^0.1.13", "@aztec/sdk": "2.1.0-testnet.119", "@rainbow-me/rainbowkit": "^0.8.1", "@types/jsan": "^3.1.2", diff --git a/src/components/defi_card/defi_card_content/defi_card_content.tsx b/src/components/defi_card/defi_card_content/defi_card_content.tsx index d9bf4f60..078ccece 100644 --- a/src/components/defi_card/defi_card_content/defi_card_content.tsx +++ b/src/components/defi_card/defi_card_content/defi_card_content.tsx @@ -1,5 +1,6 @@ import { useState } from 'react'; -import { InfoWrap, Button } from '../../../ui-components/index.js'; +import { Button } from '@aztec/aztec-ui'; +import { InfoWrap } from '../../../ui-components/index.js'; import { DefiRecipe } from '../../../alt-model/defi/types.js'; import { DefiCardDescription } from './defi_card_description.js'; import { DefiCardInfoContent } from './defi_card_info_content.js'; diff --git a/src/components/defi_investments/defi_investment_row/defi_investment_interaction_fields.tsx b/src/components/defi_investments/defi_investment_row/defi_investment_interaction_fields.tsx index 9d385c15..4f6c6c9c 100644 --- a/src/components/defi_investments/defi_investment_row/defi_investment_interaction_fields.tsx +++ b/src/components/defi_investments/defi_investment_row/defi_investment_interaction_fields.tsx @@ -1,4 +1,5 @@ import { useState } from 'react'; +import { Button } from '@aztec/aztec-ui'; import { TxId, UserDefiInteractionResultState, UserDefiTx } from '@aztec/sdk'; import type { DefiRecipe } from '../../../alt-model/defi/types.js'; import type { @@ -6,7 +7,7 @@ import type { DefiPosition_Interactable, DefiPosition_NonInteractable, } from '../../../alt-model/defi/open_position_hooks.js'; -import { Hyperlink, HyperlinkIcon, Tooltip, Button } from '../../../ui-components/index.js'; +import { Hyperlink, HyperlinkIcon, Tooltip } from '../../../ui-components/index.js'; import { useExplorerTxLink } from '../../../alt-model/explorer_link_hooks.js'; import { useWalletInteractionIsOngoing } from '../../../alt-model/wallet_interaction_hooks.js'; import { useRollupProviderStatus } from '../../../alt-model/index.js'; diff --git a/src/components/holdings_list/holding.tsx b/src/components/holdings_list/holding.tsx index 1df2cf21..4fcda8b2 100644 --- a/src/components/holdings_list/holding.tsx +++ b/src/components/holdings_list/holding.tsx @@ -1,6 +1,7 @@ import type { AssetValue } from '@aztec/sdk'; +import { Button, ButtonSize, ButtonTheme } from '@aztec/aztec-ui'; import { ReactComponent as Clock } from '../../ui-components/images/clock.svg'; -import { SkeletonRect, Button, ButtonTheme, ButtonSize } from '../../ui-components/index.js'; +import { SkeletonRect } from '../../ui-components/index.js'; import { formatBulkPrice } from '../../app/index.js'; import { useAmountBulkPrice, useSpendableBalance } from '../../alt-model/index.js'; import { RemoteAsset } from '../../alt-model/types.js'; diff --git a/src/components/report_error_button/report_error_button.tsx b/src/components/report_error_button/report_error_button.tsx index fe9cba0f..c3206e94 100644 --- a/src/components/report_error_button/report_error_button.tsx +++ b/src/components/report_error_button/report_error_button.tsx @@ -1,7 +1,7 @@ import { useState } from 'react'; +import { Button, ButtonSize, ButtonTheme } from '@aztec/aztec-ui'; import { confirmAndSendErrorReport, formatError } from '../../alt-model/errors/error_utils.js'; import { useSdk } from '../../alt-model/top_level_context/top_level_context_hooks.js'; -import { Button, ButtonSize, ButtonTheme } from '../../ui-components/index.js'; import style from './report_error_button.module.scss'; interface ReportErrorButtonProps { diff --git a/src/components/shield_more/shield_more.tsx b/src/components/shield_more/shield_more.tsx index 981c7fc4..4b367320 100644 --- a/src/components/shield_more/shield_more.tsx +++ b/src/components/shield_more/shield_more.tsx @@ -1,7 +1,8 @@ +import { Button } from '@aztec/aztec-ui'; import { useAccountStateManager } from '../../alt-model/top_level_context/top_level_context_hooks.js'; import { useWalletInteractionIsOngoing } from '../../alt-model/wallet_interaction_hooks.js'; import { useObs } from '../../app/util/index.js'; -import { Button, CardWrapper } from '../../ui-components/index.js'; +import { CardWrapper } from '../../ui-components/index.js'; import style from './shield_more.module.scss'; interface ShieldMoreProps { diff --git a/src/components/template/user_account_menu.tsx b/src/components/template/user_account_menu.tsx index 568cdb96..77a428ca 100644 --- a/src/components/template/user_account_menu.tsx +++ b/src/components/template/user_account_menu.tsx @@ -1,5 +1,6 @@ import { useContext, useEffect, useState } from 'react'; import { useNavigate } from 'react-router-dom'; +import { Button, ButtonTheme } from '@aztec/aztec-ui'; import { GrumpkinAddress } from '@aztec/sdk'; import { useCachedAlias } from '../../alt-model/alias_hooks.js'; import { TopLevelContext } from '../../alt-model/top_level_context/top_level_context.js'; @@ -10,7 +11,7 @@ import { useAccountStateManager, } from '../../alt-model/top_level_context/top_level_context_hooks.js'; import { useObs } from '../../app/util/index.js'; -import { Loader, Card, CardHeaderSize, Field, FieldStatus, Button, ButtonTheme } from '../../ui-components/index.js'; +import { Loader, Card, CardHeaderSize, Field, FieldStatus } from '../../ui-components/index.js'; import { Dot } from '../dot.js'; import { CloseButtonWhite } from '../index.js'; import { Modal } from '../modal.js'; diff --git a/src/components/transaction_history/transaction_history_section.tsx b/src/components/transaction_history/transaction_history_section.tsx index 8d6d6100..e009b05c 100644 --- a/src/components/transaction_history/transaction_history_section.tsx +++ b/src/components/transaction_history/transaction_history_section.tsx @@ -1,8 +1,9 @@ import download from '../../ui-components/images/download.svg'; import { ProofId, UserPaymentTx } from '@aztec/sdk'; +import { Button, ButtonSize, ButtonTheme } from '@aztec/aztec-ui'; import { useAccountStateManager, useSdk } from '../../alt-model/top_level_context/top_level_context_hooks.js'; import { useObs } from '../../app/util/index.js'; -import { Button, ButtonSize, ButtonTheme, Section, SectionTitle } from '../../ui-components/index.js'; +import { Section, SectionTitle } from '../../ui-components/index.js'; import { TransactionHistory } from './transaction_history.js'; import { useUserTxs } from '../../alt-model/user_tx_hooks.js'; diff --git a/src/components/wallet_interaction_toast/wallet_interaction_toast.tsx b/src/components/wallet_interaction_toast/wallet_interaction_toast.tsx index 1c55e50a..305c360f 100644 --- a/src/components/wallet_interaction_toast/wallet_interaction_toast.tsx +++ b/src/components/wallet_interaction_toast/wallet_interaction_toast.tsx @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react'; +import { Button, ButtonTheme } from '@aztec/aztec-ui'; import { ConnectButton } from '@rainbow-me/rainbowkit'; -import { Button, ButtonTheme } from '../../ui-components/index.js'; import { bindStyle } from '../../ui-components/util/classnames.js'; import { EnforcedRetryableSignInteractions } from '../../views/flow_interactions/enforced_retryable_sign_interactions.js'; import { L1DepositAndSignFlowState } from '../../alt-model/forms/l1_deposit/l1_deposit_and_sign_flow.js'; diff --git a/src/toolbox/signer_submit/signer_submit.tsx b/src/toolbox/signer_submit/signer_submit.tsx index 3b454407..5fcb0c56 100644 --- a/src/toolbox/signer_submit/signer_submit.tsx +++ b/src/toolbox/signer_submit/signer_submit.tsx @@ -1,6 +1,6 @@ +import { Button } from '@aztec/aztec-ui'; import type { Signer } from '@ethersproject/abstract-signer'; import { ConnectButton } from '@rainbow-me/rainbowkit'; -import { Button } from '../../ui-components/index.js'; import { useAccount, useSigner } from 'wagmi'; import style from './signer_submit.module.css'; diff --git a/src/ui-components/components/button/button.module.scss b/src/ui-components/components/button/button.module.scss deleted file mode 100644 index 19c19800..00000000 --- a/src/ui-components/components/button/button.module.scss +++ /dev/null @@ -1,105 +0,0 @@ -@use '../../styles/mixins.scss'; - -.button { - position: relative; - display: flex; - align-items: center; - justify-content: center; - line-height: 1; - cursor: pointer; - user-select: none; - padding: 16px 32px; - height: 48px; - border-radius: 10px; - transition: transform 0.2s, box-shadow 0.2s; - @include mixins.shadow_border; - - &:hover { - box-shadow: 0px 4px 10px rgb(0 0 0 / 15%); - transform: translateY(-1px); - } - - &:active { - box-shadow: 0px 4px 10px rgb(0 0 0 / 15%); - transform: translateY(0px); - } -} - -.secondary { - background: #ffffff; -} - -.primary { - background: #2f1f49; -} - -.image { - width: 14px; - height: 14px; -} - -.disabled { - opacity: 0.5; - cursor: not-allowed; - - &:hover { - transform: translateY(0px); - } -} - -.text { - letter-spacing: 1px; - white-space: break-spaces; - font-size: 14px; - line-height: 24px; - font-weight: 450; - align-items: center; - display: flex; - flex-direction: row; - gap: 10px; -} - -.primary > .text { - color: #ffffff; -} - -.secondary > .text { - color: #2f1f49; -} - -.outlined { - position: relative; - z-index: 1; - - &:before { - content: ''; - position: absolute; - border-radius: inherit; - top: 1px; - right: 1px; - bottom: 1px; - left: 1px; - z-index: -1; - } -} - -.loading { - cursor: default; - pointer-events: none; - - &:hover { - transform: translateY(0px); - } -} - -.large { - height: 44px; -} - -.medium { - height: 36px; -} - -.small { - height: 28px; -} diff --git a/src/ui-components/components/button/button.stories.tsx b/src/ui-components/components/button/button.stories.tsx deleted file mode 100644 index 3aeac0ca..00000000 --- a/src/ui-components/components/button/button.stories.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { ComponentMeta, ComponentStory } from '@storybook/react'; -import centered from '@storybook/addon-centered/react'; -import { Button, ButtonSize, ButtonTheme } from './button'; - -export default { - title: 'Button', - component: Button, - decorators: [centered], -} as ComponentMeta; - -const Story: ComponentStory = args =>