use themeColor hook

This commit is contained in:
MathieuG-P
2022-07-23 11:38:46 +02:00
parent 5196118819
commit 4067b41558
2 changed files with 4 additions and 12 deletions
@@ -3,18 +3,14 @@ import OutsideClickHandler from 'react-outside-click-handler';
import React from "react";
import { BsmImage } from "./bsm-image.component";
import { useTranslation } from "renderer/hooks/use-translation.hook";
import { useObservable } from "renderer/hooks/use-observable.hook";
import { ConfigurationService } from "renderer/services/configuration.service";
import { DefaultConfigKey } from "renderer/config/default-configuration.config";
import { useThemeColor } from "renderer/hooks/use-theme-color.hook";
type BsmButtonType = "primary"|"success"|"cancel"|"error";
export function BsmButton({className, style, imgClassName, icon, image, text, type, active, withBar = true, disabled, onClickOutside, onClick, typeColor}: {className?: string, style?: React.CSSProperties, imgClassName?: string, icon?: BsmIconType, image?: string, text?: string, type?: string, active?: boolean, withBar?: boolean, disabled?: boolean, onClickOutside?: (e: MouseEvent) => void, onClick?: (e: React.MouseEvent) => void, typeColor?:BsmButtonType}) {
const configService = ConfigurationService.getInstance();
const t = useTranslation();
const secondColor = useObservable(configService.watch("second-color" as DefaultConfigKey));
const secondColor = useThemeColor("second-color");
return (
<OutsideClickHandler onOutsideClick={e => onClickOutside && onClickOutside(e)}>
@@ -1,18 +1,14 @@
import { useEffect, useRef, useState } from "react";
import { DefaultConfigKey } from "renderer/config/default-configuration.config";
import { useObservable } from "renderer/hooks/use-observable.hook";
import { useThemeColor } from "renderer/hooks/use-theme-color.hook";
import { useTranslation } from "renderer/hooks/use-translation.hook";
import { ConfigurationService } from "renderer/services/configuration.service";
export function TabNavBar(props: {tabsText: string[], onTabChange: Function, className?: string}) {
const configService = ConfigurationService.getInstance();
const [currentTabIndex, setCurrentTabIndex] = useState(0);
const tabsWrapper = useRef(null);
const [tabsWidth, setTabsWidth] = useState(0);
const t = useTranslation();
const secondColor = useObservable(configService.watch("second-color" as DefaultConfigKey));
const secondColor = useThemeColor("second-color");
const selectYear = (tab: string) => {
const newIndex = props.tabsText.indexOf(tab);