From: Kevin Silva Date: Mon, 17 Jul 2023 14:02:38 +0000 (+0200) Subject: SONAR-19923 Onboarding Tutorial - Token modal X-Git-Tag: 10.2.0.77647~319 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=614553f4d0b7ca613855cda736bf067557cc6de0;p=sonarqube.git SONAR-19923 Onboarding Tutorial - Token modal --- diff --git a/server/sonar-web/design-system/src/components/modal/Modal.tsx b/server/sonar-web/design-system/src/components/modal/Modal.tsx index db54a652555..c2e1ce8ed6a 100644 --- a/server/sonar-web/design-system/src/components/modal/Modal.tsx +++ b/server/sonar-web/design-system/src/components/modal/Modal.tsx @@ -38,6 +38,7 @@ interface CommonProps { closeOnOverlayClick?: boolean; isLarge?: boolean; isOpen?: boolean; + isOverflowVisible?: boolean; isScrollable?: boolean; onClose: VoidFunction; } @@ -77,6 +78,7 @@ export function Modal({ closeOnOverlayClick = true, isLarge, isOpen = true, + isOverflowVisible = false, isScrollable = true, onClose, ...props @@ -102,7 +104,9 @@ export function Modal({ <> - {props.body} + + {props.body} + {children}; +export function ModalBody({ children, isScrollable = true, isOverflowVisible = false }: Props) { + return ( + + {children} + + ); } const StyledMain = styled.div` @@ -45,4 +52,8 @@ const StyledMain = styled.div` &.scrollable { overflow-y: auto; } + + &.overflowVisible { + overflow: visible; + } `; diff --git a/server/sonar-web/design-system/src/components/modal/__tests__/__snapshots__/ModalBody-test.tsx.snap b/server/sonar-web/design-system/src/components/modal/__tests__/__snapshots__/ModalBody-test.tsx.snap index 4d41d0c95e2..32d0bdc498b 100644 --- a/server/sonar-web/design-system/src/components/modal/__tests__/__snapshots__/ModalBody-test.tsx.snap +++ b/server/sonar-web/design-system/src/components/modal/__tests__/__snapshots__/ModalBody-test.tsx.snap @@ -20,6 +20,10 @@ exports[`renders with children 1`] = ` overflow-y: auto; } +.emotion-0.overflowVisible { + overflow: visible; +} +
{ }; handleTokenNameChange = (event: React.ChangeEvent) => { - this.setState({ - tokenName: event.target.value, - }); + this.setState({ tokenName: event.currentTarget.value }); }; - handleTokenExpirationChange = ({ value }: { value: TokenExpiration }) => { + handleTokenExpirationChange = (value: TokenExpiration) => { this.setState({ tokenExpiration: value }); }; @@ -154,118 +160,112 @@ export default class EditTokenModal extends React.PureComponent { } }; - render() { + renderForm(type: TokenType) { const { loading, token, tokenName, tokenExpiration, tokenExpirationOptions } = this.state; - - const type = this.getTokenType(); - const header = translate('onboarding.token.generate', type); const intro = translate('onboarding.token.text', type); return ( - - {({ onCloseClick }) => ( +
+ + {translate('onboarding.token.text.user_account')} + + ), + }} + /> + + {token ? ( <> -
-

{header}

+ + {tokenName} + {': '} + +
+ + +
- -
-

- - {translate('onboarding.token.text.user_account')} - - ), - }} - /> -

- - {token ? ( - <> - - {tokenName} - {': '} - -
- {token} - - - - + {translateWithParameters('users.tokens.new_token_created', token)} + + + ) : ( + <> +
+ +
+ + +
+
+ +
+ ) => + this.handleTokenExpirationChange(data.value) + } + options={tokenExpirationOptions} + value={tokenExpirationOptions.find( + (option) => option.value === tokenExpiration + )} /> + + {translate('onboarding.token.generate')} +
- - - {translateWithParameters('users.tokens.new_token_created', token)} - - - ) : ( - <> -
- {loading ? ( - - ) : ( - <> -
- - -
-
- -
-