From 88963b03a18abed2f2a99c897e16bbfc907f9c08 Mon Sep 17 00:00:00 2001 From: Luke Schoen Date: Tue, 11 Sep 2018 07:52:55 +0200 Subject: [PATCH] fix: Part fix #264. Remove end space. Use consistent monospace (#291) * fix: Part fix #264. Trim address. Add CopyButton. Align CopyButton with monospace * fix: Remove CopyButton * fix: Add empty div so double clicking to copy address only selects the address itself * fix: Add key prop to div to avoid error * fix: Add PostCSS Mixins. Reuse font family for hashes. Add missing license header. * Add PostCSS Mixins dependency to allow reuse to make CSS DRYer * Create generic mixin for common font family used by different hashes displayed in UI (i.e. block, data, address) * Create extension of the generic mixin for the block hash * Add missing license header * fix: Rename mixin to hash font traits * fix: Remove hash-block-font-family since we are only using it once * fix: Revert Mixins and variable --- packages/ui-app/src/Params/Params.css | 4 ++++ packages/ui-app/src/Params/valueToText.tsx | 6 ++++-- packages/ui-app/src/styles/components.css | 2 -- packages/ui-app/src/styles/partials/_variables.css | 4 ++++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/ui-app/src/Params/Params.css b/packages/ui-app/src/Params/Params.css index 151b4e3c37..ed0d11bef2 100644 --- a/packages/ui-app/src/Params/Params.css +++ b/packages/ui-app/src/Params/Params.css @@ -2,6 +2,10 @@ /* This software may be modified and distributed under the terms /* of the ISC license. See the LICENSE file for details. */ +.ui--Param-Address { + font-family: monospace; +} + .ui--Params-Content { box-sizing: border-box; padding-left: 2em; diff --git a/packages/ui-app/src/Params/valueToText.tsx b/packages/ui-app/src/Params/valueToText.tsx index 4b8adfec9d..f7cb59b9a9 100644 --- a/packages/ui-app/src/Params/valueToText.tsx +++ b/packages/ui-app/src/Params/valueToText.tsx @@ -51,7 +51,9 @@ function accountToText (_address: string | Uint8Array): React.ReactNode { size={24} value={address} />, - div({ key: 'address' }, address) + div({ key: 'address', className: 'ui--Param-Address' }, address), + // Empty div so double clicking on the address only selects the address +
); } @@ -123,7 +125,7 @@ function valueToText (type: Param$Types, value: any, swallowError: boolean = tru if (type === 'AccountId') { return value && value.length - ? accountToText(value as string) + ? accountToText(value.trim() as string) : unknown; } diff --git a/packages/ui-app/src/styles/components.css b/packages/ui-app/src/styles/components.css index 7462ac9f4a..f0e710dde7 100644 --- a/packages/ui-app/src/styles/components.css +++ b/packages/ui-app/src/styles/components.css @@ -2,8 +2,6 @@ /* This software may be modified and distributed under the terms /* of the ISC license. See the LICENSE file for details. */ -@import 'partials/_variables.css'; - .ui--output { background: #f9f9f9; border-radius: 4px; diff --git a/packages/ui-app/src/styles/partials/_variables.css b/packages/ui-app/src/styles/partials/_variables.css index 17a8b645b8..4a7db9f82a 100644 --- a/packages/ui-app/src/styles/partials/_variables.css +++ b/packages/ui-app/src/styles/partials/_variables.css @@ -1,3 +1,7 @@ +/* Copyright 2017-2018 @polkadot/ui-app authors & contributors +/* This software may be modified and distributed under the terms +/* of the ISC license. See the LICENSE file for details. */ + $small-corner: .28571429rem; $green: #77c689;