Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
LIU9293 committed Jul 5, 2023
1 parent 0747773 commit 6f8a544
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 9 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ It's a demo application for me to figure out if I can use rust/dioxus in product

Live Demo -> https://rust-2048.vercel.app/

### Features in this application

- [x] Use tailwind and daisy css for styling
- [x] Handle Dark / light theme
- [x] Try to inplenment i18n use fermi state
- [x] Access cookies / localstorage
- [x] Build web and native app
- [x] A simple server to record user progress

### Test and run
```
1. Run server
Expand Down Expand Up @@ -45,14 +54,6 @@ dioxus serve --platform desktop
- [x] Server, record game progress
- [ ] Server, record progress for multiple users

### Things need to be figure out

- [x] Component library / tailwind
- [x] Dark / light theme
- [x] i18n
- [x] Access cookies / localstorage
- [x] Can visit route url

Github

-
https://github.com/LIU9293/rust-2048/
27 changes: 27 additions & 0 deletions packages/client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,33 @@ fn main() {
}
});
</script>
<script>
try {
const theme = localStorage.getItem('theme')
if (theme === 'dark') {
document.documentElement.setAttribute('data-theme', 'black');
}
if (theme === 'light') {
document.documentElement.setAttribute('data-theme', 'lofi');
}
if (theme === 'system') {
var preference_query = window.matchMedia('(prefers-color-scheme: dark)');
function checkPreference(query) {
if (query.matches) {
document.documentElement.setAttribute('data-theme', 'black');
localStorage.setItem('theme', 'system');
} else {
document.documentElement.setAttribute('data-theme', 'lofi');
localStorage.setItem('theme', 'system');
}
}
checkPreference(preference_query);
preference_query.addEventListener("change", checkPreference);
}
} catch (error) {}
</script>
</body>
</html>
"#
Expand Down

0 comments on commit 6f8a544

Please sign in to comment.