From 67abfe5c9c17da25e8ada09602dc1550c37a6103 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 | 2129 ++--------------- .../components/bookmarks/bookmarks.test.js | 51 +- .../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, 902 insertions(+), 1955 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 f35bf235e24..8b7984bd817 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 4c60ddf9d0b..0b32cace49f 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,1933 +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`] = ` - -