0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-26 16:02:38 +00:00
Commit Graph

33 Commits

Author SHA1 Message Date
Gazook89
051eed0e83 restructure html, eliminate .tool divs
Treat each input and button as a direct child of the `.group` class, removing the intermediate div and reassign the `tool` classname to those inputs and buttons.  One item, the current / total page "set", is wrapped in a .tool div because they should be considered one item (even within the .group container).

And then a bunch of CSS adjustments to match the new structure.
2024-08-20 21:08:07 -05:00
Gazook89
cdc2ffeff4 remove if statement that shouldn't occur at all
Removing a redundant if/else that shouldn't be possible now that the currentPage is clamped between 1 and totalPages.
2024-08-20 20:18:54 -05:00
Gazook89
83244485ab Move scrollToPage to toolbar component
Keeps toolbar functions within the toolbar component and reduces props that need to be sent down.
2024-08-20 15:15:36 -05:00
Gazook89
f5ee55d0ca keep current page number within existing page range
Make it so that if a user enters a page number higher than the total page count, it jumps them to last page.  if lower than 1, it jumps them to first page.
2024-08-19 23:40:21 -05:00
Gazook89
9510b4d097 wrap each set of toolbars into groups
Allows more styling options, including flex wrapping by group rather than individual button.
2024-08-19 23:14:45 -05:00
Gazook89
37c8ea4fd7 Add total page count and some styling
Displaying the total page count near the current page number means we can lose the bottom right toolbar entirely (the renderer could be added to top toolbar, or just left for the metadata info in title bar).
2024-08-19 23:01:55 -05:00
Gazook89
720e43e9d9 update page increment/decrement buttons
putting the `pageInput - 1` modifier in the `scrollToPage` method allows for more understandable button function ('back button' is `- 1` and 'forward button' is `+ 1`).
2024-08-19 22:43:41 -05:00
Gazook89
176977dd2a change input type to 'text'
Changing input type to text removes the "spinner" controls from within the text box.  The spinner buttons are an accessibility issue (the tiny buttons are tiny), and we already have better buttons for incrementing/decrementing page number.

Text box only accepts numbers.
2024-08-19 22:40:50 -05:00
Gazook89
a42b867bcb create handler function for controlled input
Moved onChange handler function to a component method and simplified it a smidge.

Must use parseInt now because the input type will change to 'text' rather than 'number'
2024-08-19 22:38:46 -05:00
Gazook89
1196a1577f update minZoom and maxZoom variable names
Forgot to update the zoom variable names after making them all uppercase at their assignments.
2024-08-19 22:35:35 -05:00
Gazook89
54b11b1a4c refactor useEffect for updating currentPage state
The current page and the current page input share the same value, so the useEffect hook can be simplified.
2024-08-19 22:34:32 -05:00
Gazook89
7fa9b3cdd2 rearrange state declarations for pages
totalPages shouldn't need to be in state, since this component won't be changing it.

renamed pageNumberInput to just pageInput.  Was just something that happened in the course of working on it.

currentPage doesn't need to have it's own state separate from pageInput, they should always be the same *value*.
2024-08-19 22:32:02 -05:00
Gazook89
2f42c3f857 change top level constants to all caps
Better matches style of top level constants elsewhere in repo
2024-08-19 22:27:49 -05:00
Gazook89
5a11b7918e refactor slider onChange and button onClick
Moved the zoomLevel state assignment to a newer useState hook function, making it easier (and shorter) to update that state within event handlers.

The slider onChange is a single easy line, and the buttons handlers are two lines for clarity.
2024-08-18 00:02:49 -05:00
Gazook89
36ab6923ed remove zoomInput state property
zoomLevel and zoomInput should always be the same, so I've removed one.
2024-08-17 23:43:32 -05:00
Gazook89
7cc967ad49 setZoomLevel to no longer use if/else
Remove the 'in'/'out' parameter of the function and just have the buttons send postive or negative integers equal to the desired change in the zoom.  No need for if/else statements using strings.
2024-08-17 23:39:59 -05:00
Gazook89
d108088295 remove unneeded handler 2024-08-17 21:23:12 -05:00
Gazook89
8be3154865 rename functions/attributes
updateZoom() => handleZoom

updateZoom prop => onZoomChange

More clarity of prop versus handler function.
2024-08-17 20:48:30 -05:00
Gazook89
efb4c67e2a use zoom icons rather than text 2024-08-17 15:40:52 -05:00
Gazook89
e9e49e39fb Set preview zoom to update with onChange
Commented out the existing onChange handler, switched the onMouseUp that actually applies the zoom to onChange.
2024-08-17 13:59:58 -05:00
Gazook89
ee4eb19f1e Run ESLint auto lint (spaces to tabs mostly) 2024-08-17 13:57:50 -05:00
Víctor Losada Hernández
5ee4ada112 "Updated ToolBar component: added zoom level limits, refactored zoom level handling, and modified CSS styles for input and slider elements." 2024-08-16 15:58:00 +02:00
Víctor Losada Hernández
f0765b5aaa "refactored ToolBar component to use a single state object, and updated styles in toolBar.less" 2024-08-15 20:05:23 +02:00
Víctor Losada Hernández
0c9958f461 "Removed '%' symbol handling from zoom input value" 2024-06-02 16:05:57 +02:00
Víctor Losada Hernández
ed92628012 udpate input zoom 2024-05-31 21:02:03 +02:00
Víctor Losada Hernández
12de8c5221 fix last page navigation 2024-05-31 21:00:01 +02:00
Víctor Losada Hernández
afa0571382 fix page displacement 2024-05-31 20:57:09 +02:00
Víctor Losada Hernández
75c592b437 "Update onPageChange argument in nextPage button onClick handler" 2024-05-31 20:28:34 +02:00
Víctor Losada Hernández
000c3db8cd fixed page error 2024-05-31 20:14:41 +02:00
Víctor Losada Hernández
f23c0bccbc "Added onKeyPress event handler to zoom input and page number input to blur the target on Enter key press." 2024-05-31 19:46:40 +02:00
Víctor Losada Hernández
69db1e2cb7 change page works, added change zoom via input too 2024-05-31 19:43:09 +02:00
Víctor Losada Hernández
4543881808 functional zoom 2024-05-28 08:51:23 +02:00
Víctor Losada Hernández
bc9ab284d8 Initial UI 2024-05-21 08:01:50 +02:00