From 239f5f7fa60a05f3b98eb00a9bbb7d27ee48eed1 Mon Sep 17 00:00:00 2001 From: Frederik Bolding Date: Thu, 2 Jun 2022 11:38:39 +0200 Subject: [PATCH] Include snap version in pill (#14803) * Include snap version in pill * snaps authorship styling * styling * Fix linting * Fix linting Co-authored-by: eriknson --- .../flask/snaps-authorship-pill/index.scss | 15 +++++++++- .../snaps-authorship-pill.js | 29 ++++++++++++++++++- .../permissions-connect-header.component.js | 29 ++----------------- .../flask/snap-install/index.scss | 4 --- 4 files changed, 44 insertions(+), 33 deletions(-) diff --git a/ui/components/app/flask/snaps-authorship-pill/index.scss b/ui/components/app/flask/snaps-authorship-pill/index.scss index a67d876d7..90f4fa21b 100644 --- a/ui/components/app/flask/snaps-authorship-pill/index.scss +++ b/ui/components/app/flask/snaps-authorship-pill/index.scss @@ -3,6 +3,10 @@ .snaps-authorship-pill { display: inline-block; + .chip { + padding-right: 8px; + } + &:hover, &:focus { .chip { @@ -12,5 +16,14 @@ } .snaps-authorship-icon { - color: var(--color-icon-default); + color: var(--color-icon-alternative); +} + +.snaps-authorship-version { + border-radius: 100px; + line-height: 100%; +} + +.snaps-authorship-version > span { + vertical-align: middle; } diff --git a/ui/components/app/flask/snaps-authorship-pill/snaps-authorship-pill.js b/ui/components/app/flask/snaps-authorship-pill/snaps-authorship-pill.js index 86f040025..81eb07e1b 100644 --- a/ui/components/app/flask/snaps-authorship-pill/snaps-authorship-pill.js +++ b/ui/components/app/flask/snaps-authorship-pill/snaps-authorship-pill.js @@ -7,11 +7,13 @@ import Typography from '../../../ui/typography'; import { COLORS, TYPOGRAPHY, + TEXT_ALIGN, } from '../../../../helpers/constants/design-system'; +import { useI18nContext } from '../../../../hooks/useI18nContext'; const snapIdPrefixes = ['npm:', 'local:']; -const SnapsAuthorshipPill = ({ snapId, className }) => { +const SnapsAuthorshipPill = ({ snapId, version, className }) => { // @todo Use getSnapPrefix from snaps-skunkworks when possible const snapPrefix = snapIdPrefixes.find((prefix) => snapId.startsWith(prefix)); const packageName = snapId.replace(snapPrefix, ''); @@ -20,6 +22,7 @@ const SnapsAuthorshipPill = ({ snapId, className }) => { ? `https://www.npmjs.com/package/${packageName}` : packageName; const icon = isNPM ? 'fab fa-npm fa-lg' : 'fas fa-code'; + const t = useI18nContext(); return ( { } + rightIcon={ + version && ( + + + {t('shorthandVersion', [version])} + + + ) + } backgroundColor={COLORS.BACKGROUND_DEFAULT} > {headerTitle} { ///: BEGIN:ONLY_INCLUDE_IN(flask) - isSnapInstall && - ///: END:ONLY_INCLUDE_IN - } - { - ///: BEGIN:ONLY_INCLUDE_IN(flask) - snapVersion && ( - - {t('shorthandVersion', [snapVersion])} - + isSnapInstall && ( + ) ///: END:ONLY_INCLUDE_IN } diff --git a/ui/pages/permissions-connect/flask/snap-install/index.scss b/ui/pages/permissions-connect/flask/snap-install/index.scss index 53e525acb..87047ec05 100644 --- a/ui/pages/permissions-connect/flask/snap-install/index.scss +++ b/ui/pages/permissions-connect/flask/snap-install/index.scss @@ -22,10 +22,6 @@ } } - .version { - font-family: monospace; - } - .page-container__footer { width: 100%; margin-top: 12px;