|
|
@ -1,7 +1,7 @@ |
|
|
|
/* eslint-disable no-use-before-define */ |
|
|
|
/* eslint-disable no-use-before-define */ |
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
import { VerticalIcons } from 'libs/remix-ui/vertical-icons-panel/types/vertical-icons-panel' |
|
|
|
import { VerticalIcons } from 'libs/remix-ui/vertical-icons-panel/types/vertical-icons-panel' |
|
|
|
import React, { useEffect } from 'react' |
|
|
|
import React, { useEffect, useRef } from 'react' |
|
|
|
import { Chevron } from './Chevron' |
|
|
|
import { Chevron } from './Chevron' |
|
|
|
import Icon from './Icon' |
|
|
|
import Icon from './Icon' |
|
|
|
|
|
|
|
|
|
|
@ -11,25 +11,30 @@ interface SettingsProps { |
|
|
|
addActive: (name: string) => void |
|
|
|
addActive: (name: string) => void |
|
|
|
removeActive: () => void |
|
|
|
removeActive: () => void |
|
|
|
scrollableRef: React.MutableRefObject<any> |
|
|
|
scrollableRef: React.MutableRefObject<any> |
|
|
|
onThemeChanged: (themeType: any) => void |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
function Settings ({ scrollableRef, verticalIconsPlugin, itemContextAction, addActive, removeActive }: SettingsProps) { |
|
|
|
function Settings ({ scrollableRef, verticalIconsPlugin, itemContextAction, addActive, removeActive, onThemeChanged }: SettingsProps) { |
|
|
|
const settingsRef = useRef(null) |
|
|
|
useEffect(() => { |
|
|
|
function onThemeChanged (themeType: any) { |
|
|
|
// const themeModule = verticalIconsPlugin.registry.get('themeModule').api
|
|
|
|
const invert = themeType === 'dark' ? 1 : 0 |
|
|
|
// themeModule.events.on('themeChanged', (theme: any) => {
|
|
|
|
// @ts-ignore
|
|
|
|
// onThemeChanged(theme.quality)
|
|
|
|
const active = settingsRef.current.querySelector('.active') |
|
|
|
// })
|
|
|
|
if (active) { |
|
|
|
return () => { |
|
|
|
// @ts-ignore
|
|
|
|
document.addEventListener('themeChanged', (theme: any) => { |
|
|
|
const image = settingsRef.current.querySelector('.remixui_image') |
|
|
|
// onThemeChanged(theme.quality)
|
|
|
|
image.style.setProperty('filter', `invert(${invert})`) |
|
|
|
console.log('this is what theme contains', theme) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
const themeModule = verticalIconsPlugin.registry.get('themeModule').api |
|
|
|
|
|
|
|
themeModule.events.on('themeChanged', (theme: any) => { |
|
|
|
|
|
|
|
onThemeChanged(theme.quality) |
|
|
|
|
|
|
|
console.log('There was a theme change and is caught in settings. This is the theme payload ', theme) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, []) |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div id="settingsIcons" data-id="vertialIconsSettingsIcons"> |
|
|
|
<div id="settingsIcons" data-id="vertialIconsSettingsIcons" ref={settingsRef}> |
|
|
|
<Chevron |
|
|
|
<Chevron |
|
|
|
divElementRef={scrollableRef} |
|
|
|
divElementRef={scrollableRef} |
|
|
|
cssRule={'fa fa-chevron-down remixui_icon-chevron mt-0 mb-0 ml-1 pl-3'} |
|
|
|
cssRule={'fa fa-chevron-down remixui_icon-chevron mt-0 mb-0 ml-1 pl-3'} |
|
|
|