From 7b95d496c34c488f939034814cea5ff19c0ea1be Mon Sep 17 00:00:00 2001 From: Boaz Shuster Date: Wed, 18 Jul 2018 14:28:17 +0000 Subject: [PATCH] Fixes #24475 - Add EmptyState to React components Signed-off-by: Boaz Shuster --- .../javascripts/react_app/common/helpers.js | 6 + .../__snapshots__/bookmarks.test.js.snap | 2105 ++--------------- .../components/bookmarks/bookmarks.test.js | 53 +- .../react_app/components/bookmarks/index.js | 2 +- .../DocumentationLink.stories.js | 30 + .../DocumentationLink.test.js | 2 +- .../DocumentationLink.test.js.snap | 7 +- .../common/DocumentationLink/index.js | 34 +- .../common/EmptyState/DefaultEmptyState.js | 51 + .../common/EmptyState/EmptyState.stories.js | 98 + .../common/EmptyState/EmptyState.test.js | 87 + .../common/EmptyState/EmptyStatePattern.js | 23 + .../EmptyStatePrimaryActionButton.js | 16 + .../common/EmptyState/EmptyStatePropTypes.js | 27 + .../EmptyStateSecondaryActionButtons.js | 21 + .../__snapshots__/EmptyState.test.js.snap | 268 +++ .../components/common/EmptyState/index.js | 5 + 17 files changed, 903 insertions(+), 1932 deletions(-) create mode 100644 webpack/assets/javascripts/react_app/components/common/DocumentationLink/DocumentationLink.stories.js create mode 100644 webpack/assets/javascripts/react_app/components/common/EmptyState/DefaultEmptyState.js create mode 100644 webpack/assets/javascripts/react_app/components/common/EmptyState/EmptyState.stories.js create mode 100644 webpack/assets/javascripts/react_app/components/common/EmptyState/EmptyState.test.js create mode 100644 webpack/assets/javascripts/react_app/components/common/EmptyState/EmptyStatePattern.js create mode 100644 webpack/assets/javascripts/react_app/components/common/EmptyState/EmptyStatePrimaryActionButton.js create mode 100644 webpack/assets/javascripts/react_app/components/common/EmptyState/EmptyStatePropTypes.js create mode 100644 webpack/assets/javascripts/react_app/components/common/EmptyState/EmptyStateSecondaryActionButtons.js create mode 100644 webpack/assets/javascripts/react_app/components/common/EmptyState/__snapshots__/EmptyState.test.js.snap create mode 100644 webpack/assets/javascripts/react_app/components/common/EmptyState/index.js diff --git a/webpack/assets/javascripts/react_app/common/helpers.js b/webpack/assets/javascripts/react_app/common/helpers.js index f35bf235e241..8b7984bd8174 100644 --- a/webpack/assets/javascripts/react_app/common/helpers.js +++ b/webpack/assets/javascripts/react_app/common/helpers.js @@ -1,5 +1,11 @@ export const noop = Function.prototype; // empty function +// open the link in a new window +export const newWindowOnClick = url => (event) => { + event.preventDefault(); + window.open(url, '_blank'); +}; + export default { bindMethods(context, methods) { methods.forEach((method) => { diff --git a/webpack/assets/javascripts/react_app/components/bookmarks/__snapshots__/bookmarks.test.js.snap b/webpack/assets/javascripts/react_app/components/bookmarks/__snapshots__/bookmarks.test.js.snap index 6ae1fa43ce7c..0b32cace49ff 100644 --- a/webpack/assets/javascripts/react_app/components/bookmarks/__snapshots__/bookmarks.test.js.snap +++ b/webpack/assets/javascripts/react_app/components/bookmarks/__snapshots__/bookmarks.test.js.snap @@ -1,1909 +1,260 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`bookmarks empty state 1`] = ` - - - -`; - -exports[`bookmarks should include existing bookmarks for the current controller 1`] = ` - - + + + + + + + `; exports[`bookmarks should show an error message if loading failed 1`] = ` - -