-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from je-poy/feature/settings
Feature/settings
- Loading branch information
Showing
7 changed files
with
148 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "es5" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import React from 'react'; | ||
import { Drawer, TextField, Typography, Stack, Switch } from '@mui/material'; | ||
|
||
function Settings({ | ||
open, | ||
closeModal, | ||
changeName, | ||
changeTimeFormat, | ||
checkedFormat, | ||
username, | ||
}) { | ||
const handleNameChange = (event) => { | ||
changeName(event.target.value); | ||
}; | ||
|
||
const handleTimeFormatChange = (event) => { | ||
const value = event.target.checked; | ||
const format = value ? '24' : '12'; | ||
changeTimeFormat(format); | ||
}; | ||
|
||
return ( | ||
<React.Fragment key="right"> | ||
<Drawer | ||
anchor="right" | ||
PaperProps={{ | ||
sx: { | ||
width: '25%', | ||
}, | ||
}} | ||
open={open} | ||
onClose={closeModal} | ||
className="p-3" | ||
> | ||
<div className="bg-blue-200 h-full"> | ||
<div className="h-10 p-2 text-center text-xl tracking-wide font-semibold"> | ||
Enter your name | ||
</div> | ||
<div className="px-5"> | ||
<TextField | ||
color="info" | ||
sx={{ width: '100%' }} | ||
value={username} | ||
onChange={handleNameChange} | ||
/> | ||
</div> | ||
<div className="h-10 p-2 text-center text-xl text-center text-xl tracking-wide font-semibold"> | ||
Time Format | ||
</div> | ||
<div className="h-10"> | ||
<Stack | ||
direction="row" | ||
spacing={1} | ||
alignItems="center" | ||
justifyContent="center" | ||
> | ||
<Typography>12 Hour</Typography> | ||
<Switch | ||
size="large" | ||
checked={checkedFormat} | ||
onChange={handleTimeFormatChange} | ||
/> | ||
<Typography>24 Hour</Typography> | ||
</Stack> | ||
</div> | ||
</div> | ||
</Drawer> | ||
</React.Fragment> | ||
); | ||
} | ||
|
||
export default Settings; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const getStorageItem = (key) => { | ||
return localStorage.getItem(key); | ||
}; | ||
|
||
const setStorageItem = (key, value) => { | ||
localStorage.setItem(key, value); | ||
}; | ||
|
||
export { getStorageItem, setStorageItem }; |