From 6a03e286c1bdff3fae126b817289a3fd3b0fb0a0 Mon Sep 17 00:00:00 2001 From: Xiao Yijun Date: Fri, 9 Dec 2022 12:19:25 +0800 Subject: [PATCH] refactor(console): support small-size `CopyToClipBoard` (#2617) --- .../CopyToClipboard/index.module.scss | 33 ++++++++++++++----- .../src/components/CopyToClipboard/index.tsx | 20 ++++++----- .../src/pages/ApiResourceDetails/index.tsx | 2 +- .../src/pages/ApplicationDetails/index.tsx | 2 +- .../console/src/pages/UserDetails/index.tsx | 2 +- 5 files changed, 40 insertions(+), 19 deletions(-) diff --git a/packages/console/src/components/CopyToClipboard/index.module.scss b/packages/console/src/components/CopyToClipboard/index.module.scss index 8a5daa2c2..8ec1bfd29 100644 --- a/packages/console/src/components/CopyToClipboard/index.module.scss +++ b/packages/console/src/components/CopyToClipboard/index.module.scss @@ -31,18 +31,35 @@ text-overflow: ellipsis; } + .copyToolTipAnchor { - margin-left: _.unit(3); + margin-left: _.unit(2); } + } - .copyIconButton { - height: 20px; - width: 20px; + &.default { + .row { + .copyToolTipAnchor { + margin-left: _.unit(3); + } + } + } - .copyIcon { - svg { - width: 16px; - height: 16px; + &.small { + .row { + .copyToolTipAnchor { + margin-left: _.unit(1); + } + + .iconButton { + height: 20px; + width: 20px; + + .icon { + svg { + width: 12px; + height: 12px; + } } } } diff --git a/packages/console/src/components/CopyToClipboard/index.tsx b/packages/console/src/components/CopyToClipboard/index.tsx index e72083e2a..4e840be80 100644 --- a/packages/console/src/components/CopyToClipboard/index.tsx +++ b/packages/console/src/components/CopyToClipboard/index.tsx @@ -18,6 +18,7 @@ type Props = { className?: string; variant?: 'text' | 'contained' | 'border' | 'icon'; hasVisibilityToggle?: boolean; + size?: 'default' | 'small'; }; type CopyState = TFuncKey<'translation', 'admin_console.general'>; @@ -27,6 +28,7 @@ const CopyToClipboard = ({ className, hasVisibilityToggle, variant = 'contained', + size = 'default', }: Props) => { const copyIconReference = useRef(null); const [copyState, setCopyState] = useState('copy'); @@ -59,7 +61,7 @@ const CopyToClipboard = ({ return (
{ @@ -72,11 +74,13 @@ const CopyToClipboard = ({
{variant !== 'icon' &&
{displayValue}
} {hasVisibilityToggle && ( -
- - {showHiddenContent ? : } - -
+ + {showHiddenContent ? : } + )} diff --git a/packages/console/src/pages/ApiResourceDetails/index.tsx b/packages/console/src/pages/ApiResourceDetails/index.tsx index 2f40825a2..8e07b4d93 100644 --- a/packages/console/src/pages/ApiResourceDetails/index.tsx +++ b/packages/console/src/pages/ApiResourceDetails/index.tsx @@ -117,7 +117,7 @@ const ApiResourceDetails = () => {
{data.name}
- +
{!isLogtoManagementApiResource && ( diff --git a/packages/console/src/pages/ApplicationDetails/index.tsx b/packages/console/src/pages/ApplicationDetails/index.tsx index 54e7c71a3..b6264809e 100644 --- a/packages/console/src/pages/ApplicationDetails/index.tsx +++ b/packages/console/src/pages/ApplicationDetails/index.tsx @@ -140,7 +140,7 @@ const ApplicationDetails = () => {
{t(`${applicationTypeI18nKey[data.type]}.title`)}
App ID
- +
diff --git a/packages/console/src/pages/UserDetails/index.tsx b/packages/console/src/pages/UserDetails/index.tsx index 79b1b6457..fe6e6797f 100644 --- a/packages/console/src/pages/UserDetails/index.tsx +++ b/packages/console/src/pages/UserDetails/index.tsx @@ -110,7 +110,7 @@ const UserDetails = () => { )}
User ID
- +