-
Notifications
You must be signed in to change notification settings - Fork 1
Feat/dark mode #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,10 @@ | ||||||||
| <template> | ||||||||
| <div id="app"> | ||||||||
| <ToggleButton | ||||||||
| :active="showDarkMode" | ||||||||
| :bg="true" | ||||||||
| @on-click-toggle-button="setToggleDarkMode" | ||||||||
| /> | ||||||||
| <Menu /> | ||||||||
| <TextRenderer /> | ||||||||
| </div> | ||||||||
|
|
@@ -11,12 +16,14 @@ import { updateSelectedFont } from './helpers.js' | |||||||
|
|
||||||||
| import Menu from './components/Menu.vue' | ||||||||
| import TextRenderer from './components/TextRenderer' | ||||||||
| import ToggleButton from './components/ToggleButton.vue' | ||||||||
|
|
||||||||
| export default { | ||||||||
| name: 'App', | ||||||||
| components: { | ||||||||
| Menu, | ||||||||
| TextRenderer, | ||||||||
| ToggleButton | ||||||||
| }, | ||||||||
| head: { | ||||||||
| link: [ | ||||||||
|
|
@@ -29,12 +36,16 @@ export default { | |||||||
| ...mapState([ | ||||||||
| 'selectedFont', | ||||||||
| 'fonts', | ||||||||
| 'showDarkMode' | ||||||||
| ]) | ||||||||
| }, | ||||||||
| watch: { | ||||||||
| selectedFont(value) { | ||||||||
| updateSelectedFont(value) | ||||||||
| }, | ||||||||
| showDarkMode(value){ | ||||||||
| value ? document.body.classList.add("dark-mode") : document.body.classList.remove("dark-mode"); | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Acho que invés de colocar essa classe no body vc pode colocar no |
||||||||
| } | ||||||||
| }, | ||||||||
| mounted() { | ||||||||
| if(!this.selectedFont) this.setSelectedFont(this.fonts[1]) | ||||||||
|
|
@@ -43,12 +54,26 @@ export default { | |||||||
| methods: { | ||||||||
| ...mapMutations([ | ||||||||
| 'setSelectedFont', | ||||||||
| 'toggleDarkMode' | ||||||||
| ]), | ||||||||
| setToggleDarkMode(){ | ||||||||
| this.toggleDarkMode() | ||||||||
| } | ||||||||
|
Comment on lines
+59
to
+61
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tu pode usar o
Suggested change
|
||||||||
| }, | ||||||||
| } | ||||||||
| </script> | ||||||||
|
|
||||||||
| <style lang="scss"> | ||||||||
| :root { | ||||||||
| --text-default: #000; | ||||||||
| --line-default: #000; | ||||||||
| --bg-default: #fff; | ||||||||
| --text-dark-mode: #33CB9A; | ||||||||
| --line-dark-mode: #33CB9A; | ||||||||
| --bg-dark-mode: #000; | ||||||||
| } | ||||||||
|
|
||||||||
|
|
||||||||
| * { | ||||||||
| margin: 0; | ||||||||
| padding: 0; | ||||||||
|
|
@@ -57,6 +82,13 @@ export default { | |||||||
| body { | ||||||||
| font-size: 16px; | ||||||||
| padding-top: 15px; | ||||||||
| background-color: var(--bg-default); | ||||||||
|
|
||||||||
| &.dark-mode{ | ||||||||
| --text-default: var(--text-dark-mode); | ||||||||
| --line-default: var(--line-dark-mode); | ||||||||
| --bg-default: var(--bg-dark-mode); | ||||||||
| } | ||||||||
| } | ||||||||
|
|
||||||||
| .apply { | ||||||||
|
|
||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vc pode chamar o
toggleDarkModedireto aqui.