@adactive/adsum-modal-asia
Advanced tools
Comparing version 2.5.0 to 2.5.1
{ | ||
"name": "@adactive/adsum-modal-asia", | ||
"version": "2.5.0", | ||
"version": "2.5.1", | ||
"description": "Adsum Modal Component", | ||
@@ -40,3 +40,3 @@ "main": "index.js", | ||
], | ||
"gitHead": "079824533530dc57472ce4aa3cdb21775a6496f2" | ||
"gitHead": "e37f46629f661fdf2d2f4b26e66efcb4a2fc7a2d" | ||
} |
@@ -12,3 +12,3 @@ # Carousel component | ||
- import the reducer : | ||
```import { ModalReducers } from '@adactive/arc-modal-asia';``` | ||
```import { ModalReducers } from '@adactive/adsum-modal-asia';``` | ||
- add ScreenSaverReducers on your root reducer, for example: | ||
@@ -25,29 +25,19 @@ ``` | ||
First thing to do is to import the action to file which you need the actions, for example app.js | ||
```import { ModalActions } from '@adactive/arc-modal-asia';``` | ||
```import { ModalActions } from '@adactive/adsum-modal-asia';``` | ||
There is 5 redux prop actions that this component have: | ||
setPoiStructure(modalState.poi); | ||
setModal("shopDetail"); | ||
openModal(true); | ||
setModalStructure("categoryDetail"); | ||
setPoi(newItem); | ||
setModal("categoryDetail"); | ||
openModal(true); | ||
setModalStructure("search"); | ||
setPoi(item); | ||
The first action is ***ONLY*** required if a function want to open children of current modal but we need to save the poi for back button. Usually it used on children that want to call grandchildren | ||
- Action to save the poi in the structure for nested | ||
**(ModalActions.setPoiStructure)** | ||
- Action to save the poi in the structure for nested | ||
**(ModalActions.setPoiStructure)** | ||
This Following Two Actions is required to show modal | ||
- Action to set which modal will appear | ||
**(ModalActions.setModal)** | ||
- Action to open the modal | ||
**(ModalActions.openModal)** | ||
- Action to set which modal will appear | ||
**(ModalActions.setModal)** | ||
- Action to open the modal | ||
**(ModalActions.openModal)** | ||
The Following Two Actions is required when a function is opening a child of nested modal | ||
- Action to set which modal is the parent of will be opened modal | ||
**(ModalActions.setModalStructure)** | ||
- Action to save the poi of current modal | ||
**(ModalActions.setPoi)** | ||
- Action to set which modal is the parent of will be opened modal | ||
**(ModalActions.setModalStructure)** | ||
- Action to save the poi of current modal | ||
**(ModalActions.setPoi)** | ||
@@ -168,5 +158,5 @@ Put these to actions on the **mapDispatchToProps** | ||
### Less only | ||
`npx @adactive/arc-modal-asia copy --less-only` | ||
`npx @adactive/adsum-modal-asia copy --less-only` | ||
### Full copy | ||
`npx @adactive/arc-modal-asia copy` | ||
`npx @adactive/adsum-modal-asia copy` |
@@ -8,2 +8,3 @@ // @flow | ||
import './Modal.css'; | ||
import defaultCloseImage from './close.svg'; | ||
@@ -39,2 +40,3 @@ /** | ||
overlayPosition: array, | ||
modalClassName: string, | ||
|}; | ||
@@ -78,6 +80,11 @@ | ||
setPoi, | ||
removePoiStructure | ||
removePoiStructure, | ||
customBackFunction, | ||
} = this.props; | ||
if (modalState.structure.length > 0) { | ||
if (customBackFunction) { | ||
customBackFunction(); | ||
} | ||
setModal(modalState.structure[modalState.structure.length - 1]); | ||
@@ -87,2 +94,6 @@ removeModalStructure(); | ||
if (modalState.poiStructure.length > 0) { | ||
if (customBackFunction) { | ||
customBackFunction(); | ||
} | ||
setPoi(modalState.poiStructure[modalState.poiStructure.length - 1]); | ||
@@ -92,2 +103,5 @@ removePoiStructure(); | ||
} else { | ||
if (customBackFunction) { | ||
customBackFunction(); | ||
} | ||
openModal(false); | ||
@@ -101,5 +115,10 @@ } | ||
removeAllModalStructure, | ||
removeAllPoiStructure | ||
removeAllPoiStructure, | ||
customCloseFunction, | ||
} = this.props; | ||
if (customCloseFunction) { | ||
customCloseFunction(); | ||
} | ||
openModal(false); | ||
@@ -124,9 +143,9 @@ removeAllModalStructure(); | ||
overlayColor, | ||
overlayOpacity | ||
overlayOpacity, | ||
modalClassName, | ||
} = this.props; | ||
return ( | ||
<React.Fragment> | ||
<div | ||
className="modalContainer" | ||
className={modalClassName || 'modalContainer'} | ||
style={{ | ||
@@ -144,11 +163,14 @@ width: modalWidth, | ||
<div className="backButton"> | ||
<img | ||
src={backImage || null} | ||
onClick={this.handleBack} | ||
alt="modalBack" | ||
/> | ||
{backImage | ||
&& ( | ||
<img | ||
src={backImage} | ||
onClick={this.handleBack} | ||
alt="modalBack" | ||
/> | ||
)} | ||
</div> | ||
<div className="closeButton"> | ||
<img | ||
src={closeImage} | ||
src={closeImage || defaultCloseImage} | ||
onClick={this.handleClose} | ||
@@ -155,0 +177,0 @@ alt="modalClose" |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19359
12
414
160