From 6fed952a223be64648f46be108b78a5e4fd4c1ad Mon Sep 17 00:00:00 2001 From: CPunisher <1343316114@qq.com> Date: Sat, 16 Jan 2021 21:33:22 +0800 Subject: [PATCH] style preset --- package.json | 1 + src/actions/index.js | 4 +- src/components/app/PartDownload.js | 8 +- src/components/param/disposable/ParamIcon.js | 2 +- src/components/preset/Preset.css | 29 +++++++ src/components/preset/PresetCard.js | 26 +++++++ src/components/preset/PresetDetail.js | 49 ++++++++++++ src/components/preset/PresetModal.js | 80 +++++++++++++++++++- src/components/renderer/RendererResImage.js | 1 - src/components/style/Renderer.js | 4 +- src/containers/app/PartDownloadViewer.js | 24 +++++- src/containers/preset/PresetModalViewer.js | 21 +++++ src/containers/style/StyleListViewer.js | 2 +- src/reducers/index.js | 3 - src/utils/imageUtils.js | 14 ++++ src/utils/storageUtils.js | 24 ++++++ yarn.lock | 27 +++++++ 17 files changed, 304 insertions(+), 15 deletions(-) create mode 100644 src/components/preset/Preset.css create mode 100644 src/components/preset/PresetCard.js create mode 100644 src/components/preset/PresetDetail.js create mode 100644 src/containers/preset/PresetModalViewer.js create mode 100644 src/utils/storageUtils.js diff --git a/package.json b/package.json index db19c0d..98d443f 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "react-github-btn": "^1.2.0", "react-indiana-drag-scroll": "^1.6.1", "react-lazy-load": "^3.0.13", + "react-modal": "^3.12.1", "react-redux": "^7.2.0", "react-scripts": "3.4.1", "redux": "^4.0.5", diff --git a/src/actions/index.js b/src/actions/index.js index ad09615..d092a62 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -6,11 +6,11 @@ export const genQRInfo = text => ({ text }) -export const changeStyle = (rendererIndex, rendererType, value) => { +export const changeStyle = (rendererIndex, value) => { handleStyle(value); return { type: actionTypes.CHANGE_STYLE, - rendererIndex, rendererType, value + rendererIndex, value } } diff --git a/src/components/app/PartDownload.js b/src/components/app/PartDownload.js index 916d02d..f881e4e 100644 --- a/src/components/app/PartDownload.js +++ b/src/components/app/PartDownload.js @@ -2,6 +2,7 @@ import React, {useState} from 'react'; import './App.css'; import PropTypes from 'prop-types'; import {isWeiXin} from "../../utils/navigatorUtils"; +import PresetModalViewer from "../../containers/preset/PresetModalViewer"; const WxMessage = () => { if (isWeiXin()) { @@ -28,8 +29,9 @@ const ImgBox = ({ imgData }) => { return null } -const PartDownload = ({ value, downloadCount, onSvgDownload, onImgDownload }) => { +const PartDownload = ({ value, downloadCount, onSvgDownload, onImgDownload, savePreset }) => { const [imgData, setImgData] = useState(''); + const [visible, setVisible] = useState(false); return (
@@ -41,11 +43,15 @@ const PartDownload = ({ value, downloadCount, onSvgDownload, onImgDownload }) =>

+ setVisible(false)} />
+ + +
diff --git a/src/components/param/disposable/ParamIcon.js b/src/components/param/disposable/ParamIcon.js index 5a7c337..5d17e89 100644 --- a/src/components/param/disposable/ParamIcon.js +++ b/src/components/param/disposable/ParamIcon.js @@ -38,7 +38,7 @@ const ParamIcon = ({icon, onBlur, onKeyPress}) => (