parent
1672e1de01
commit
a97aa334fb
@ -1,14 +1,35 @@ |
||||
import { ThemeModule } from '../../types/theme-module'; |
||||
import './remix-ui-theme-module.module.css'; |
||||
|
||||
/* eslint-disable-next-line */ |
||||
export interface RemixUiThemeModuleProps {} |
||||
export interface RemixUiThemeModuleProps { |
||||
themeModule: ThemeModule |
||||
} |
||||
|
||||
export function RemixUiThemeModule(props: RemixUiThemeModuleProps) { |
||||
export function RemixUiThemeModule({ themeModule }: RemixUiThemeModuleProps) { |
||||
const themes = () => { |
||||
const themes = themeModule.getThemes() |
||||
if (themes) { |
||||
return themes.map((aTheme, index) => ( |
||||
<div className="radio custom-control custom-radio mb-1 form-check" key={index}> |
||||
<input type="radio" onChange={event => { themeModule.switchTheme(aTheme.name) }} className="align-middle custom-control-input" name='theme' id={aTheme.name} data-id={`settingsTabTheme${aTheme.name}`} checked = {themeModule.active === aTheme.name }/> |
||||
<label className="form-check-label custom-control-label" data-id={`settingsTabThemeLabel${aTheme.name}`} htmlFor={aTheme.name}>{aTheme.name} ({aTheme.quality})</label> |
||||
</div> |
||||
) |
||||
) |
||||
} |
||||
return |
||||
} |
||||
return ( |
||||
<div> |
||||
<div className="border-top"> |
||||
<div className="card-body pt-3 pb-2"> |
||||
<h6 className="card-title">Themes Module</h6> |
||||
<div className="card-text themes-container"> |
||||
<h1>Welcome to remix-ui-theme-module!</h1> |
||||
</div> |
||||
); |
||||
</div> |
||||
</div> |
||||
) |
||||
} |
||||
|
||||
export default RemixUiThemeModule; |
||||
|
@ -0,0 +1,42 @@ |
||||
import { Plugin } from "@remixproject/engine/lib/abstract"; |
||||
import { EventEmitter } from "events"; |
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export class ThemeModule extends Plugin<any, any> { |
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
constructor(registry: any); |
||||
events: EventEmitter; |
||||
_deps: { |
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
config: any; |
||||
}; |
||||
element: HTMLDivElement; |
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
themes: {}; |
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
active: any; |
||||
forced: boolean; |
||||
render(): HTMLDivElement; |
||||
renderComponent(): void; |
||||
/** Return the active theme */ |
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
currentTheme(): any; |
||||
/** Returns all themes as an array */ |
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
getThemes(): any[]; |
||||
/** |
||||
* Init the theme |
||||
*/ |
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
initTheme(callback: any): void; |
||||
/** |
||||
* Change the current theme |
||||
* @param {string} [themeName] - The name of the theme |
||||
*/ |
||||
switchTheme(themeName?: string): void; |
||||
/** |
||||
* fixes the invertion for images since this should be adjusted when we switch between dark/light qualified themes |
||||
* @param {element} [image] - the dom element which invert should be fixed to increase visibility |
||||
*/ |
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
fixInvert(image?: any): void; |
||||
} |
Loading…
Reference in new issue