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

134 Commits

Author SHA1 Message Date
G.Ambatte
cf16566da8 Move Header Navigation button to Toolbar 2025-01-06 22:30:03 +13:00
Trevor Buckner
8159c408c8 Move formatVisiblePages
After simplifying, this has become a single-line function used in only one place. Can just be placed directly in the one place it is used.
2024-12-24 00:24:52 -05:00
Trevor Buckner
0632d78f71 Remove toolbar checks for empty visiblePages list
With `centerPage`, ToolBar will never receive an empty visiblePages array. No need to check if visiblepages.length == 0
2024-12-24 00:18:37 -05:00
Trevor Buckner
c0155052ea Further simplifying 2024-12-24 00:06:30 -05:00
Trevor Buckner
628b2542a0 Simplify logic for previous/next buttons 2024-12-24 00:02:55 -05:00
Trevor Buckner
d588a92147 Change page range to only display a single range
Having multiple page ranges visible is a weird edge case that only happens in two-page view. Simplifying logic to just group all page ranges together if a middle page is partly obscured.
2024-12-23 18:37:20 -05:00
Trevor Buckner
1b10a4001a Merge branch 'master' into pr/3845 2024-12-23 11:37:40 -05:00
Trevor Buckner
aa951ff96c Small cleanups 2024-12-09 17:04:16 -05:00
Trevor Buckner
bae9fe939d Merge branch 'master' into Intersection-Observer 2024-12-09 16:16:11 -05:00
Víctor Losada Hernández
2c5c3d40df revert toolbar changes 2024-12-09 22:08:39 +01:00
Víctor Losada Hernández
eca0f59b40 Merge branch 'master' of https://github.com/naturalcrit/homebrewery into adress-small-accessibility-concerns 2024-12-09 21:52:25 +01:00
Gazook89
9bc4b1fb56 Changes to core.less, reset.less, and toolbar
Making some changes to the reset.less so that some default UA button styling is removed.

Then, changing core.less so that the classic "HB" button styling is scoped to a certain class `.colorButton`.  This will make it easier to use the button element in other places.
2024-11-10 21:48:01 -06:00
Gazook89
28855d02a6 dynamic text input width to match characters 2024-11-07 19:46:07 -06:00
Gazook89
650ec04417 fix 'disabled' attribute on min/max of page range 2024-11-07 18:56:19 -06:00
Gazook89
9ef11bca99 lint and refactor 2024-11-07 10:40:44 -06:00
Gazook89
88b34a7ba3 Fix 'current page' input when zoomed in close
When the page is zoomed in very close, such that <30% of the page is in view, it doesn't register changes to the 'current page'.  This fixes that, passing in the 'centerPage' if 'visiblePages' is empty.

