From 96e4b7bb9f46f8d9819c6294d731b876210215da Mon Sep 17 00:00:00 2001 From: Harsh Shukla <125105825+PrgrmrHarshShukla@users.noreply.github.com> Date: Sat, 29 Jul 2023 18:55:34 +0530 Subject: [PATCH] Replacing deprecated code in favor of component-library components (#20137) --- .../app/snaps/snap-content-footer/index.scss | 7 +--- .../snap-content-footer.js | 37 ++++++++++++++----- .../snap-content-footer.stories.js | 2 +- 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/ui/components/app/snaps/snap-content-footer/index.scss b/ui/components/app/snaps/snap-content-footer/index.scss index f337b26ad..b9a6e3cf2 100644 --- a/ui/components/app/snaps/snap-content-footer/index.scss +++ b/ui/components/app/snaps/snap-content-footer/index.scss @@ -1,8 +1,5 @@ .snap-content-footer { - .button { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - width: 100px; + &__description { + max-width: 100%; // helps with snap name truncation } } diff --git a/ui/components/app/snaps/snap-content-footer/snap-content-footer.js b/ui/components/app/snaps/snap-content-footer/snap-content-footer.js index f8b31826a..c0c90e8fb 100644 --- a/ui/components/app/snaps/snap-content-footer/snap-content-footer.js +++ b/ui/components/app/snaps/snap-content-footer/snap-content-footer.js @@ -3,20 +3,26 @@ import PropTypes from 'prop-types'; import { useHistory } from 'react-router-dom'; -import Typography from '../../../ui/typography/typography'; import { useI18nContext } from '../../../../hooks/useI18nContext'; import { SNAPS_VIEW_ROUTE } from '../../../../helpers/constants/routes'; import { - TypographyVariant, + TextVariant, JustifyContent, AlignItems, TextColor, Size, IconColor, + Display, } from '../../../../helpers/constants/design-system'; -import Button from '../../../ui/button'; -import Box from '../../../ui/box/box'; -import { Icon, IconName } from '../../../component-library'; +import { + BUTTON_SIZES, + BUTTON_VARIANT, + Box, + Button, + Icon, + IconName, + Text, +} from '../../../component-library'; export default function SnapContentFooter({ snapName, snapId }) { const t = useI18nContext(); @@ -26,9 +32,10 @@ export default function SnapContentFooter({ snapName, snapId }) { e.stopPropagation(); history.push(`${SNAPS_VIEW_ROUTE}/${encodeURIComponent(snapId)}`); }; - // TODO: add truncation to the snap name, need to pick a character length at which to cut off + return ( - + {t('snapContent', [ - , ])} - + ); } diff --git a/ui/components/app/snaps/snap-content-footer/snap-content-footer.stories.js b/ui/components/app/snaps/snap-content-footer/snap-content-footer.stories.js index 95ef47797..2d789f2c1 100644 --- a/ui/components/app/snaps/snap-content-footer/snap-content-footer.stories.js +++ b/ui/components/app/snaps/snap-content-footer/snap-content-footer.stories.js @@ -7,7 +7,7 @@ export default { component: SnapContentFooter, args: { - snapName: 'Test Snap', + snapName: 'Really Long Test Snap Name', snapId: 'local:test-snap', }, };