Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add padding option #2018

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions www/main/viewer/Slide/PaddingTools.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import PropTypes from 'prop-types';
import React from 'react';

const PaddingTools = (props) => {
const [paddingToolsOpen, setPaddingToolsOpen] = useState(false);
return (
<div className={`slide-quicktools ${!userSettings.quickTools ? 'hide-quicktools' : ''}`.trim()}>
<div className="quicktool-header" onClick={() => setPaddingToolsOpen(!paddingToolsOpen)}>
Padding Tools
<i className={`fa fa-caret-${quickToolsOpen ? 'up' : 'down'}`}></i>
</div>
{paddingToolsOpen && (
<div className={`quicktool-body quicktool-${isMiscSlide ? 'announcement' : 'gurbani'}`}>
{baniOrder.map((order, index) => (
<div key={`item-${index}`} className="quicktool-item">
{handleQuickTools(order, index)}
<div className="quicktool-icons">{bakeIcons(order, index, quickToolsModifiers)}</div>
</div>
))}
</div>
)}
</div>
)
}

PaddingTools.propTypes = {
isMiscSlide: PropTypes.bool
}

export default PaddingTools;
8 changes: 8 additions & 0 deletions www/main/viewer/store/ViewerState.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,24 @@ const ViewerState = createStore({
},
viewerSettings: {
quickToolsOpen: false,
paddingToolsOpen: false,
slideOrder: ['translation', 'teeka', 'transliteration'],
setSlideOrder: action((state, slideOrder) => ({
...state,
slideOrder,
})),
setQuickToolsOpen: action((state, payload) => {
const newState = state;
newState.paddingToolsOpen = false; // explictely making sure we are closing the paddingTools when setting the quick tools.
newState.quickToolsOpen = payload;
return newState;
}),
setPaddingToolsOpen: action((state, payload) => {
const newState = state;
newState.quickToolsOpen = false; // explictely making sure we are closing the quickTools when setting the padding tools.
newState.paddingToolsOpen = payload;
return newState;
}),
},
});

Expand Down