Skip to content

Commit

Permalink
Migrating Icon to typescript and deprecating JS component (#18431)
Browse files Browse the repository at this point in the history
* Migrating Icon to typescript and deprecating JS component

* gw suggestions (#18434)

---------

Co-authored-by: Garrett Bear <gwhisten@gmail.com>
  • Loading branch information
georgewrmarshall and garrettbear authored Apr 4, 2023
1 parent 6e40a0e commit 7390756
Show file tree
Hide file tree
Showing 155 changed files with 834 additions and 391 deletions.
6 changes: 5 additions & 1 deletion ui/components/app/account-menu/account-menu.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ import Button from '../../ui/button';
import SearchIcon from '../../ui/icon/search-icon';
import { SUPPORT_LINK } from '../../../../shared/lib/ui-utils';
import { IconColor } from '../../../helpers/constants/design-system';
import { Icon, ICON_NAMES, ICON_SIZES } from '../../component-library';
import {
Icon,
ICON_NAMES,
ICON_SIZES,
} from '../../component-library/icon/deprecated';
import KeyRingLabel from './keyring-label';

export function AccountMenuItem(props) {
Expand Down
7 changes: 6 additions & 1 deletion ui/components/app/add-network/add-network.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ import { FEATURED_RPCS } from '../../../../shared/constants/network';
import { ADD_NETWORK_ROUTE } from '../../../helpers/constants/routes';
import { getEnvironmentType } from '../../../../app/scripts/lib/util';
import ZENDESK_URLS from '../../../helpers/constants/zendesk-url';
import { Icon, ICON_NAMES, ICON_SIZES, Text } from '../../component-library';
import { Text } from '../../component-library';
import {
Icon,
ICON_NAMES,
ICON_SIZES,
} from '../../component-library/icon/deprecated';
import { MetaMetricsNetworkEventSource } from '../../../../shared/constants/metametrics';

const AddNetwork = () => {
Expand Down
1 change: 0 additions & 1 deletion ui/components/app/add-network/add-network.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const BSC_IMAGE_URL = './images/bsc-filled.svg';

export default {
title: 'Components/App/AddNetwork',

argTypes: {
onBackClick: {
action: 'onBackClick',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Icon, ICON_NAMES } from '../../component-library';
import { Icon, ICON_NAMES } from '../../component-library/icon/deprecated';
import ApproveContentCard from './approve-content-card';

export default {
Expand Down
6 changes: 5 additions & 1 deletion ui/components/app/asset-list-item/asset-list-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ import { INVALID_ASSET_TYPE } from '../../../helpers/constants/error-keys';
import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics';
import { AssetType } from '../../../../shared/constants/transaction';
import { MetaMetricsContext } from '../../../contexts/metametrics';
import { Icon, ICON_NAMES, ICON_SIZES } from '../../component-library';
import {
Icon,
ICON_NAMES,
ICON_SIZES,
} from '../../component-library/icon/deprecated';
import Box from '../../ui/box/box';

const AssetListItem = ({
Expand Down
6 changes: 5 additions & 1 deletion ui/components/app/beta-header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ import {
import { BETA_BUGS_URL } from '../../../helpers/constants/beta';

import { hideBetaHeader } from '../../../store/actions';
import { ButtonIcon, ICON_NAMES, ICON_SIZES } from '../../component-library';
import { ButtonIcon } from '../../component-library';
import {
ICON_NAMES,
ICON_SIZES,
} from '../../component-library/icon/deprecated';

const BetaHeader = () => {
const t = useI18nContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Identicon from '../../../ui/identicon';
import { shortenAddress } from '../../../../helpers/utils/util';
import AccountMismatchWarning from '../../../ui/account-mismatch-warning/account-mismatch-warning.component';
import { useI18nContext } from '../../../../hooks/useI18nContext';
import { Icon, ICON_NAMES } from '../../../component-library';
import { Icon, ICON_NAMES } from '../../../component-library/icon/deprecated';

export default function ConfirmPageContainerHeader({
onEdit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ import {
AlignItems,
IconColor,
} from '../../../helpers/constants/design-system';
import { Text, Icon, ICON_NAMES, ICON_SIZES } from '../../component-library';
import {
Icon,
ICON_NAMES,
ICON_SIZES,
} from '../../component-library/icon/deprecated';
import { Text } from '../../component-library';

const ConfirmationWarningModal = ({ onSubmit, onCancel }) => {
const t = useI18nContext();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import PropTypes from 'prop-types';
import React, { useRef } from 'react';
import { Menu } from '../../../ui/menu';
import { ButtonIcon, ICON_NAMES } from '../../../component-library';
import { ICON_NAMES } from '../../../component-library/icon/deprecated';
import { ButtonIcon } from '../../../component-library';
import { useI18nContext } from '../../../../hooks/useI18nContext';

const ConnectedAccountsListOptions = ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React, { PureComponent } from 'react';
import { ICON_NAMES } from '../../component-library';
import { ICON_NAMES } from '../../component-library/icon/deprecated';
import { MenuItem } from '../../ui/menu';
import ConnectedAccountsListItem from './connected-accounts-list-item';
import ConnectedAccountsListOptions from './connected-accounts-list-options';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import {
DISPLAY,
TypographyVariant,
} from '../../../helpers/constants/design-system';
import { Icon, ICON_NAMES, ICON_SIZES } from '../../component-library';
import {
Icon,
ICON_NAMES,
ICON_SIZES,
} from '../../component-library/icon/deprecated';

export const CustomSpendingCapTooltip = ({
tooltipContentText,
Expand Down
3 changes: 2 additions & 1 deletion ui/components/app/custom-spending-cap/custom-spending-cap.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { I18nContext } from '../../../contexts/i18n';
import Box from '../../ui/box';
import FormField from '../../ui/form-field';
import Typography from '../../ui/typography';
import { ButtonLink, Icon, ICON_NAMES } from '../../component-library';
import { Icon, ICON_NAMES } from '../../component-library/icon/deprecated';
import { ButtonLink } from '../../component-library';
import {
AlignItems,
DISPLAY,
Expand Down
5 changes: 3 additions & 2 deletions ui/components/app/dropdowns/network-dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ import {
ADD_POPULAR_CUSTOM_NETWORK,
ADVANCED_ROUTE,
} from '../../../helpers/constants/routes';
import { ButtonIcon } from '../../component-library';
import {
Icon,
ButtonIcon,
ICON_NAMES,
ICON_SIZES,
} from '../../component-library';
} from '../../component-library/icon/deprecated';

import { Dropdown, DropdownMenuItem } from './dropdown';

// classes from nodes of the toggle element.
Expand Down
6 changes: 5 additions & 1 deletion ui/components/app/edit-gas-fee-button/edit-gas-fee-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ import { useTransactionEventFragment } from '../../../hooks/useTransactionEventF
import { useTransactionModalContext } from '../../../contexts/transaction-modal';
import InfoTooltip from '../../ui/info-tooltip/info-tooltip';
import Typography from '../../ui/typography/typography';
import { Icon, ICON_NAMES, ICON_SIZES } from '../../component-library';
import {
Icon,
ICON_NAMES,
ICON_SIZES,
} from '../../component-library/icon/deprecated';

export default function EditGasFeeButton({ userAcknowledgedGasMissing }) {
const t = useI18nContext();
Expand Down
6 changes: 5 additions & 1 deletion ui/components/app/flask/copyable/copyable.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ import {
Color,
} from '../../../../helpers/constants/design-system';
import { useCopyToClipboard } from '../../../../hooks/useCopyToClipboard';
import { Icon, ICON_NAMES, ICON_SIZES } from '../../../component-library';
import {
Icon,
ICON_NAMES,
ICON_SIZES,
} from '../../../component-library/icon/deprecated';

export const Copyable = ({ text }) => {
const [copied, handleCopy] = useCopyToClipboard();
Expand Down
5 changes: 2 additions & 3 deletions ui/components/app/flask/snap-authorship/snap-authorship.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ import {
getSnapName,
removeSnapIdPrefix,
} from '../../../../helpers/utils/util';
import { Text, ButtonIcon } from '../../../component-library';
import {
ICON_NAMES,
ICON_SIZES,
Text,
ButtonIcon,
} from '../../../component-library';
} from '../../../component-library/icon/deprecated';
import { getTargetSubjectMetadata } from '../../../../selectors';
import SnapAvatar from '../snap-avatar';

Expand Down
6 changes: 4 additions & 2 deletions ui/components/app/flask/snap-avatar/snap-avatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ import {
AvatarFavicon,
BadgeWrapper,
BadgeWrapperPosition,
ICON_NAMES,
ICON_SIZES,
AvatarIcon,
AvatarBase,
} from '../../../component-library';
import {
ICON_NAMES,
ICON_SIZES,
} from '../../../component-library/icon/deprecated';
import { getTargetSubjectMetadata } from '../../../../selectors';

const SnapAvatar = ({ snapId, className }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
} from '../../../../helpers/constants/design-system';
import Button from '../../../ui/button';
import Box from '../../../ui/box/box';
import { Icon, ICON_NAMES } from '../../../component-library';
import { Icon, ICON_NAMES } from '../../../component-library/icon/deprecated';

export default function SnapContentFooter({ snapName, snapId }) {
const t = useI18nContext();
Expand Down
5 changes: 2 additions & 3 deletions ui/components/app/flask/snap-delineator/snap-delineator.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ import {
TextColor,
} from '../../../../helpers/constants/design-system';
import Box from '../../../ui/box';
import { AvatarIcon, Text } from '../../../component-library';
import {
AvatarIcon,
ICON_NAMES,
ICON_SIZES,
Text,
} from '../../../component-library';
} from '../../../component-library/icon/deprecated';
import {
DelineatorType,
getDelineatorTitle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import {
} from '../../../../helpers/constants/design-system';
import Popover from '../../../ui/popover';
import Button from '../../../ui/button';
import { AvatarIcon, ICON_NAMES, Text } from '../../../component-library';
import { AvatarIcon, Text } from '../../../component-library';
import { ICON_NAMES } from '../../../component-library/icon/deprecated';
import Box from '../../../ui/box/box';

/**
Expand Down
2 changes: 1 addition & 1 deletion ui/components/app/menu-bar/account-options-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
MetaMetricsEventName,
} from '../../../../shared/constants/metametrics';
import { MetaMetricsContext } from '../../../contexts/metametrics';
import { ICON_NAMES } from '../../component-library';
import { ICON_NAMES } from '../../component-library/icon/deprecated';

export default function AccountOptionsMenu({ anchorElement, onClose }) {
const t = useI18nContext();
Expand Down
3 changes: 2 additions & 1 deletion ui/components/app/menu-bar/menu-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import { CONNECTED_ACCOUNTS_ROUTE } from '../../../helpers/constants/routes';
import { useI18nContext } from '../../../hooks/useI18nContext';
import { getOriginOfCurrentTab } from '../../../selectors';
import { MetaMetricsContext } from '../../../contexts/metametrics';
import { ButtonIcon, ICON_NAMES } from '../../component-library';
import { ButtonIcon } from '../../component-library';
import { ICON_NAMES } from '../../component-library/icon/deprecated';
import { GlobalMenu } from '../../multichain/global-menu';
import AccountOptionsMenu from './account-options-menu';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ import { useCopyToClipboard } from '../../../../hooks/useCopyToClipboard';
import { getAddressBookEntry } from '../../../../selectors';
import { TokenStandard } from '../../../../../shared/constants/transaction';
import NftCollectionImage from '../../../ui/nft-collection-image/nft-collection-image';
import { ButtonIcon, ICON_NAMES } from '../../../component-library';
import { ButtonIcon } from '../../../component-library';
import { ICON_NAMES } from '../../../component-library/icon/deprecated';

export default function ContractDetailsModal({
onClose,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ import Box from '../../../ui/box';
import withModalProps from '../../../../helpers/higher-order-components/with-modal-props';
import { useI18nContext } from '../../../../hooks/useI18nContext';
import ZENDESK_URLS from '../../../../helpers/constants/zendesk-url';
import { ButtonIcon, ICON_NAMES, ICON_SIZES } from '../../../component-library';
import { ButtonIcon } from '../../../component-library';
import {
ICON_NAMES,
ICON_SIZES,
} from '../../../component-library/icon/deprecated';

const CustomizeNonce = ({
hideModal,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import {
calcTokenAmount,
toPrecisionWithoutTrailingZeros,
} from '../../../../../shared/lib/transactions-controller-utils';
import { ButtonIcon, ICON_SIZES, ICON_NAMES } from '../../../component-library';
import { ButtonIcon } from '../../../component-library';
import {
ICON_SIZES,
ICON_NAMES,
} from '../../../component-library/icon/deprecated';

const MAX_UNSIGNED_256_INT = new BigNumber(2).pow(256).minus(1).toString(10);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
Button,
BUTTON_TYPES,
ButtonIcon,
ICON_NAMES,
} from '../../../component-library';
import { ICON_NAMES } from '../../../component-library/icon/deprecated';
import {
AlignItems,
DISPLAY,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Button from '../../../ui/button/button.component';
import { ButtonIcon, ICON_NAMES } from '../../../component-library';
import { ButtonIcon } from '../../../component-library';
import { ICON_NAMES } from '../../../component-library/icon/deprecated';

export default class NewAccountModal extends Component {
static contextTypes = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import Modal from '../../modal';
import { Icon, ICON_NAMES, ICON_SIZES } from '../../../component-library';
import {
Icon,
ICON_NAMES,
ICON_SIZES,
} from '../../../component-library/icon/deprecated';
import { IconColor } from '../../../../helpers/constants/design-system';

export default class TransactionConfirmed extends PureComponent {
Expand Down
6 changes: 5 additions & 1 deletion ui/components/app/network-display/network-display.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ import {
import Chip from '../../ui/chip/chip';
import { useI18nContext } from '../../../hooks/useI18nContext';
import { isNetworkLoading } from '../../../selectors';
import { Icon, ICON_NAMES, ICON_SIZES } from '../../component-library';
import {
Icon,
ICON_NAMES,
ICON_SIZES,
} from '../../component-library/icon/deprecated';

export default function NetworkDisplay({
indicatorSize,
Expand Down
3 changes: 2 additions & 1 deletion ui/components/app/nft-details/nft-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ import {
TokenStandard,
} from '../../../../shared/constants/transaction';
import NftDefaultImage from '../nft-default-image';
import { ButtonIcon, ICON_NAMES } from '../../component-library';
import { ButtonIcon } from '../../component-library';
import { ICON_NAMES } from '../../component-library/icon/deprecated';
import Tooltip from '../../ui/tooltip';
import { decWEIToDecETH } from '../../../../shared/modules/conversion.utils';

Expand Down
3 changes: 2 additions & 1 deletion ui/components/app/nft-options/nft-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import PropTypes from 'prop-types';

import { I18nContext } from '../../../contexts/i18n';
import { Menu, MenuItem } from '../../ui/menu';
import { ButtonIcon, ICON_NAMES } from '../../component-library';
import { ButtonIcon } from '../../component-library';
import { ICON_NAMES } from '../../component-library/icon/deprecated';
import { Color } from '../../../helpers/constants/design-system';

const NftOptions = ({ onRemove, onViewOnOpensea }) => {
Expand Down
2 changes: 1 addition & 1 deletion ui/components/app/nfts-items/nfts-items.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { updateNftDropDownState } from '../../../store/actions';
import { usePrevious } from '../../../hooks/usePrevious';
import { getNftsDropdownState } from '../../../ducks/metamask/metamask';
import { useI18nContext } from '../../../hooks/useI18nContext';
import { Icon, ICON_NAMES } from '../../component-library';
import { Icon, ICON_NAMES } from '../../component-library/icon/deprecated';
import NftDefaultImage from '../nft-default-image';

const width =
Expand Down
5 changes: 2 additions & 3 deletions ui/components/app/permission-cell/permission-cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ import {
TextColor,
TextVariant,
} from '../../../helpers/constants/design-system';
import { AvatarIcon, Text } from '../../component-library';
import {
AvatarIcon,
Icon,
ICON_NAMES,
ICON_SIZES,
Text,
} from '../../component-library';
} from '../../component-library/icon/deprecated';
import { formatDate } from '../../../helpers/utils/util';
import { useI18nContext } from '../../../hooks/useI18nContext';
import Tooltip from '../../ui/tooltip';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import { shortenAddress } from '../../../helpers/utils/util';
import Tooltip from '../../ui/tooltip';
import { toChecksumHexAddress } from '../../../../shared/modules/hexstring-utils';
import { SECOND } from '../../../../shared/constants/time';
import { Icon, ICON_NAMES, ICON_SIZES } from '../../component-library';
import {
Icon,
ICON_NAMES,
ICON_SIZES,
} from '../../component-library/icon/deprecated';
import { IconColor } from '../../../helpers/constants/design-system';

class SelectedAccount extends Component {
Expand Down
Loading

0 comments on commit 7390756

Please sign in to comment.