-
>
diff --git a/client/src/components/Settings/Setting.jsx b/client/src/components/Settings/Setting.jsx
index 4054135..363afec 100644
--- a/client/src/components/Settings/Setting.jsx
+++ b/client/src/components/Settings/Setting.jsx
@@ -1,32 +1,41 @@
-import React, { useState } from 'react';
-import { SUPPORTED_LANGUAGE } from '../../utils/constants';
-import {useDispatch, useSelector} from "react-redux"
-import lang from '../../utils/langaugeConstant';
-import { changeLanguage } from '../../utils/configSlice';
+import React, { useState } from "react";
+import { SUPPORTED_LANGUAGE } from "../../utils/constants";
+import { useDispatch, useSelector } from "react-redux";
+import lang from "../../utils/langaugeConstant";
+import { changeLanguage } from "../../utils/configSlice";
+import { useTheme } from "../../Context/ThemeContext";
const Settings = () => {
-
- const langKey=useSelector((store)=>store.config.lang)
-
- const dispatch=useDispatch()
+ const langKey = useSelector((store) => store.config.lang);
+ const dispatch = useDispatch();
+ const {toggleTheme} = useTheme();
const [settings, setSettings] = useState({
- theme: 'light',
- email: '',
- password: '',
+ theme: "light",
+ email: "",
+ password: "",
notifications: true,
- privacy: 'Public',
- accessibility: 'Default',
- security: 'Standard',
+ privacy: "Public",
+ accessibility: "Default",
+ security: "Standard",
});
- const handleLanguageChange=(e)=>{
- dispatch(changeLanguage(e.target.value))
+ const handleLanguageChange = (e) => {
+ dispatch(changeLanguage(e.target.value));
+ };
+
+ const handleThemeChange = (e) => {
+ toggleTheme();
+ const { name, value } = event.target;
+ setSettings((prevSettings) => ({
+ ...prevSettings,
+ [name]: value,
+ }));
}
const handleInputChange = (event) => {
const { name, value } = event.target;
- setSettings(prevSettings => ({
+ setSettings((prevSettings) => ({
...prevSettings,
[name]: value,
}));
@@ -34,118 +43,119 @@ const Settings = () => {
const handleToggleChange = (event) => {
const { name, checked } = event.target;
- setSettings(prevSettings => ({
+ setSettings((prevSettings) => ({
...prevSettings,
[name]: checked,
}));
};
- // Add more handler functions as needed
-
- const containerStyle = {
- maxWidth: '600px',
- margin: '0 auto',
- padding: '20px',
- paddingBottom: '60px', // Adjust this value so the content doesn't overlap with the footer
- border: '1px solid #ccc',
- borderRadius: '8px',
- backgroundColor: settings.theme === 'light' ? '#f9f9f9' : '#333',
- color: settings.theme === 'light' ? '#333' : '#f9f9f9',
- marginBottom: '100px', // This should be at least as tall as your footer to prevent overlap
- };
-
- const titleStyle = {
- textAlign: 'center',
- };
-
- const itemStyle = {
- marginBottom: '20px',
- };
-
- const labelStyle = {
- display: 'block',
- marginBottom: '5px',
- };
-
- const inputStyle = {
- width: '100%',
- padding: '10px',
- border: '1px solid #ddd',
- borderRadius: '4px',
- };
-
- const selectStyle = {
- ...inputStyle,
- };
-
- const checkboxStyle = {
- marginRight: '10px',
- };
-
- // Add more styles as needed
-
-
return (
-
-
{lang[langKey].setting}
+
+
+
{lang[langKey].setting}