From dc9e822cc7b95d7e6c4a109cd44fe5e3bd645ff4 Mon Sep 17 00:00:00 2001 From: Johannes Schill Date: Thu, 11 Oct 2018 11:56:32 +0200 Subject: [PATCH] Remove CTA when CTA-action is clicked instead of a /new route #13471 --- .../core/components/Animations/SlideDown.tsx | 11 ++++-- .../features/api-keys/ApiKeysPage.test.tsx | 2 +- public/app/features/api-keys/ApiKeysPage.tsx | 34 +++++++++++-------- .../__snapshots__/ApiKeysPage.test.tsx.snap | 14 +++++++- 4 files changed, 41 insertions(+), 20 deletions(-) diff --git a/public/app/core/components/Animations/SlideDown.tsx b/public/app/core/components/Animations/SlideDown.tsx index 4d515f98f16..497af02ade9 100644 --- a/public/app/core/components/Animations/SlideDown.tsx +++ b/public/app/core/components/Animations/SlideDown.tsx @@ -1,15 +1,20 @@ import React from 'react'; import Transition from 'react-transition-group/Transition'; +interface Style { + transition?: string; + overflow?: string; +} + const defaultMaxHeight = '200px'; // When animating using max-height we need to use a static value. // If this is not enough, pass in - + {!isAdding && ( + + )} {this.renderAddApiKeyForm()} ); @@ -127,9 +130,10 @@ export class ApiKeysPage extends PureComponent { renderAddApiKeyForm() { const { newApiKey, isAdding } = this.state; + const slideDownStyle = isAdding ? slideDownDefaultStyle : { ...slideDownDefaultStyle, transition: 'unset' }; return ( - +
`; -exports[`Render should render CTA if theres are no API keys 1`] = ` +exports[`Render should render CTA if there are no API keys 1`] = `