From 1bedf33e3da5ebd61f1416e3e842fc9c6afb5ff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 18 Jul 2022 17:23:49 +0200 Subject: [PATCH] ServiceAccount: New service account modal to follow design system (#52373) * ServiceAccount: New service account modal to follow design system * Fixing spacing and removing double Field label * Fixing imports * Update comment --- .../components/CreateTokenModal.tsx | 137 +++++++----------- 1 file changed, 53 insertions(+), 84 deletions(-) diff --git a/public/app/features/serviceaccounts/components/CreateTokenModal.tsx b/public/app/features/serviceaccounts/components/CreateTokenModal.tsx index ba48c05a717..5a90a71839b 100644 --- a/public/app/features/serviceaccounts/components/CreateTokenModal.tsx +++ b/public/app/features/serviceaccounts/components/CreateTokenModal.tsx @@ -8,11 +8,7 @@ import { ClipboardButton, DatePickerWithInput, Field, - FieldSet, - HorizontalGroup, - Icon, Input, - Label, Modal, RadioButtonGroup, useStyles2, @@ -76,12 +72,7 @@ export const CreateTokenModal = ({ isOpen, token, serviceAccountLogin, onCreateT onClose(); }; - const modalTitle = ( -
- - {!token ? 'Add service account token' : 'Service account token created'} -
- ); + const modalTitle = !token ? 'Add service account token' : 'Service account token created'; return ( {!token ? (
-
- - { - setNewTokenName(e.currentTarget.value); - }} - /> - + + { + setNewTokenName(e.currentTarget.value); + }} + /> + + - {isWithExpirationDate && ( - - - - )} -
- + + {isWithExpirationDate && ( + + + + )} + + +
) : ( <> -
- - -
- - token} - > - Copy to clipboard - -
-
-
- + +
+ + token} + > + Copy clipboard + +
+
+ token} onClipboardCopy={onCloseInternal}> Copy to clipboard and close -
+ )}
@@ -185,29 +172,11 @@ const getStyles = (theme: GrafanaTheme2) => { modalContent: css` overflow: visible; `, - modalRow: css` - margin-bottom: ${theme.spacing(4)}; - `, modalTokenRow: css` display: flex; `, modalCopyToClipboardButton: css` margin-left: ${theme.spacing(0.5)}; `, - modalHeaderTitle: css` - font-size: ${theme.typography.size.lg}; - margin: ${theme.spacing(0, 4, 0, 1)}; - display: flex; - align-items: center; - position: relative; - top: 2px; - `, - modalHeaderIcon: css` - margin-right: ${theme.spacing(2)}; - font-size: inherit; - &:before { - vertical-align: baseline; - } - `, }; };