- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.4k
chore: remove deprecated ErrorMessage component #36872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
af597c5
              ddfbe83
              d01f9bc
              c4da056
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -7,7 +7,6 @@ import { | |
| import { useI18nContext } from '../../../../hooks/useI18nContext'; | ||
| import { useTransactionModalContext } from '../../../../contexts/transaction-modal'; | ||
| import Box from '../../../../components/ui/box'; | ||
| import ErrorMessage from '../../../../components/ui/error-message'; | ||
| import Popover from '../../../../components/ui/popover'; | ||
|  | ||
| import { | ||
|  | @@ -18,7 +17,11 @@ import { INSUFFICIENT_FUNDS_ERROR_KEY } from '../../../../helpers/constants/erro | |
| import { useGasFeeContext } from '../../../../contexts/gasFee'; | ||
| import AppLoadingSpinner from '../../../../components/app/app-loading-spinner'; | ||
| import ZENDESK_URLS from '../../../../helpers/constants/zendesk-url'; | ||
| import { Text } from '../../../../components/component-library'; | ||
| import { | ||
| BannerAlert, | ||
| BannerAlertSeverity, | ||
| Text, | ||
| } from '../../../../components/component-library'; | ||
| import EditGasItem from './edit-gas-item'; | ||
| import NetworkStatistics from './network-statistics'; | ||
|  | ||
|  | @@ -55,7 +58,11 @@ const EditGasFeePopover = () => { | |
| <div className="edit-gas-fee-popover__content"> | ||
| <Box> | ||
| {balanceError && ( | ||
| <ErrorMessage errorKey={INSUFFICIENT_FUNDS_ERROR_KEY} /> | ||
| <BannerAlert | ||
| severity={BannerAlertSeverity.Danger} | ||
| description={t(INSUFFICIENT_FUNDS_ERROR_KEY)} | ||
| marginBottom={1} | ||
| /> | ||
| 
      Comment on lines
    
      -58
     to 
      +65
    
   There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. | ||
| )} | ||
| <div className="edit-gas-fee-popover__content__header"> | ||
| <span className="edit-gas-fee-popover__content__header-option"> | ||
|  | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| import React from 'react'; | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding story | ||
| import { Provider } from 'react-redux'; | ||
| import { Meta, StoryObj } from '@storybook/react'; | ||
| import mockState from '../../../../../test/data/mock-state.json'; | ||
| import configureStore from '../../../../store/store'; | ||
| import { GasFeeContextProvider } from '../../../../contexts/gasFee'; | ||
| import { TransactionModalContext } from '../../../../contexts/transaction-modal'; | ||
| import { | ||
| EditGasModes, | ||
| PriorityLevels, | ||
| } from '../../../../../shared/constants/gas'; | ||
| import { decGWEIToHexWEI } from '../../../../../shared/modules/conversion.utils'; | ||
| import EditGasFeePopover from './edit-gas-fee-popover'; | ||
|  | ||
| const store = configureStore({ | ||
| ...mockState, | ||
| metamask: { | ||
| ...mockState.metamask, | ||
| featureFlags: { | ||
| ...mockState.metamask.featureFlags, | ||
| advancedInlineGas: true, | ||
| }, | ||
| }, | ||
| }); | ||
|  | ||
| type MockTransactionModalProviderProps = { | ||
| children: React.ReactNode; | ||
| }; | ||
|  | ||
| const MockTransactionModalProvider: React.FC< | ||
| MockTransactionModalProviderProps | ||
| > = ({ children }) => { | ||
| return ( | ||
| <TransactionModalContext.Provider | ||
| value={{ | ||
| closeModal: () => undefined, | ||
| closeAllModals: () => undefined, | ||
| currentModal: 'editGasFee', | ||
| openModal: () => undefined, | ||
| openModalCount: 1, | ||
| }} | ||
| > | ||
| {children} | ||
| </TransactionModalContext.Provider> | ||
| ); | ||
| }; | ||
|  | ||
| const createTransaction = (editGasMode = EditGasModes.modifyInPlace) => ({ | ||
| userFeeLevel: PriorityLevels.medium, | ||
| txParams: { | ||
| maxFeePerGas: decGWEIToHexWEI('70'), | ||
| maxPriorityFeePerGas: decGWEIToHexWEI('7'), | ||
| gas: '0x5208', | ||
| gasPrice: decGWEIToHexWEI('50'), | ||
| type: '0x2', | ||
| from: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc', | ||
| to: '0xc42edfcc21ed14dda456aa0756c153f7985d8813', | ||
| }, | ||
| chainId: '0x5', // Use Goerli from mock state | ||
| editGasMode, | ||
| }); | ||
|  | ||
| interface StoryArgs { | ||
| editGasMode: EditGasModes; | ||
| } | ||
|  | ||
| const meta: Meta<StoryArgs> = { | ||
| title: 'Pages/Confirmations/Components/EditGasFeePopover', | ||
| component: EditGasFeePopover, | ||
| decorators: [ | ||
| (Story, context) => ( | ||
| <Provider store={store}> | ||
| <MockTransactionModalProvider> | ||
| <GasFeeContextProvider | ||
| transaction={createTransaction(context.args.editGasMode)} | ||
| editGasMode={context.args.editGasMode} | ||
| > | ||
| <Story /> | ||
| </GasFeeContextProvider> | ||
| </MockTransactionModalProvider> | ||
| </Provider> | ||
| ), | ||
| ], | ||
| }; | ||
|  | ||
| export default meta; | ||
|  | ||
| type Story = StoryObj<StoryArgs>; | ||
|  | ||
| export const Default: Story = { | ||
| args: { | ||
| editGasMode: EditGasModes.modifyInPlace, | ||
| }, | ||
| }; | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -13,11 +13,6 @@ | |
| justify-content: space-between; | ||
| padding: 16px 12px; | ||
|  | ||
| & .error-message { | ||
| margin-top: 0; | ||
| margin-bottom: 12px; | ||
| } | ||
| 
      Comment on lines
    
      -16
     to 
      -19
    
   There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no longer using this component. this is why we shouldn't use direct CSS classnames from other components in our styles. Very easy to miss | ||
|  | ||
| &__header { | ||
| color: var(--color-text-alternative); | ||
| font-size: 10px; | ||
|  | ||


Uh oh!
There was an error while loading. Please reload this page.