Skip to content
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

Dark mode #214

Closed
wants to merge 19 commits into from
Closed

Dark mode #214

wants to merge 19 commits into from

Conversation

sseficha
Copy link

@sseficha sseficha commented Dec 8, 2018

  • I've checked that this isn't a new swag opportunity proposal.
  • I've checked that this isn't a duplicate pull request.

Added a dark mode switch! Awaiting feedback :)

Fixes #106

Copy link
Collaborator

@aslafy-z aslafy-z left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! Here are some comments.
I have some more about the way you switch classes but have no time to explore ways now.
It needs some edits to be easily readable and perf efficient.

PS: I love your commit name

src/pug/includes/head.pug Outdated Show resolved Hide resolved
src/styl/index.styl Outdated Show resolved Hide resolved
src/js/index.js Outdated Show resolved Hide resolved
Copy link
Contributor

@vikaspotluri123 vikaspotluri123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments, thanks for contributing! 🎉

Great work so far, just needs some polishing 💅

src/pug/includes/head.pug Outdated Show resolved Hide resolved
src/styl/index.styl Outdated Show resolved Hide resolved
src/js/index.js Outdated Show resolved Hide resolved
src/js/index.js Outdated Show resolved Hide resolved
src/js/index.js Outdated
for (var i =0; i<refs.length; i++) {
refs[i].classList.toggle("dark_refs");
}
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you run npm run lint and fix any issues? Thanks!

src/js/index.js Outdated Show resolved Hide resolved
src/pug/includes/body.pug Outdated Show resolved Hide resolved
src/js/index.js Outdated Show resolved Hide resolved
src/styl/index.styl Outdated Show resolved Hide resolved
@vikaspotluri123
Copy link
Contributor

One more thing in general - I don't like the small moon icon being a trigger, I think we should have something more substantial, with a label that tells you what's happening

@sseficha
Copy link
Author

sseficha commented Dec 8, 2018

Thank you, I knew I was a long way from perfect, just needed some feedback to know I am on the right track. I will work on it soon. Also, I am sorry if I am not 100% technically correct with my commits, this is one of my first times contributing to a big project. :)

@plibither8 plibither8 added the enhancement New feature or request label Dec 10, 2018
@sseficha
Copy link
Author

Hope you like this version better. Cheers and merry christmas :)

@sseficha
Copy link
Author

sseficha commented Jan 4, 2019

Waiting for some feedback. If something needs to change please tell me.

src/js/index.js Outdated Show resolved Hide resolved
src/js/index.js Outdated Show resolved Hide resolved
src/pug/includes/body.pug Outdated Show resolved Hide resolved
src/pug/includes/body.pug Outdated Show resolved Hide resolved
@@ -7,14 +7,15 @@ meta(http-equiv="X-UA-Compatible" content="IE=edge")

Copy link
Collaborator

@aslafy-z aslafy-z Jan 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes should be reverted.

src/styl/imports/dark.styl Outdated Show resolved Hide resolved
src/styl/index.styl Outdated Show resolved Hide resolved
src/styl/index.styl Outdated Show resolved Hide resolved
src/styl/index.styl Outdated Show resolved Hide resolved
src/js/index.js Outdated Show resolved Hide resolved
@aslafy-z aslafy-z dismissed their stale review January 4, 2019 14:50

OP cleared its preview work

Copy link
Collaborator

@aslafy-z aslafy-z left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just added a bunch of comments, do not hesitate to ask any question you need!

@sseficha
Copy link
Author

sseficha commented Jan 7, 2019

I keep getting an error when running lint but I have not been able to see what's wrong whatsoever :/

@aslafy-z
Copy link
Collaborator

aslafy-z commented Jan 7, 2019

As I said in the comment, start by running npm run lint:fix.
Then if there is more errors than you can't fix manualy, post them as a comment so we can help you.

@sseficha
Copy link
Author

sseficha commented Jan 7, 2019

> [email protected] lint:fix C:\Users\Solon\swag\swag-for-dev
> eclint fix '**/*' '!LICENSE' && xo --fix

