0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-27 00:42:40 +00:00
Commit Graph

84 Commits

Author SHA1 Message Date
Trevor Buckner
5cc5eec619 Lint toolbar and snippetbar 2024-09-16 01:41:46 -04:00
Trevor Buckner
58a2993fe1 use className for react classes
Avoid warning of conflict with JS "class" keyword.
2024-09-09 11:00:45 -04:00
Gazook89
49e072f03f Add button to toggle Preview tools
Toggles a state variable to either visible or hidden which is used to set a related class on the toolbar.  The hiding is done with CSS, just reducing the width of the toolbar and the opacity of the tools.
2024-09-04 13:54:55 -05:00
Gazook89
a7ddeafd06 revert change 2024-08-27 11:59:29 -05:00
Trevor Buckner
0ce3ac9be2 Merge branch 'master' into Fix-Toolbar-Positioning 2024-08-27 11:27:36 -04:00
Gazook89
a7c4b78ec8 set position relative, remove padding 2024-08-27 09:03:24 -05:00
Gazook89
7bc0af9a8c utilize Infinity and reduce() 2024-08-27 08:42:45 -05:00
Gazook89
e06611a90f set all zoom buttons to use handleZoomButton
All zoom buttons run through same handler now.

They no longer take only the delta of the current zoom and desired zoom-- they take the actual desired zoom.

calculateZoom is now calculateChange, to help get the desired delta.
2024-08-26 16:16:13 -05:00
Gazook89
7b767368df Change icons to mask-image
Removes icons as components, uses mask-image instead.

Sets a size on the .fac icons to 1em so by default they are 1em and retain their aspect ratio.

rename the icon files for consistency.
2024-08-26 15:51:35 -05:00
Trevor Buckner
d4d27aab6a Merge branch 'master' into Fill-Pane-Buttons 2024-08-24 23:59:19 -04:00
Trevor Buckner
4b0b56dd35 Lint the jsx files 2024-08-24 23:55:17 -04:00
Trevor Buckner
bf6eae7b3c Simplify some logic in Toolbar 2024-08-24 23:54:09 -04:00
Trevor Buckner
5069eadd0a Manual tidying of .less files 2024-08-24 23:53:07 -04:00
Gazook89
94ae33d328 Merge branch 'pr/3499' into Fill-Pane-Buttons 2024-08-24 21:28:13 -05:00
Gazook89
690c683943 select text when clicking into page input 2024-08-24 09:08:19 -05:00
Gazook89
3acf90dfdb Add handlePageChange() to control input
Reintroducing handlePageChange() method to handle the page input separately from the scroll function.  It tests the regex pattern on the string, parses to integer, and sets pageNum state.

scrollToPage also now sets the pageNum state after performing the scroll so the input box matches the new current page.
2024-08-24 09:05:43 -05:00
Gazook89
6bb5d04f07 round the calculated zoom level 2024-08-23 23:02:04 -05:00
Gazook89
b0b1f7fd0b update method calls for zoom buttons
update method names in onClick events to match latest changes to the branch this builds from.
2024-08-23 22:58:43 -05:00
Gazook89
c25bf95a66 Merge branch 'pr/3499' into Fill-Pane-Buttons 2024-08-23 22:56:37 -05:00
Gazook89
a351013359 remove some odd if statement in onChange 2024-08-23 22:54:29 -05:00
Gazook89
f3ed174b0e eslint and stylelint
stylelint has a problem with the `:horizontal` pseudo selector in brewRenderer.jsx, which is being used to apply some styling to the custom scrollbars.  As far as i can tell, the selector is not standards-track, so that is probably why.  Not sure if we want to adjsut our stylelint config to allow it?
2024-08-23 19:16:59 -05:00
Gazook89
977d0ea73a eslint 2024-08-23 19:05:23 -05:00
Gazook89
04effa2150 removed whitepsace 2024-08-23 18:59:32 -05:00
Gazook89
7f694e6ca7 fold handlePageChange directly into input onChange
Moved the single-line handler to operate directly in the onChange handler of the input that is calling it.

Considered doing the same with handleZoomChange, but that handler is used by two buttons rather than just one.
2024-08-23 18:58:51 -05:00
Gazook89
769a03916b rename pageInput state variable to pageNum 2024-08-23 18:48:36 -05:00
Gazook89
f34107ee1d fix typo 2024-08-23 15:06:48 -05:00
Gazook89
8dadc57934 adjustment to toolbar spacing between items
testing the use of spacing to separate tool groups.  Could alternatively use a thin vertical bar.
2024-08-22 23:22:39 -05:00
Gazook89
0dc9e9ecdb Add 2 custom zoom related icons
New icons for Zoom to Fit, and Fit Width buttons.  Used SVGR online tool to create react components and then combined them.

If doing in future, be sure to set currentColor on `fill` property in the SVG itself.  Make the SVGs as closed curves only (don't rely on stroke).  set only a width property, not height.
2024-08-22 23:21:48 -05:00
Gazook89
977b871967 Combine toFit and toFill functions
Reduce overlap of the two functions and just require a 'mode' parameter.  Could like roll a 'manual' mode into this for the zoom slider, as well, but skipping for now.
2024-08-22 23:19:24 -05:00
Gazook89
90dd4326e7 Add a toFit() method to fit largest page in view
Adding a real toFit() button that takes the page with the largest single dimension (height or width) and makes it fit within the pane.
2024-08-22 20:56:42 -05:00
Gazook89
4c71987866 change the toFit method to toFill
Realized this method is filling the preview pane, and that toFit would force the zoom to show the entirety of a single page at once.
2024-08-22 15:56:23 -05:00
Gazook89
8965bb60aa add a toFit() method to determine zoom change
Adds a toFit() method to determine the delta/change needed to the current zoomLevel to fit the page to the pane, so that the widest page fits just inside the pane.
2024-08-22 15:52:52 -05:00
Gazook89
64fb032622 fix className 2024-08-22 15:51:16 -05:00
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
2cf73698e8 white space lint 2024-08-19 23:38:48 -05:00
Gazook89
28a06348ab style tool groups, minor tweaks to spacing 2024-08-19 23:15:02 -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
05dd5e4c04 Change .toolbar position to absolute
Set as relative position, the toolbar (and mysteriously, the pageInfo box) would jump up 29px (toolbar height) when the "next page" button was clicked.  absolute pos fixes this.
2024-08-18 18:51:46 -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