diff --git a/src/components/App/App.reducer.js b/src/components/App/App.reducer.js index 8b3ba3bb9..84bdff8fe 100644 --- a/src/components/App/App.reducer.js +++ b/src/components/App/App.reducer.js @@ -15,6 +15,7 @@ import { } from '../Settings/Display/Display.constants'; import { DEFAULT_FONT_FAMILY } from './../../providers/ThemeProvider/ThemeProvider.constants'; +import { NAVIGATION_BUTTONS_STYLE_SIDES } from '../Settings/Navigation/Navigation.constants'; const initialState = { isConnected: true, @@ -43,6 +44,7 @@ const initialState = { active: false, shareShowActive: false, bigScrollButtonsActive: false, + navigationButtonsStyle: NAVIGATION_BUTTONS_STYLE_SIDES, caBackButtonActive: false, quickUnlockActive: false, removeOutputActive: false, diff --git a/src/components/App/__tests__/App.reducer.test.js b/src/components/App/__tests__/App.reducer.test.js index cfbda3297..ac5dcbf98 100644 --- a/src/components/App/__tests__/App.reducer.test.js +++ b/src/components/App/__tests__/App.reducer.test.js @@ -9,6 +9,7 @@ import { import { LOGIN_SUCCESS, LOGOUT } from '../../Account/Login/Login.constants'; import { DISPLAY_SIZE_STANDARD } from '../../Settings/Display/Display.constants'; import { DEFAULT_FONT_FAMILY } from '../../../providers/ThemeProvider/ThemeProvider.constants'; +import { NAVIGATION_BUTTONS_STYLE_SIDES } from '../../Settings/Navigation/Navigation.constants'; let mockApp, uData, initialState; @@ -41,6 +42,7 @@ describe('reducer', () => { active: false, bigScrollButtonsActive: false, caBackButtonActive: false, + navigationButtonsStyle: NAVIGATION_BUTTONS_STYLE_SIDES, liveMode: false, shareShowActive: false, quickUnlockActive: false, @@ -66,6 +68,7 @@ describe('reducer', () => { active: false, bigScrollButtonsActive: false, caBackButtonActive: false, + navigationButtonsStyle: NAVIGATION_BUTTONS_STYLE_SIDES, liveMode: false, shareShowActive: false, quickUnlockActive: false, diff --git a/src/components/Board/Board.component.js b/src/components/Board/Board.component.js index 04bdac2ae..c253bab56 100644 --- a/src/components/Board/Board.component.js +++ b/src/components/Board/Board.component.js @@ -33,6 +33,7 @@ import messages from './Board.messages'; import './Board.css'; import BoardTour from './BoardTour/BoardTour'; import ScrollButtons from '../ScrollButtons'; +import { NAVIGATION_BUTTONS_STYLE_SIDES } from '../Settings/Navigation/Navigation.constants'; export class Board extends Component { static propTypes = { @@ -317,6 +318,9 @@ export class Board extends Component { const tiles = this.renderTiles(board.tiles); const cols = DISPLAY_SIZE_GRID_COLS[this.props.displaySettings.uiSize]; const isLoggedIn = !!userData.email; + const isNavigationButtonsOnTheSide = + navigationSettings.navigationButtonsStyle === + NAVIGATION_BUTTONS_STYLE_SIDES; return (
@@ -451,6 +468,7 @@ export class Board extends Component { fixedRef={this.fixedBoardContainerRef} setIsScroll={setIsScroll} isBigScrollBtns={navigationSettings.bigScrollButtonsActive} + isNavigationButtonsOnTheSide={isNavigationButtonsOnTheSide} /> )} @@ -462,6 +480,10 @@ export class Board extends Component { rows={board.grid ? board.grid.rows : DEFAULT_ROWS_NUMBER} onAddRemoveRow={onAddRemoveRow} onAddRemoveColumn={onAddRemoveColumn} + moveColsButtonToLeft={ + navigationSettings.bigScrollButtonsActive && + isNavigationButtonsOnTheSide + } />
@@ -470,11 +492,11 @@ export class Board extends Component { )} @@ -496,6 +519,8 @@ export class Board extends Component { navHistory={this.props.navHistory} previousBoard={onRequestPreviousBoard} toRootBoard={onRequestToRootBoard} + isLocked={this.props.isLocked} + isNavigationButtonsOnTheSide={isNavigationButtonsOnTheSide} /> -
+
{this.renderButtons(true, false)}
diff --git a/src/components/EditGridButtons/EditGridButtons.css b/src/components/EditGridButtons/EditGridButtons.css index 679f58cc1..b0d3a38a1 100644 --- a/src/components/EditGridButtons/EditGridButtons.css +++ b/src/components/EditGridButtons/EditGridButtons.css @@ -16,7 +16,8 @@ .EditGridButtons.left { top: 55%; - left: 0; + left: 6px; + max-width: 4rem; } .EditGridButtons.right { @@ -25,7 +26,8 @@ max-width: 4rem; } -.EditGridButtons.right button { +.EditGridButtons.right button, +.EditGridButtons.left button { min-height: 50px; padding-right: 10px; padding-left: 10px; diff --git a/src/components/FixedGrid/Grid.js b/src/components/FixedGrid/Grid.js index fffb0c183..2910f7f62 100644 --- a/src/components/FixedGrid/Grid.js +++ b/src/components/FixedGrid/Grid.js @@ -28,6 +28,7 @@ function Grid(props) { setIsScroll, fixedRef, isBigScrollBtns, + isNavigationButtonsOnTheSide, ...other } = props; @@ -215,7 +216,10 @@ function Grid(props) { return (
{ if (!active) { return null; } + const classPreviousBoardButton = isNavigationButtonsOnTheSide + ? `SideNavigationButton SideButtonPreviousBoard ${ + navHistory.length > 2 ? '' : 'disable' + }` + : `NavigationButton left`; + + const classToRootBoardButton = isNavigationButtonsOnTheSide + ? `SideNavigationButton SideButtonToRootBoard ${ + navHistory.length > 1 ? '' : 'disable' + }` + : 'NavigationButton right'; return ( - {navHistory.length > 2 && ( -
- -
- )} - {navHistory.length > 1 && ( -
- -
- )} +
+ {(navHistory.length > 2 || isNavigationButtonsOnTheSide) && ( +
+ +
+ )} + {(navHistory.length > 1 || isNavigationButtonsOnTheSide) && ( +
+ +
+ )} +
); }; @@ -38,7 +59,9 @@ const NavigationButtons = ({ NavigationButtons.props = { navHistory: PropTypes.arrayOf(PropTypes.string), previousBoard: PropTypes.func, - toRootBoard: PropTypes.func + toRootBoard: PropTypes.func, + isLocked: PropTypes.bool, + isNavigationButtonsOnTheSide: PropTypes.bool }; export default NavigationButtons; diff --git a/src/components/NavigationButtons/NavigationButtons.css b/src/components/NavigationButtons/NavigationButtons.css index 08ca4ae52..097160979 100644 --- a/src/components/NavigationButtons/NavigationButtons.css +++ b/src/components/NavigationButtons/NavigationButtons.css @@ -9,7 +9,8 @@ overflow: hidden; } -.NavigationButton:hover { +.NavigationButton:hover, +.SideNavigationButton:hover { background: rgba(255, 0, 0, 0.8); } @@ -38,7 +39,8 @@ margin-left: -4rem; } -.NavigationButton.top.moveDown { +.NavigationButton.top.moveDown, +.SideNavigationButtonsContainer.moveDown { top: 240px; } @@ -53,7 +55,8 @@ margin-left: -4rem; } -.NavigationButton button { +.NavigationButton button, +.SideNavigationButton button { background: transparent; border: 0; width: 100%; @@ -63,11 +66,50 @@ cursor: pointer; } -.NavigationButton button svg { +.NavigationButton button svg, +.SideNavigationButton button svg { width: 5rem; height: 5rem; } +.SideNavigationButton.disable { + pointer-events: none; + background-color: rgb(196, 195, 195); +} + +.SideNavigationButton { + background-color: rgba(255, 0, 0, 0.5); + flex-grow: 1; +} + +.SideButtonScrollUp, +.SideButtonPreviousBoard { + margin-bottom: 2px; +} + +.SideButtonScrollDown, +.SideButtonToRootBoard { + margin-top: 2px; +} + +.SideNavigationButtonsContainer { + position: fixed; + top: 160px; + bottom: 0px; + z-index: 1000; + width: 5rem; + text-align: center; + font-size: 2rem; + overflow: hidden; + display: flex; + flex-direction: column; + justify-content: center; +} + +.SideNavigationButtonsContainer.ScrollButtons { + right: 0; +} + @media (max-width: 480px) { .NavigationButton { height: 6rem; @@ -90,4 +132,10 @@ width: 100%; height: 100%; } + /* .NavigationButton.SideButtonScrollUp{ + height: 26rem; + } + .NavigationButton.SideButtonScrollDown{ + height: 26rem; + } */ } diff --git a/src/components/ScrollButtons/ScrollButtons.js b/src/components/ScrollButtons/ScrollButtons.js index abd41ca08..ea906929f 100644 --- a/src/components/ScrollButtons/ScrollButtons.js +++ b/src/components/ScrollButtons/ScrollButtons.js @@ -71,26 +71,44 @@ const ScrollButtons = props => { return null; } + const classScrollUp = props.isNavigationButtonsOnTheSide + ? `SideNavigationButton SideButtonScrollUp ${ + !props.isScroll || isScrollTop ? 'disable' : '' + }` + : `NavigationButton top ${!props.isLocked ? 'moveDown' : ''}`; + + const classScrollDown = props.isNavigationButtonsOnTheSide + ? `SideNavigationButton SideButtonScrollDown ${ + !props.isScroll || isScrollDown ? 'disable' : '' + }` + : 'NavigationButton bottom'; + return ( - {!isScrollTop && ( -
- -
- )} - {!isScrollDown && ( -
- -
- )} +
+ {(!isScrollTop || props.isNavigationButtonsOnTheSide) && ( +
+ +
+ )} + {(!isScrollDown || props.isNavigationButtonsOnTheSide) && ( +
+ +
+ )} +
); }; @@ -100,7 +118,9 @@ ScrollButtons.props = { isLocked: PropTypes.bool, boardContainer: PropTypes.object, totalRows: PropTypes.number, - boardId: PropTypes.number + boardId: PropTypes.number, + isScroll: PropTypes.bool, + isNavigationButtonsOnTheSide: PropTypes.bool }; export default ScrollButtons; diff --git a/src/components/Settings/Navigation/Navigation.component.js b/src/components/Settings/Navigation/Navigation.component.js index 2748a8ba5..73e36f34c 100644 --- a/src/components/Settings/Navigation/Navigation.component.js +++ b/src/components/Settings/Navigation/Navigation.component.js @@ -10,6 +10,10 @@ import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction'; import Divider from '@material-ui/core/Divider'; import FullScreenDialog from '../../UI/FullScreenDialog'; import messages from './Navigation.messages'; +import MenuItem from '@material-ui/core/MenuItem'; +import FormControl from '@material-ui/core/FormControl'; +import Select from '@material-ui/core/Select'; +import { NAVIGATION_BUTTONS_STYLES } from './Navigation.constants'; import './Navigation.css'; import ResetToursItem from '../../UI/ResetToursItem'; @@ -84,6 +88,45 @@ class Navigation extends React.Component { this.props.updateNavigationSettings(this.state); }; + onNavigationSettingsChange(navigationSetting, event) { + const { + target: { value } + } = event; + this.setState({ [navigationSetting]: value }); + } + + renderNavigationButtonsLocationSelect() { + const name = 'navigationButtonsStyle'; + const actualButtonsStyle = NAVIGATION_BUTTONS_STYLES.filter( + style => style.value === this.state[name] + )[0]; + + return ( + + + + ); + } + render() { const { onClose } = this.props; return ( @@ -130,6 +173,30 @@ class Navigation extends React.Component { + + + } + secondary={ + + } + /> + + {this.renderNavigationButtonsLocationSelect()} + + + { return { @@ -26,6 +27,7 @@ const INITIAL_NAVIGATION_SETTINGS = { shareShowActive: false, caBackButtonActive: false, bigScrollButtonsActive: false, + navigationButtonsStyle: NAVIGATION_BUTTONS_STYLE_SIDES, quickUnlockActive: false, removeOutputActive: false, vocalizeFolders: false diff --git a/src/components/Settings/Navigation/__snapshots__/Navigation.test.js.snap b/src/components/Settings/Navigation/__snapshots__/Navigation.test.js.snap index ec506ad5b..f41cc1964 100644 --- a/src/components/Settings/Navigation/__snapshots__/Navigation.test.js.snap +++ b/src/components/Settings/Navigation/__snapshots__/Navigation.test.js.snap @@ -70,6 +70,49 @@ exports[`Navigation tests default renderer 1`] = ` + + + } + secondary={ + + } + /> + + + + + On the sides + + + On top + + + + + + + + + } + secondary={ + + } + /> + + + + + On the sides + + + On top + + + + + + + + + } + secondary={ + + } + /> + + + + + On the sides + + + On top + + + + + +