fix color bugs

This commit is contained in:
SethBurkart123
2023-09-22 09:41:58 +10:00
parent 548bead17b
commit cbc84c8e79
10 changed files with 93 additions and 117 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
// @ts-expect-error There aren't any types for the below library
import ColorPicker from 'react-best-gradient-color-picker';
import { useState, useRef, useEffect } from 'react';
import type { ColorPickerProps } from '../types/ColorPicker';
import type { ColorPickerProps } from '../types/ColorPickerProps';
const Picker = ({ color, onChange }: ColorPickerProps) => {
const [showPicker, setShowPicker] = useState<boolean>(false);
+1 -1
View File
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import "./Slider.css";
import type { Slider } from '../types/Slider';
import type { Slider } from '../types/SliderProps';
const Slider: React.FC<Slider> = ({ onValueChange }) => {
const [sliderValue, setSliderValue] = useState(0);
+1 -1
View File
@@ -1,6 +1,6 @@
import { motion } from "framer-motion";
import "./Switch.css";
import type { SwitchProps } from "../types/Switch";
import type { SwitchProps } from "../types/SwitchProps";
export default function Switch(props: SwitchProps) {
const toggleSwitch = () => {
+1 -1
View File
@@ -1,6 +1,6 @@
import React, { useState, useRef, useEffect } from 'react';
import { motion } from 'framer-motion';
import type { TabbedContainerProps } from '../types/TabbedContainer';
import type { TabbedContainerProps } from '../types/TabbedContainerProps';
const TabbedContainer: React.FC<TabbedContainerProps> = ({ tabs, themeColor }) => {
const [activeTab, setActiveTab] = useState(0);
+1 -4
View File
@@ -57,17 +57,14 @@ const useSettingsState = ({ settingsState, setSettingsState }: SettingsProps) =>
});
const setStorage = (key: keyof MainConfig, value: any) => {
console.log(chrome.storage.local.set({ [key]: value }));
chrome.storage.local.set({ [key]: value });
}
useEffect(() => {
console.log("settingsState", settingsState)
console.log("previousSettingsState", previousSettingsState)
if (previousSettingsState) {
for (const [key, value] of Object.entries(settingsState)) {
const storageKey = Object.keys(keyToStateMap).find(k => keyToStateMap[k] === key);
if (storageKey && value !== previousSettingsState[key]) {
console.log("key", storageKey)
setStorage(storageKey as keyof MainConfig, value);
}
}