mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-01 10:52:46 +00:00
Merge pull request #3845 from Gazook89/Intersection-Observer
Intersection Observers for getting "Current Page(s)"
This commit is contained in:
@@ -7,6 +7,11 @@ import './Anchored.less';
|
|||||||
// **The Anchor Positioning API is not available in Firefox yet**
|
// **The Anchor Positioning API is not available in Firefox yet**
|
||||||
// So in Firefox the positioning isn't perfect but is likely sufficient, and FF team seems to be working on the API quickly.
|
// So in Firefox the positioning isn't perfect but is likely sufficient, and FF team seems to be working on the API quickly.
|
||||||
|
|
||||||
|
// When Anchor Positioning is added to Firefox, this can also be rewritten using the Popover API-- add the `popover` attribute
|
||||||
|
// to the container div, which will render the container in the *top level* and give it better interactions like
|
||||||
|
// click outside to dismiss. **Do not** add without Anchor, though, because positioning is very limited with the `popover`
|
||||||
|
// attribute.
|
||||||
|
|
||||||
|
|
||||||
const Anchored = ({ children })=>{
|
const Anchored = ({ children })=>{
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*eslint max-lines: ["warn", {"max": 300, "skipBlankLines": true, "skipComments": true}]*/
|
/*eslint max-lines: ["warn", {"max": 300, "skipBlankLines": true, "skipComments": true}]*/
|
||||||
require('./brewRenderer.less');
|
require('./brewRenderer.less');
|
||||||
const React = require('react');
|
const React = require('react');
|
||||||
const { useState, useRef, useCallback, useMemo } = React;
|
const { useState, useRef, useMemo, useEffect } = React;
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
|
||||||
const MarkdownLegacy = require('naturalcrit/markdownLegacy.js');
|
const MarkdownLegacy = require('naturalcrit/markdownLegacy.js');
|
||||||
@@ -36,8 +36,46 @@ const BrewPage = (props)=>{
|
|||||||
index : 0,
|
index : 0,
|
||||||
...props
|
...props
|
||||||
};
|
};
|
||||||
|
const pageRef = useRef(null);
|
||||||
const cleanText = safeHTML(props.contents);
|
const cleanText = safeHTML(props.contents);
|
||||||
return <div className={props.className} id={`p${props.index + 1}`} style={props.style}>
|
|
||||||
|
useEffect(()=>{
|
||||||
|
if(!pageRef.current) return;
|
||||||
|
|
||||||
|
// Observer for tracking pages within the `.pages` div
|
||||||
|
const visibleObserver = new IntersectionObserver(
|
||||||
|
(entries)=>{
|
||||||
|
entries.forEach((entry)=>{
|
||||||
|
if(entry.isIntersecting)
|
||||||
|
props.onVisibilityChange(props.index + 1, true, false); // add page to array of visible pages.
|
||||||
|
else
|
||||||
|
props.onVisibilityChange(props.index + 1, false, false);
|
||||||
|
}
|
||||||
|
)},
|
||||||
|
{ threshold: .3, rootMargin: '0px 0px 0px 0px' } // detect when >30% of page is within bounds.
|
||||||
|
);
|
||||||
|
|
||||||
|
// Observer for tracking the page at the center of the iframe.
|
||||||
|
const centerObserver = new IntersectionObserver(
|
||||||
|
(entries)=>{
|
||||||
|
entries.forEach((entry)=>{
|
||||||
|
if(entry.isIntersecting)
|
||||||
|
props.onVisibilityChange(props.index + 1, true, true); // Set this page as the center page
|
||||||
|
}
|
||||||
|
)},
|
||||||
|
{ threshold: 0, rootMargin: '-50% 0px -50% 0px' } // Detect when the page is at the center
|
||||||
|
);
|
||||||
|
|
||||||
|
// attach observers to each `.page`
|
||||||
|
visibleObserver.observe(pageRef.current);
|
||||||
|
centerObserver.observe(pageRef.current);
|
||||||
|
return ()=>{
|
||||||
|
visibleObserver.disconnect();
|
||||||
|
centerObserver.disconnect();
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return <div className={props.className} id={`p${props.index + 1}`} data-index={props.index} ref={pageRef} style={props.style}>
|
||||||
<div className='columnWrapper' dangerouslySetInnerHTML={{ __html: cleanText }} />
|
<div className='columnWrapper' dangerouslySetInnerHTML={{ __html: cleanText }} />
|
||||||
</div>;
|
</div>;
|
||||||
};
|
};
|
||||||
@@ -64,8 +102,10 @@ const BrewRenderer = (props)=>{
|
|||||||
};
|
};
|
||||||
|
|
||||||
const [state, setState] = useState({
|
const [state, setState] = useState({
|
||||||
isMounted : false,
|
isMounted : false,
|
||||||
visibility : 'hidden'
|
visibility : 'hidden',
|
||||||
|
visiblePages : [],
|
||||||
|
centerPage : 1
|
||||||
});
|
});
|
||||||
|
|
||||||
const [displayOptions, setDisplayOptions] = useState({
|
const [displayOptions, setDisplayOptions] = useState({
|
||||||
@@ -83,34 +123,23 @@ const BrewRenderer = (props)=>{
|
|||||||
rawPages = props.text.split(/^\\page$/gm);
|
rawPages = props.text.split(/^\\page$/gm);
|
||||||
}
|
}
|
||||||
|
|
||||||
const scrollToHash = (hash)=>{
|
const handlePageVisibilityChange = (pageNum, isVisible, isCenter)=>{
|
||||||
if(!hash) return;
|
setState((prevState)=>{
|
||||||
|
const updatedVisiblePages = new Set(prevState.visiblePages);
|
||||||
|
if(!isCenter)
|
||||||
|
isVisible ? updatedVisiblePages.add(pageNum) : updatedVisiblePages.delete(pageNum);
|
||||||
|
|
||||||
const iframeDoc = document.getElementById('BrewRenderer').contentDocument;
|
return {
|
||||||
let anchor = iframeDoc.querySelector(hash);
|
...prevState,
|
||||||
|
visiblePages : [...updatedVisiblePages].sort((a, b)=>a - b),
|
||||||
|
centerPage : isCenter ? pageNum : prevState.centerPage
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
if(anchor) {
|
if(isCenter)
|
||||||
anchor.scrollIntoView({ behavior: 'smooth' });
|
props.onPageChange(pageNum);
|
||||||
} else {
|
|
||||||
// Use MutationObserver to wait for the element if it's not immediately available
|
|
||||||
new MutationObserver((mutations, obs)=>{
|
|
||||||
anchor = iframeDoc.querySelector(hash);
|
|
||||||
if(anchor) {
|
|
||||||
anchor.scrollIntoView({ behavior: 'smooth' });
|
|
||||||
obs.disconnect();
|
|
||||||
}
|
|
||||||
}).observe(iframeDoc, { childList: true, subtree: true });
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateCurrentPage = useCallback(_.throttle((e)=>{
|
|
||||||
const { scrollTop, clientHeight, scrollHeight } = e.target;
|
|
||||||
const totalScrollableHeight = scrollHeight - clientHeight;
|
|
||||||
const currentPageNumber = Math.max(Math.ceil((scrollTop / totalScrollableHeight) * rawPages.length), 1);
|
|
||||||
|
|
||||||
props.onPageChange(currentPageNumber);
|
|
||||||
}, 200), []);
|
|
||||||
|
|
||||||
const isInView = (index)=>{
|
const isInView = (index)=>{
|
||||||
if(!state.isMounted)
|
if(!state.isMounted)
|
||||||
return false;
|
return false;
|
||||||
@@ -137,19 +166,21 @@ const BrewRenderer = (props)=>{
|
|||||||
};
|
};
|
||||||
|
|
||||||
const renderPage = (pageText, index)=>{
|
const renderPage = (pageText, index)=>{
|
||||||
|
|
||||||
|
const styles = {
|
||||||
|
...(!displayOptions.pageShadows ? { boxShadow: 'none' } : {})
|
||||||
|
// Add more conditions as needed
|
||||||
|
};
|
||||||
|
|
||||||
if(props.renderer == 'legacy') {
|
if(props.renderer == 'legacy') {
|
||||||
const html = MarkdownLegacy.render(pageText);
|
const html = MarkdownLegacy.render(pageText);
|
||||||
return <BrewPage className='page phb' index={index} key={index} contents={html} />;
|
|
||||||
|
return <BrewPage className='page phb' index={index} key={index} contents={html} style={styles} onVisibilityChange={handlePageVisibilityChange} />;
|
||||||
} else {
|
} else {
|
||||||
pageText += `\n\n \n\\column\n `; //Artificial column break at page end to emulate column-fill:auto (until `wide` is used, when column-fill:balance will reappear)
|
pageText += `\n\n \n\\column\n `; //Artificial column break at page end to emulate column-fill:auto (until `wide` is used, when column-fill:balance will reappear)
|
||||||
const html = Markdown.render(pageText, index);
|
const html = Markdown.render(pageText, index);
|
||||||
|
|
||||||
const styles = {
|
return <BrewPage className='page' index={index} key={index} contents={html} style={styles} onVisibilityChange={handlePageVisibilityChange} />;
|
||||||
...(!displayOptions.pageShadows ? { boxShadow: 'none' } : {})
|
|
||||||
// Add more conditions as needed
|
|
||||||
};
|
|
||||||
|
|
||||||
return <BrewPage className='page' index={index} key={index} contents={html} style={styles} />;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -182,6 +213,26 @@ const BrewRenderer = (props)=>{
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const scrollToHash = (hash)=>{
|
||||||
|
if(!hash) return;
|
||||||
|
|
||||||
|
const iframeDoc = document.getElementById('BrewRenderer').contentDocument;
|
||||||
|
let anchor = iframeDoc.querySelector(hash);
|
||||||
|
|
||||||
|
if(anchor) {
|
||||||
|
anchor.scrollIntoView({ behavior: 'smooth' });
|
||||||
|
} else {
|
||||||
|
// Use MutationObserver to wait for the element if it's not immediately available
|
||||||
|
new MutationObserver((mutations, obs)=>{
|
||||||
|
anchor = iframeDoc.querySelector(hash);
|
||||||
|
if(anchor) {
|
||||||
|
anchor.scrollIntoView({ behavior: 'smooth' });
|
||||||
|
obs.disconnect();
|
||||||
|
}
|
||||||
|
}).observe(iframeDoc, { childList: true, subtree: true });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const frameDidMount = ()=>{ //This triggers when iFrame finishes internal "componentDidMount"
|
const frameDidMount = ()=>{ //This triggers when iFrame finishes internal "componentDidMount"
|
||||||
scrollToHash(window.location.hash);
|
scrollToHash(window.location.hash);
|
||||||
|
|
||||||
@@ -217,13 +268,13 @@ const BrewRenderer = (props)=>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
const renderedStyle = useMemo(()=>renderStyle(), [props.style, props.themeBundle]);
|
const renderedStyle = useMemo(()=>renderStyle(), [props.style, props.themeBundle]);
|
||||||
renderedPages = useMemo(()=>renderPages(), [displayOptions.pageShadows, props.text]);
|
renderedPages = useMemo(()=>renderPages(), [props.text, displayOptions]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/*render dummy page while iFrame is mounting.*/}
|
{/*render dummy page while iFrame is mounting.*/}
|
||||||
{!state.isMounted
|
{!state.isMounted
|
||||||
? <div className='brewRenderer' onScroll={updateCurrentPage}>
|
? <div className='brewRenderer'>
|
||||||
<div className='pages'>
|
<div className='pages'>
|
||||||
{renderDummyPage(1)}
|
{renderDummyPage(1)}
|
||||||
</div>
|
</div>
|
||||||
@@ -236,7 +287,7 @@ const BrewRenderer = (props)=>{
|
|||||||
<NotificationPopup />
|
<NotificationPopup />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ToolBar displayOptions={displayOptions} currentPage={props.currentBrewRendererPageNum} totalPages={rawPages.length} onDisplayOptionsChange={handleDisplayOptionsChange} />
|
<ToolBar displayOptions={displayOptions} onDisplayOptionsChange={handleDisplayOptionsChange} visiblePages={state.visiblePages.length > 0 ? state.visiblePages : [state.centerPage]} totalPages={rawPages.length}/>
|
||||||
|
|
||||||
{/*render in iFrame so broken code doesn't crash the site.*/}
|
{/*render in iFrame so broken code doesn't crash the site.*/}
|
||||||
<Frame id='BrewRenderer' initialContent={INITIAL_CONTENT}
|
<Frame id='BrewRenderer' initialContent={INITIAL_CONTENT}
|
||||||
@@ -245,18 +296,17 @@ const BrewRenderer = (props)=>{
|
|||||||
onClick={()=>{emitClick();}}
|
onClick={()=>{emitClick();}}
|
||||||
>
|
>
|
||||||
<div className={`brewRenderer ${global.config.deployment && 'deployment'}`}
|
<div className={`brewRenderer ${global.config.deployment && 'deployment'}`}
|
||||||
onScroll={updateCurrentPage}
|
|
||||||
onKeyDown={handleControlKeys}
|
onKeyDown={handleControlKeys}
|
||||||
tabIndex={-1}
|
tabIndex={-1}
|
||||||
style={ styleObject }>
|
style={ styleObject }
|
||||||
|
>
|
||||||
|
|
||||||
{/* Apply CSS from Style tab and render pages from Markdown tab */}
|
{/* Apply CSS from Style tab and render pages from Markdown tab */}
|
||||||
{state.isMounted
|
{state.isMounted
|
||||||
&&
|
&&
|
||||||
<>
|
<>
|
||||||
{renderedStyle}
|
{renderedStyle}
|
||||||
<div lang={`${props.lang || 'en'}`} style={pagesStyle} className={
|
<div className={`pages ${displayOptions.startOnRight ? 'recto' : 'verso'} ${displayOptions.spread}`} lang={`${props.lang || 'en'}`} style={pagesStyle}>
|
||||||
`pages ${displayOptions.startOnRight ? 'recto' : 'verso'} ${displayOptions.spread}` } >
|
|
||||||
{renderedPages}
|
{renderedPages}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
grid-template-columns: repeat(2, auto);
|
grid-template-columns: repeat(2, auto);
|
||||||
grid-template-rows: repeat(3, auto);
|
grid-template-rows: repeat(3, auto);
|
||||||
gap: 10px 10px;
|
gap: 10px 10px;
|
||||||
justify-content: center;
|
justify-content: safe center;
|
||||||
&.recto .page:first-child {
|
&.recto .page:first-child {
|
||||||
// sets first page on 'right' ('recto') of the preview, as if for a Cover page.
|
// sets first page on 'right' ('recto') of the preview, as if for a Cover page.
|
||||||
// todo: add a checkbox to toggle this setting
|
// todo: add a checkbox to toggle this setting
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
justify-content: flex-start;
|
justify-content: safe center;
|
||||||
& :where(.page) {
|
& :where(.page) {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
margin-left: unset !important;
|
margin-left: unset !important;
|
||||||
|
|||||||
@@ -1,29 +1,30 @@
|
|||||||
|
/* eslint-disable max-lines */
|
||||||
require('./toolBar.less');
|
require('./toolBar.less');
|
||||||
const React = require('react');
|
const React = require('react');
|
||||||
const { useState, useEffect } = React;
|
const { useState, useEffect } = React;
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
|
||||||
import { Anchored, AnchoredBox, AnchoredTrigger } from '../../../components/Anchored.jsx';
|
import { Anchored, AnchoredBox, AnchoredTrigger } from '../../../components/Anchored.jsx';
|
||||||
// import * as ZoomIcons from '../../../icons/icon-components/zoomIcons.jsx';
|
|
||||||
|
|
||||||
const MAX_ZOOM = 300;
|
const MAX_ZOOM = 300;
|
||||||
const MIN_ZOOM = 10;
|
const MIN_ZOOM = 10;
|
||||||
|
|
||||||
const ToolBar = ({ displayOptions, currentPage, totalPages, onDisplayOptionsChange })=>{
|
const ToolBar = ({ displayOptions, onDisplayOptionsChange, visiblePages, totalPages })=>{
|
||||||
|
|
||||||
const [pageNum, setPageNum] = useState(currentPage);
|
const [pageNum, setPageNum] = useState(1);
|
||||||
const [toolsVisible, setToolsVisible] = useState(true);
|
const [toolsVisible, setToolsVisible] = useState(true);
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
setPageNum(currentPage);
|
// format multiple visible pages as a range (e.g. "150-153")
|
||||||
}, [currentPage]);
|
const pageRange = visiblePages.length === 1 ? `${visiblePages[0]}` : `${visiblePages[0]} - ${visiblePages.at(-1)}`;
|
||||||
|
setPageNum(pageRange);
|
||||||
|
}, [visiblePages]);
|
||||||
|
|
||||||
const handleZoomButton = (zoom)=>{
|
const handleZoomButton = (zoom)=>{
|
||||||
handleOptionChange('zoomLevel', _.round(_.clamp(zoom, MIN_ZOOM, MAX_ZOOM)));
|
handleOptionChange('zoomLevel', _.round(_.clamp(zoom, MIN_ZOOM, MAX_ZOOM)));
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOptionChange = (optionKey, newValue)=>{
|
const handleOptionChange = (optionKey, newValue)=>{
|
||||||
//setDisplayOptions(prevOptions => ({ ...prevOptions, [optionKey]: newValue }));
|
|
||||||
onDisplayOptionsChange({ ...displayOptions, [optionKey]: newValue });
|
onDisplayOptionsChange({ ...displayOptions, [optionKey]: newValue });
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -32,16 +33,16 @@ const ToolBar = ({ displayOptions, currentPage, totalPages, onDisplayOptionsChan
|
|||||||
setPageNum(parseInt(pageInput)); // input type is 'text', so `page` comes in as a string, not number.
|
setPageNum(parseInt(pageInput)); // input type is 'text', so `page` comes in as a string, not number.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// scroll to a page, used in the Prev/Next Page buttons.
|
||||||
const scrollToPage = (pageNumber)=>{
|
const scrollToPage = (pageNumber)=>{
|
||||||
|
if(typeof pageNumber !== 'number') return;
|
||||||
pageNumber = _.clamp(pageNumber, 1, totalPages);
|
pageNumber = _.clamp(pageNumber, 1, totalPages);
|
||||||
const iframe = document.getElementById('BrewRenderer');
|
const iframe = document.getElementById('BrewRenderer');
|
||||||
const brewRenderer = iframe?.contentWindow?.document.querySelector('.brewRenderer');
|
const brewRenderer = iframe?.contentWindow?.document.querySelector('.brewRenderer');
|
||||||
const page = brewRenderer?.querySelector(`#p${pageNumber}`);
|
const page = brewRenderer?.querySelector(`#p${pageNumber}`);
|
||||||
page?.scrollIntoView({ block: 'start' });
|
page?.scrollIntoView({ block: 'start' });
|
||||||
setPageNum(pageNumber);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const calculateChange = (mode)=>{
|
const calculateChange = (mode)=>{
|
||||||
const iframe = document.getElementById('BrewRenderer');
|
const iframe = document.getElementById('BrewRenderer');
|
||||||
const iframeWidth = iframe.getBoundingClientRect().width;
|
const iframeWidth = iframe.getBoundingClientRect().width;
|
||||||
@@ -57,8 +58,12 @@ const ToolBar = ({ displayOptions, currentPage, totalPages, onDisplayOptionsChan
|
|||||||
desiredZoom = (iframeWidth / widestPage) * 100;
|
desiredZoom = (iframeWidth / widestPage) * 100;
|
||||||
|
|
||||||
} else if(mode == 'fit'){
|
} else if(mode == 'fit'){
|
||||||
|
let minDimRatio;
|
||||||
// find the page with the largest single dim (height or width) so that zoom can be adapted to fit it.
|
// find the page with the largest single dim (height or width) so that zoom can be adapted to fit it.
|
||||||
const minDimRatio = [...pages].reduce((minRatio, page)=>Math.min(minRatio, iframeWidth / page.offsetWidth, iframeHeight / page.offsetHeight), Infinity);
|
if(displayOptions.spread === 'facing')
|
||||||
|
minDimRatio = [...pages].reduce((minRatio, page)=>Math.min(minRatio, iframeWidth / page.offsetWidth / 2), Infinity); // if 'facing' spread, fit two pages in view
|
||||||
|
else
|
||||||
|
minDimRatio = [...pages].reduce((minRatio, page)=>Math.min(minRatio, iframeWidth / page.offsetWidth, iframeHeight / page.offsetHeight), Infinity);
|
||||||
|
|
||||||
desiredZoom = minDimRatio * 100;
|
desiredZoom = minDimRatio * 100;
|
||||||
}
|
}
|
||||||
@@ -185,8 +190,8 @@ const ToolBar = ({ displayOptions, currentPage, totalPages, onDisplayOptionsChan
|
|||||||
className='previousPage tool'
|
className='previousPage tool'
|
||||||
type='button'
|
type='button'
|
||||||
title='Previous Page(s)'
|
title='Previous Page(s)'
|
||||||
onClick={()=>scrollToPage(pageNum - 1)}
|
onClick={()=>scrollToPage(_.min(visiblePages) - visiblePages.length)}
|
||||||
disabled={pageNum <= 1}
|
disabled={visiblePages.includes(1)}
|
||||||
>
|
>
|
||||||
<i className='fas fa-arrow-left'></i>
|
<i className='fas fa-arrow-left'></i>
|
||||||
</button>
|
</button>
|
||||||
@@ -205,6 +210,7 @@ const ToolBar = ({ displayOptions, currentPage, totalPages, onDisplayOptionsChan
|
|||||||
onChange={(e)=>handlePageInput(e.target.value)}
|
onChange={(e)=>handlePageInput(e.target.value)}
|
||||||
onBlur={()=>scrollToPage(pageNum)}
|
onBlur={()=>scrollToPage(pageNum)}
|
||||||
onKeyDown={(e)=>e.key == 'Enter' && scrollToPage(pageNum)}
|
onKeyDown={(e)=>e.key == 'Enter' && scrollToPage(pageNum)}
|
||||||
|
style={{ width: `${pageNum.length}ch` }}
|
||||||
/>
|
/>
|
||||||
<span id='page-count' title='Total Page Count'>/ {totalPages}</span>
|
<span id='page-count' title='Total Page Count'>/ {totalPages}</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -214,8 +220,8 @@ const ToolBar = ({ displayOptions, currentPage, totalPages, onDisplayOptionsChan
|
|||||||
className='tool'
|
className='tool'
|
||||||
type='button'
|
type='button'
|
||||||
title='Next Page(s)'
|
title='Next Page(s)'
|
||||||
onClick={()=>scrollToPage(pageNum + 1)}
|
onClick={()=>scrollToPage(_.max(visiblePages) + 1)}
|
||||||
disabled={pageNum >= totalPages}
|
disabled={visiblePages.includes(totalPages)}
|
||||||
>
|
>
|
||||||
<i className='fas fa-arrow-right'></i>
|
<i className='fas fa-arrow-right'></i>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -104,9 +104,9 @@
|
|||||||
height : 1.5em;
|
height : 1.5em;
|
||||||
padding : 2px 5px;
|
padding : 2px 5px;
|
||||||
font-family : 'Open Sans', sans-serif;
|
font-family : 'Open Sans', sans-serif;
|
||||||
color : #000000;
|
color : inherit;
|
||||||
background : #EEEEEE;
|
background : #3B3B3B;
|
||||||
border : 1px solid gray;
|
border : none;
|
||||||
&:focus { outline : 1px solid #D3D3D3; }
|
&:focus { outline : 1px solid #D3D3D3; }
|
||||||
|
|
||||||
// `.range-input` if generic to all range inputs, or `#zoom-slider` if only for zoom slider
|
// `.range-input` if generic to all range inputs, or `#zoom-slider` if only for zoom slider
|
||||||
@@ -141,7 +141,7 @@
|
|||||||
|
|
||||||
// `.text-input` if generic to all range inputs, or `#page-input` if only for current page input
|
// `.text-input` if generic to all range inputs, or `#page-input` if only for current page input
|
||||||
&#page-input {
|
&#page-input {
|
||||||
width : 4ch;
|
min-width : 5ch;
|
||||||
margin-right : 1ch;
|
margin-right : 1ch;
|
||||||
text-align : center;
|
text-align : center;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user