From e946edc2c0ed488c50d217f5c3a2d1fe811b5901 Mon Sep 17 00:00:00 2001 From: Alexandru Munteanu <alexandru.munt@gmail.com> Date: Thu, 23 Aug 2018 14:55:55 +0300 Subject: [PATCH] feat(styleguide): add modal in wrapper reducer --- packages/component-faraday-ui/src/modals/OpenModal.js | 5 +---- packages/component-faraday-ui/src/modals/OpenModal.md | 4 +--- packages/styleguide/src/Wrapper.js | 9 +++++++++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/component-faraday-ui/src/modals/OpenModal.js b/packages/component-faraday-ui/src/modals/OpenModal.js index 8b6ebe84d..a030bbd29 100644 --- a/packages/component-faraday-ui/src/modals/OpenModal.js +++ b/packages/component-faraday-ui/src/modals/OpenModal.js @@ -1,13 +1,10 @@ -import React from 'react' import { get } from 'lodash' import { compose, withHandlers } from 'recompose' import { withModal } from 'pubsweet-component-modal/src/components' import { MultiAction } from './' -const OpenModal = ({ onClickEvent, children }) => ( - <div>{children(onClickEvent)}</div> -) +const OpenModal = ({ onClickEvent, children }) => children(onClickEvent) export default compose( withModal(() => ({ diff --git a/packages/component-faraday-ui/src/modals/OpenModal.md b/packages/component-faraday-ui/src/modals/OpenModal.md index 966ff0fe1..3c31caf77 100644 --- a/packages/component-faraday-ui/src/modals/OpenModal.md +++ b/packages/component-faraday-ui/src/modals/OpenModal.md @@ -1,9 +1,7 @@ Open a confirmation modal by clicking on an element ```js -const ActionLink = require('../ActionLink.js') - -;<OpenModal +<OpenModal confirmAction={() => alert('Confirm')} title="Are you sure?" confirmText="Delete" diff --git a/packages/styleguide/src/Wrapper.js b/packages/styleguide/src/Wrapper.js index 2fa36592a..6c599e660 100644 --- a/packages/styleguide/src/Wrapper.js +++ b/packages/styleguide/src/Wrapper.js @@ -8,9 +8,18 @@ import { createStore, combineReducers } from 'redux' import withDragDropContext from './withDragDropContext' +const modalReducer = ( + state = { + error: null, + props: {}, + }, + action, +) => state + const store = createStore( combineReducers({ form: reducer, + modal: modalReducer, }), ) -- GitLab