mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 19:16:41 +07:00
cropper: separate crop panel
This commit is contained in:
parent
6f21b909c0
commit
b85141046d
5 changed files with 54 additions and 46 deletions
39
src/components/panels/RendererPanel.jsx
Normal file
39
src/components/panels/RendererPanel.jsx
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
import React from 'react';
|
||||||
|
import { Icon } from '$components/panels/Icon';
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
export const RendererPanel = ({ onCancel, onSubmit }): Props => (
|
||||||
|
<div
|
||||||
|
className="panel active center"
|
||||||
|
style={{ zIndex: 1000 }}
|
||||||
|
>
|
||||||
|
<div className="control-bar control-bar-padded">
|
||||||
|
<button>
|
||||||
|
<Icon icon="icon-logo-3" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="control-sep" />
|
||||||
|
|
||||||
|
<div className="control-bar">
|
||||||
|
<button
|
||||||
|
className="highlighted cancel"
|
||||||
|
onClick={onCancel}
|
||||||
|
>
|
||||||
|
<Icon icon="icon-cancel-1" />
|
||||||
|
<span>Отмена</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
className="success"
|
||||||
|
onClick={onSubmit}
|
||||||
|
>
|
||||||
|
<span>СКАЧАТЬ</span>
|
||||||
|
<Icon icon="icon-get-1" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
|
@ -93,7 +93,7 @@ export class Component extends React.PureComponent<Props, void> {
|
||||||
<button
|
<button
|
||||||
onClick={this.props.takeAShot}
|
onClick={this.props.takeAShot}
|
||||||
>
|
>
|
||||||
<Icon icon="icon-shot-3" />
|
<Icon icon="icon-shot-2" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,6 +7,7 @@ import Croppr from 'croppr';
|
||||||
import 'croppr/dist/croppr.css';
|
import 'croppr/dist/croppr.css';
|
||||||
import { Icon } from '$components/panels/Icon';
|
import { Icon } from '$components/panels/Icon';
|
||||||
import { LOGOS } from '$constants/logos';
|
import { LOGOS } from '$constants/logos';
|
||||||
|
import { RendererPanel } from '$components/panels/RendererPanel';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
data: String,
|
data: String,
|
||||||
|
@ -45,7 +46,7 @@ class Component extends React.Component<Props, State> {
|
||||||
this.logo.style.transform = `scale(${scale})`;
|
this.logo.style.transform = `scale(${scale})`;
|
||||||
|
|
||||||
this.logoImg = document.createElement('img');
|
this.logoImg = document.createElement('img');
|
||||||
this.logoImg.src = LOGOS[this.props.logo][1];
|
if (this.props.logo && LOGOS[this.props.logo][1]) this.logoImg.src = LOGOS[this.props.logo][1];
|
||||||
|
|
||||||
this.logo.append(this.logoImg);
|
this.logo.append(this.logoImg);
|
||||||
regionEl.append(this.logo);
|
regionEl.append(this.logo);
|
||||||
|
@ -89,41 +90,10 @@ class Component extends React.Component<Props, State> {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<RendererPanel
|
||||||
className="panel active"
|
onCancel={this.props.hideRenderer}
|
||||||
style={{
|
onSubmit={this.getImage}
|
||||||
zIndex: 1000,
|
/>
|
||||||
left: '50%',
|
|
||||||
right: 'auto',
|
|
||||||
transform: 'translateX(-50%)',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div className="control-bar control-bar-padded">
|
|
||||||
<button>
|
|
||||||
<Icon icon="icon-logo-3" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="control-sep" />
|
|
||||||
|
|
||||||
<div className="control-bar">
|
|
||||||
<button
|
|
||||||
className="highlighted cancel"
|
|
||||||
onClick={this.props.hideRenderer}
|
|
||||||
>
|
|
||||||
<Icon icon="icon-cancel-1" />
|
|
||||||
<span>Отмена</span>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<button
|
|
||||||
className="success"
|
|
||||||
onClick={this.getImage}
|
|
||||||
>
|
|
||||||
<span>СКАЧАТЬ</span>
|
|
||||||
<Icon icon="icon-get-1" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,15 +4,12 @@ import { persistStore, persistReducer } from 'redux-persist';
|
||||||
import storage from 'redux-persist/lib/storage';
|
import storage from 'redux-persist/lib/storage';
|
||||||
import createSagaMiddleware from 'redux-saga';
|
import createSagaMiddleware from 'redux-saga';
|
||||||
|
|
||||||
// import createHistory from 'history/createBrowserHistory';
|
|
||||||
// import { routerReducer, routerMiddleware } from 'react-router-redux';
|
|
||||||
|
|
||||||
import { userReducer } from '$redux/user/reducer';
|
import { userReducer } from '$redux/user/reducer';
|
||||||
import { userSaga } from '$redux/user/sagas';
|
import { userSaga } from '$redux/user/sagas';
|
||||||
|
|
||||||
const userPersistConfig = {
|
const userPersistConfig = {
|
||||||
key: 'user',
|
key: 'user',
|
||||||
whitelist: ['user'],
|
whitelist: ['user', 'logo'],
|
||||||
storage,
|
storage,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -39,13 +36,9 @@ export const store = createStore(
|
||||||
);
|
);
|
||||||
|
|
||||||
export function configureStore() {
|
export function configureStore() {
|
||||||
// run sagas
|
|
||||||
sagaMiddleware.run(userSaga);
|
sagaMiddleware.run(userSaga);
|
||||||
|
|
||||||
const persistor = persistStore(store);
|
const persistor = persistStore(store);
|
||||||
|
|
||||||
return {
|
return { store, persistor };
|
||||||
store,
|
|
||||||
persistor
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,12 @@
|
||||||
right: 10px;
|
right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.center {
|
||||||
|
left: 50%;
|
||||||
|
right: auto;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
border: none;
|
border: none;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue