Skip to content

Commit

Permalink
Fixed Theme Color not saved in local storage
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamed-ghayyad committed Nov 8, 2023
1 parent e6ce134 commit 4042f1b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ export default function App() {
const [opened, setOpened] = useState(false);
const theme = useMantineTheme();
//let colorSession = sessionStorage.setItem('themeColor');
const [color,setColor] = useState('light');
const [color,setColor] = useState(localStorage.getItem('themeColor'));
function toggleColorScheme(){
if(color==='light'){
setColor('dark');
//sessionStorage.setItem('themeColor') = 'dark';
localStorage.setItem('themeColor', 'dark');
}else{
setColor('light');
//sessionStorage.setItem('themeColor') = 'light';
localStorage.setItem('themeColor','light');
}
}
return (
Expand Down
11 changes: 6 additions & 5 deletions src/components/passwordauth.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ function PasswordAuth(){
<Badge variant="filled" color='green'>Connected</Badge>
</Stepper.Step>
<Stepper.Completed>
<Center>
<Button onClick={console.log('Clicked')}>
Login
</Button>
</Center>
Completed! Form values:
<Code block mt="xl">
{JSON.stringify(form.values, null, 2)}
Expand All @@ -95,11 +100,7 @@ function PasswordAuth(){
</Stepper>

<br />
<Center>
<Button onClick={console.log('Clicked')}>
Login
</Button>
</Center>

<Group position="right" mt="xl">
{active !== 0 && (
<Button variant="default" onClick={prevStep}>
Expand Down

0 comments on commit 4042f1b

Please sign in to comment.