I don't love this fix, i think the visiblePages should always have *something* in it, but I can't quite figure out how to set that (since the normal update to visiblePages is happening in an observer that doesn't fire if nothing is in view).
2024-11-07 10:17:43 -06:00
Gazook89
63add047b6 'fit page' zoom button fits two pages in "facing" spread
If the 'facing' spread is active, the 'fit to view' zoom button fits two pages side by side in the view, rather than setting only one page in view.
2024-11-06 23:03:24 -06:00
Gazook89
3818424251 Adjust "next page" button
Prior to fix, the "next page" button in the toolbar wouldn't work well if there were multiple pages in view that were in a single 'row'.  This is because the logic is to take the pages that are "visible", take the max of those pages, and then scroll to that page.  But the issue is that if the 'max' page is in the same row as other pages, the range of visible pages doesn't change....the max will always be the same.

So the change here basically runs the scroll function twice-- if the first run results in the same 'max' page as before the scroll, it runs it again but with the target page being "max + 1", which will bump the target to the next row.
2024-11-06 21:24:18 -06:00
Gazook89
93b9f1d1da Merge branch 'Intersection-Observer' into Observer-Master-merge 2024-11-05 14:03:09 -06:00
Gazook89
b098d28407 linting 2024-11-04 14:08:06 -06:00
Gazook89
1be1b3b747 small accessibility changes. 2024-11-04 13:55:18 -06:00
Trevor Buckner
f63d2de8f4 Refactor toolbar view options (#2)
* Refactor toolbar view options

* Remove a couple more unused states
2024-11-01 22:19:48 -05:00
Gazook89
5ab867f21e adjust prev/next page buttons to meet expectations
i hope
2024-10-22 22:36:13 -05:00
Gazook89
4126188df1 linting 2024-10-21 22:29:58 -05:00
Gazook89
26050e2134 add comment 2024-10-21 22:20:52 -05:00
Gazook89
5c0d6e6012 move formatting of visible pages to toolbar
Doesn't need to be set in brewRenderer state and passed as a prop, when it can just do it's work directly in the toolbar.
2024-10-21 22:18:25 -05:00
Gazook89
de7b13bc15 Add some comments and cleanup
Little changes like removing console.logs and adding comments.
2024-10-21 22:13:12 -05:00
Gazook89
822d0c7738 Fix NaN/undefined showing on first load
Removes currentPage as a variable since it's been replaced.
2024-10-21 21:27:06 -05:00
Gazook89
183dd63021 style change on page text input
Reduce the visual prominence of the page input by using a darker background and a text color that matches the rest of the toolbar icons.  Darker background still indicates this is an interactive item (is an input), hopefully.
2024-10-21 21:19:49 -05:00
Gazook89
0afc2ab2e6 modify effect to enable Jump Editor button
This fixes the "jump editor to preview position" button.
2024-10-21 20:43:32 -05:00
Gazook89
41fdf48ad3 Setup Intersection Observers & more...
Bad commit here with too much stuff.  I apologize.

This sets up two Intersection Observers: the first captures every page that is at least 30% visible inside the `.pages` container, and the second captures every page that has at least one pixel on the horizontal center line of `.pages`.  Both can be arrays of integers (page index).

The "visiblePages" array is duplicated and formatted into a "formattedPages" state, which gets displayed in the toolbar.

The toolbar displays that, unless the user clicks into the page input and enters their own integer (only a single integer, no range), which can then jump the preview to that page on Enter or blur().

The Arrow 'change page' buttons jump the preview back and forth by a 'full set'.
 If one page is viewed at a time, this is moved on page a time, and if 10 pages are viewed at a time it jumps the pages by 10.

Left to do:  adapt the "jump editor to match preview" divider button to work with new "centerPage".
2024-10-21 00:30:45 -05:00
Gazook89
810c2140c9 move some toolbar specific styling to toolbar.less 2024-10-13 20:45:05 -05:00
Gazook89
96ae07a456 Small style change on checkbox inputs 2024-10-13 09:39:41 -05:00
Gazook89
b33d9264d3 unify terms to 'spreads'
This commit only renames things, changes no logic.  Any mention of "book", "view", or "mode" is renamed in relation to "spreads".

The AnchoredBox.jsx file is renamed to Anchored.jsx

Extra icons are deleted, and the remaining ones are renamed.
2024-10-12 23:25:14 -05:00
Gazook89
1741abc3fe Refactor AnchoredBox for greater flexibility
Big change to how the AnchoredBox component is structured so that it can be used in more than just one spot.  Now composed of the wrapper Anchored, with two children AnchoredTrigger and AnchoredBox, each of which can have their own arbitrary children.

Next steps will involve renaming the component file to Anchored.jsx, moving most styling out of the attached stylesheet (and into brewRenderer.less), and adding props to pass in Anchor Positioning properties.
2024-10-12 23:12:27 -05:00
Gazook89
27f471791d Small change in title phrasing 2024-10-12 13:28:25 -05:00
Gazook89
b58b9ca8f0 Merge branch 'View-Modes-Radio-Options' into View-Modes 2024-10-12 11:06:09 -05:00
Gazook89
ba0b3e7d93 Add toggle for Page Shadows
Reworks the pagesStyles to a broader object previewStyles.  This new object has this structure:

```
{
  targetElement : { cssProperty: value }
}
```
2024-10-12 11:05:23 -05:00
Gazook89
6fca21b6ed set defaultValue of gap sliders
defaultValue matches the normal styled values of the gap property on the .pages element.

removed the "tooltip" that showed the current value from the range sliders inside the anchoredbox (the gap sliders).
2024-10-11 22:53:38 -05:00
Gazook89
835305bcf6 Add a title to each button
add a role to the toolbr.
2024-10-11 22:32:53 -05:00
Gazook89
395f2d16fa change view mode toggles to indiv buttons
Rather than a single button with three states, it is three buttons.  Went with buttons with `role='radio'` rather than true radios mostly because that is what Radix does.
2024-10-11 22:06:41 -05:00
Víctor Losada Hernández
3e6884b506 dynamic input width 2024-10-11 00:32:28 +02:00
Gazook89
d6d6cc1e29 Add View Mode Options
Adds a new AnchoredBox component that is functionally a clone of the "saving error" notifications, but drops a lot of the JS in favor of the new (chrome-only!) CSS Anchor Positioning API.  In subsequent commits, either alternate styling or a polyfill will be added non-supported browsers.

The box contains a few inputs that modify the CSS applied to `.pages`, most critically a "start on right" toggle for the Facing Pages mode.
2024-10-06 21:51:44 -05:00
Gazook89
9fce94af63 Small CSS tweaks/display 'value' tooltip only if exists
The range slider should only display a tooltip for the value if the value attribute exists.  For example, the difference between controlled and uncontrolled inputs.

Update toolBar.less
2024-10-06 21:26:48 -05:00
Gazook89
41f390b305 Add a classname to recto configuration
Adding class name so that it can be toggled between 'recto' and 'verso'.  Verso being the normal left/right configuration, no styling is needed.  With recto, the first page is shifted to the second slot, or right side.
2024-10-06 21:24:50 -05:00
Gazook89
4259931b67 Merge branch 'master' into View-Modes 2024-10-05 21:39:06 -05:00
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