fix linting errors

pull/5370/head
Joseph Izang 3 years ago committed by yann300
parent fd72dc057c
commit 99b5d5341a
  1. 8
      libs/remix-ui/vertical-icons-panel/src/lib/reducers/verticalScrollReducer.ts
  2. 18
      libs/remix-ui/vertical-icons-panel/src/lib/remix-ui-vertical-icons-panel.tsx

@ -4,14 +4,14 @@ export type actionType = {
payload: any payload: any
} }
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 // 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 const newvals = actionPayload.payload
return { ...newvals } return { ...newvals }
} else if (actionPayload.type === 'other') { } else if (actionPayload.type === 'other') {
actionPayload.payload.scrollHeight > actionPayload.payload.clientHeight // actionPayload.payload.scrollHeight > actionPayload.payload.clientHeight
} }
return prevState return prevState
} }

@ -32,19 +32,19 @@ export function RemixUiVerticalIconsPanel ({
}: RemixUiVerticalIconsPanelProps) { }: RemixUiVerticalIconsPanelProps) {
const scrollableRef = useRef<any>() const scrollableRef = useRef<any>()
const iconPanelRef = useRef<any>() const iconPanelRef = useRef<any>()
const [activateScroll, dispatchScrollAction] = useReducer(verticalScrollReducer,initialState) const [activateScroll, dispatchScrollAction] = useReducer(verticalScrollReducer, initialState)
useEffect(() => { useEffect(() => {
const evaluateScrollability = (evt: any) => { const evaluateScrollability = (evt: any) => {
console.log('resize event answered by dispatch!') console.log('resize event answered by dispatch!')
dispatchScrollAction({ dispatchScrollAction({
type: 'resize', type: 'resize',
payload: { payload: {
scrollHeight: document.querySelector('#remixuiScrollable')?.scrollHeight, scrollHeight: document.querySelector('#remixuiScrollable')?.scrollHeight,
clientHeight: document.querySelector('#remixuiScrollable')?.clientHeight, clientHeight: document.querySelector('#remixuiScrollable')?.clientHeight,
scrollState: false scrollState: false
} }
}) })
} }
addEventListener('resize', evaluateScrollability) addEventListener('resize', evaluateScrollability)
@ -54,7 +54,7 @@ export function RemixUiVerticalIconsPanel ({
}) })
useEffect(() => { useEffect(() => {
addEventListener('activate', () => console.log('activate called now')) addEventListener('activate', () => console.log('activate called now'))
}) })
function onThemeChanged (themeType: any) { function onThemeChanged (themeType: any) {

Loading…
Cancel
Save