Remove CTA when CTA-action is clicked instead of a /new route #13471

This commit is contained in:
Johannes Schill
2018-10-11 11:56:32 +02:00
parent b121700103
commit dc9e822cc7
4 changed files with 41 additions and 20 deletions

View File

@@ -38,7 +38,7 @@ describe('Render', () => {
expect(wrapper).toMatchSnapshot();
});
it('should render CTA if theres are no API keys', () => {
it('should render CTA if there are no API keys', () => {
const { wrapper } = setup({
apiKeys: getMultipleMockKeys(0),
apiKeysCount: 0,

View File

@@ -7,8 +7,8 @@ import { getNavModel } from 'app/core/selectors/navModel';
import { getApiKeys, getApiKeysCount } from './state/selectors';
import { loadApiKeys, deleteApiKey, setSearchQuery, addApiKey } from './state/actions';
import PageHeader from 'app/core/components/PageHeader/PageHeader';
import SlideDown from 'app/core/components/Animations/SlideDown';
import PageLoader from 'app/core/components/PageLoader/PageLoader';
import SlideDown, { defaultStyle as slideDownDefaultStyle } from 'app/core/components/Animations/SlideDown';
import ApiKeysAddedModal from './ApiKeysAddedModal';
import config from 'app/core/config';
import appEvents from 'app/core/app_events';
@@ -105,21 +105,24 @@ export class ApiKeysPage extends PureComponent<Props, any> {
};
renderEmptyList() {
const { isAdding } = this.state;
return (
<div className="page-container page-body">
<EmptyListCTA
model={{
title: "You haven't added any API Keys yet.",
buttonIcon: 'fa fa-plus',
buttonLink: '#',
onClick: this.onToggleAdding,
buttonTitle: ' New API Key',
proTip: 'Remember you can provide view-only API access to other applications.',
proTipLink: '',
proTipLinkTitle: '',
proTipTarget: '_blank',
}}
/>
{!isAdding && (
<EmptyListCTA
model={{
title: "You haven't added any API Keys yet.",
buttonIcon: 'fa fa-plus',
buttonLink: '#',
onClick: this.onToggleAdding,
buttonTitle: ' New API Key',
proTip: 'Remember you can provide view-only API access to other applications.',
proTipLink: '',
proTipLinkTitle: '',
proTipTarget: '_blank',
}}
/>
)}
{this.renderAddApiKeyForm()}
</div>
);
@@ -127,9 +130,10 @@ export class ApiKeysPage extends PureComponent<Props, any> {
renderAddApiKeyForm() {
const { newApiKey, isAdding } = this.state;
const slideDownStyle = isAdding ? slideDownDefaultStyle : { ...slideDownDefaultStyle, transition: 'unset' };
return (
<SlideDown in={isAdding}>
<SlideDown in={isAdding} style={slideDownStyle}>
<div className="cta-form">
<button className="cta-form__close btn btn-transparent" onClick={this.onToggleAdding}>
<i className="fa fa-close" />

View File

@@ -45,6 +45,12 @@ exports[`Render should render API keys table if there are any keys 1`] = `
</div>
<Component
in={false}
style={
Object {
"overflow": "hidden",
"transition": "unset",
}
}
>
<div
className="cta-form"
@@ -245,7 +251,7 @@ exports[`Render should render API keys table if there are any keys 1`] = `
</div>
`;
exports[`Render should render CTA if theres are no API keys 1`] = `
exports[`Render should render CTA if there are no API keys 1`] = `
<div>
<PageHeader
model={Object {}}
@@ -270,6 +276,12 @@ exports[`Render should render CTA if theres are no API keys 1`] = `
/>
<Component
in={false}
style={
Object {
"overflow": "hidden",
"transition": "unset",
}
}
>
<div
className="cta-form"