events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: File not found with singular glob: C:/Users/Solon/swag/swag-for-dev/'!LICENSE' (if this was purposeful, use `allowEmpty` option)
    at Glob.<anonymous> (C:\Users\Solon\swag\swag-for-dev\node_modules\glob-stream\readable.js:84:17)
    at Object.onceWrapper (events.js:315:30)
    at emitOne (events.js:116:13)
    at Glob.emit (events.js:211:7)
    at Glob._finish (C:\Users\Solon\swag\swag-for-dev\node_modules\glob\glob.js:197:8)
    at done (C:\Users\Solon\swag\swag-for-dev\node_modules\glob\glob.js:182:14)
    at Glob._processSimple2 (C:\Users\Solon\swag\swag-for-dev\node_modules\glob\glob.js:688:12)
    at C:\Users\Solon\swag\swag-for-dev\node_modules\glob\glob.js:676:10
    at Glob._stat2 (C:\Users\Solon\swag\swag-for-dev\node_modules\glob\glob.js:772:12)
    at lstatcb_ (C:\Users\Solon\swag\swag-for-dev\node_modules\glob\glob.js:764:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] lint:fix: `eclint fix '**/*' '!LICENSE' && xo --fix`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] lint:fix script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Solon\AppData\Roaming\npm-cache\_logs\2019-01-07T15_08_54_709Z-debug.log

I keep getting this error. Any idea why?

@aslafy-z aslafy-z mentioned this pull request Jan 7, 2019
1 task
@aslafy-z
Copy link
Collaborator

aslafy-z commented Jan 7, 2019

Please rebase on master, I should have fixed your problem with #244

@aslafy-z
Copy link
Collaborator

aslafy-z commented Jan 7, 2019

moon.png and sun.png are still in the tree btw

@sseficha
Copy link
Author

sseficha commented Jan 7, 2019

Should I stash the changes from #244 or include them too?

@vikaspotluri123
Copy link
Contributor

@aslafy-z I'll review after you approve 🙂

@vikaspotluri123 vikaspotluri123 added the 🎨 PR: UI/X Testing PR which requires manual UI / UX testing label Jan 7, 2019
@aslafy-z
Copy link
Collaborator

aslafy-z commented Jan 7, 2019

Just merge your branch with upstream/master and fix conflicts

@aslafy-z aslafy-z closed this Jan 7, 2019
@aslafy-z
Copy link
Collaborator

aslafy-z commented Jan 7, 2019

I'm really sorry I messed up with your branch..
Can you do a git push --force of your current content? (WITHOUT PULLING before)
I got a backup here if needed: https://github.com/aslafy-z/swag-for-dev/tree/tmp/dark

GitHub doesn't let me reopen the PR till there is content in there so i'll after you pushed. I've could have fixed it myself if GitHub haven't close the PR letting me without repo access. Sorry for that :/

@sseficha
Copy link
Author

sseficha commented Jan 7, 2019

I can only push to my upstream repo, with this PR being closed :/ . How should I go with this?

@vikaspotluri123
Copy link
Contributor

vikaspotluri123 commented Jan 7, 2019

Since you're trying to merge from sseficha:master, you should force push your changes there

As a personal note, it's usually a good idea to create a branch rather than work directly off of master - here's a great guide from GitHub as to how a general workflow can be like: https://guides.github.com/introduction/flow/

@sseficha
Copy link
Author

sseficha commented Jan 7, 2019

I am force pushing my changes to sseficha:master, but they aren't being synced here like the previous times. I was using different branches, but I was pushing my changes to master so that they will be reflected to the PR.

& h1, p, span
color white !important
& a
color #d11717 !important
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file misses a ending new line, you need to run lint !

=> Lint should be ran automatically on commit with husky and lint-staged modules
Why is it not working for you ?

I think you should do a clean merge or rebase from upstream because it looks that you misses files.
You may want to do a npm install again also.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran lint but it didn't show any errors! Guess it may be missing something. I will run npm again.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it works for you now?

src/pug/includes/body.pug Show resolved Hide resolved
@@ -104,3 +105,26 @@ window.addEventListener('load', () => {

cascade.call(window, true);
});

function setTheme(preference) {
Copy link
Collaborator

@aslafy-z aslafy-z Jan 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is lot of repetitions in this function and the following one, maybe we can do something to get some more generic theme switching engine ? staying simple

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok got it.

if (preference === 'dark') {
document.body.classList.add('dark');
colorSwitch.innerHTML = 'Light mode';
} else if (preference === 'light' || preference === null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} else if (preference === 'light' || preference === null) {
} else if (preference === 'light' || !preference) {

function setTheme(preference) {
if (preference === 'dark') {
document.body.classList.add('dark');
colorSwitch.innerHTML = 'Light mode';
Copy link
Contributor

@itaisteinherz itaisteinherz Jan 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to set colorSwitch.textContent here since the value used is plaintext and doesn't contain any HTML (this also applies to line 115).

@vikaspotluri123
Copy link
Contributor

@sseficha Here's an example of ~ what I was thinking for dark mode: https://overreacted.io/

@aslafy-z aslafy-z mentioned this pull request Oct 15, 2019
1 task
@sseficha sseficha closed this by deleting the head repository Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request 🎨 PR: UI/X Testing PR which requires manual UI / UX testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants