Skip to content
Snippets Groups Projects
Commit e946edc2 authored by Alexandru Munteanu's avatar Alexandru Munteanu
Browse files

feat(styleguide): add modal in wrapper reducer

parent 1254674e
No related branches found
No related tags found
1 merge request!43Sprint #19
import React from 'react'
import { get } from 'lodash' import { get } from 'lodash'
import { compose, withHandlers } from 'recompose' import { compose, withHandlers } from 'recompose'
import { withModal } from 'pubsweet-component-modal/src/components' import { withModal } from 'pubsweet-component-modal/src/components'
import { MultiAction } from './' import { MultiAction } from './'
const OpenModal = ({ onClickEvent, children }) => ( const OpenModal = ({ onClickEvent, children }) => children(onClickEvent)
<div>{children(onClickEvent)}</div>
)
export default compose( export default compose(
withModal(() => ({ withModal(() => ({
......
Open a confirmation modal by clicking on an element Open a confirmation modal by clicking on an element
```js ```js
const ActionLink = require('../ActionLink.js') <OpenModal
;<OpenModal
confirmAction={() => alert('Confirm')} confirmAction={() => alert('Confirm')}
title="Are you sure?" title="Are you sure?"
confirmText="Delete" confirmText="Delete"
......
...@@ -8,9 +8,18 @@ import { createStore, combineReducers } from 'redux' ...@@ -8,9 +8,18 @@ import { createStore, combineReducers } from 'redux'
import withDragDropContext from './withDragDropContext' import withDragDropContext from './withDragDropContext'
const modalReducer = (
state = {
error: null,
props: {},
},
action,
) => state
const store = createStore( const store = createStore(
combineReducers({ combineReducers({
form: reducer, form: reducer,
modal: modalReducer,
}), }),
) )
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment