scroll parameters now dependent on state

pull/5370/head
Joseph Izang 3 years ago committed by yann300
parent 0bbc4423af
commit 5dcbbcb14b
  1. 8
      libs/remix-ui/vertical-icons-panel/src/lib/reducers/verticalScrollReducer.ts
  2. 8
      libs/remix-ui/vertical-icons-panel/src/lib/remix-ui-vertical-icons-panel.tsx

@ -6,12 +6,10 @@ export type actionType = {
export function verticalScrollReducer (prevState: any, actionPayload: actionType) { export function verticalScrollReducer (prevState: any, actionPayload: actionType) {
if (actionPayload.type === 'resize') { if (actionPayload.type === 'resize') {
// actionPayload.payload.scrollHeight > actionPayload.payload.clientHeight
console.log(`values being checked are ${actionPayload.payload.scrollHeight} > ${actionPayload.payload.clientHeight}`) console.log(`values being checked are ${actionPayload.payload.scrollHeight} > ${actionPayload.payload.clientHeight}`)
const newvals = actionPayload.payload let { scrollHeight, clientHeight, scrollState } = actionPayload.payload
return { ...newvals } if (scrollHeight > clientHeight) scrollState = true
} else if (actionPayload.type === 'other') { return { scrollHeight, clientHeight, scrollState }
// actionPayload.payload.scrollHeight > actionPayload.payload.clientHeight
} }
return prevState return prevState
} }

@ -53,10 +53,6 @@ export function RemixUiVerticalIconsPanel ({
} }
}) })
useEffect(() => {
addEventListener('activate', () => console.log('activate called now'))
})
function onThemeChanged (themeType: any) { function onThemeChanged (themeType: any) {
const invert = themeType === 'dark' ? 1 : 0 const invert = themeType === 'dark' ? 1 : 0
// @ts-ignore // @ts-ignore
@ -132,7 +128,7 @@ export function RemixUiVerticalIconsPanel ({
<div className="remixui_icons d-flex flex-column vh-100" ref={iconPanelRef}> <div className="remixui_icons d-flex flex-column vh-100" ref={iconPanelRef}>
<Home verticalIconPlugin={verticalIconsPlugin} /> <Home verticalIconPlugin={verticalIconsPlugin} />
<div className={scrollableRef.current && scrollableRef.current.scrollHeight > scrollableRef.current.clientHeight <div className={scrollableRef.current && scrollableRef.current.scrollHeight > scrollableRef.current.clientHeight
? 'remixui_default-icons-container remixui_requiredSection' : 'remixui_requiredSection'}> ? 'remixui_default-icons-container remixui_requiredSection' : activateScroll && activateScroll.scrollState ? 'remixui_default-icons-container remixui_requiredSection' : 'remixui_requiredSection'}>
<RequiredSection <RequiredSection
verticalIconsPlugin={verticalIconsPlugin} verticalIconsPlugin={verticalIconsPlugin}
addActive={addActive} addActive={addActive}
@ -145,7 +141,7 @@ export function RemixUiVerticalIconsPanel ({
id="remixuiScrollable" id="remixuiScrollable"
className={scrollableRef.current && scrollableRef.current.scrollHeight > scrollableRef.current.clientHeight className={scrollableRef.current && scrollableRef.current.scrollHeight > scrollableRef.current.clientHeight
? 'remixui_default-icons-container remixui_scrollable-container remixui_scrollbar remixui_hide-scroll' ? 'remixui_default-icons-container remixui_scrollable-container remixui_scrollbar remixui_hide-scroll'
: 'remixui_scrollable-container remixui_scrollbar remixui_hide-scroll'} : activateScroll && activateScroll.scrollState ? 'remixui_default-icons-container remixui_scrollable-container remixui_scrollbar remixui_hide-scroll' : 'remixui_scrollable-container remixui_scrollbar remixui_hide-scroll'}
ref={scrollableRef} ref={scrollableRef}
> >
<OtherIcons <OtherIcons

Loading…
Cancel
Save