Skip to content
This repository was archived by the owner on Jan 16, 2022. It is now read-only.

feat(style): added dark mode#446

Merged
priscilawebdev merged 12 commits intomasterfrom
feat/add-dark-mode
Mar 31, 2020
Merged

feat(style): added dark mode#446
priscilawebdev merged 12 commits intomasterfrom
feat/add-dark-mode

Conversation

@priscilawebdev
Copy link
Copy Markdown
Contributor

@priscilawebdev priscilawebdev commented Mar 22, 2020

Type: Feature

Description: Added Dark Mode Theme

dark-mode

Step 01 of https://github.com/verdaccio/ui/issues/427

@priscilawebdev priscilawebdev changed the title WIP: feat(style): added dark mode feat(style): added dark mode Mar 22, 2020
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 22, 2020

Codecov Report

Merging #446 into master will decrease coverage by 2.07%.
The diff coverage is 63.63%.

@@            Coverage Diff             @@
##           master     #446      +/-   ##
==========================================
- Coverage   87.55%   85.47%   -2.08%     
==========================================
  Files         140      141       +1     
  Lines         988     1019      +31     
  Branches      216      210       -6     
==========================================
+ Hits          865      871       +6     
- Misses        111      122      +11     
- Partials       12       26      +14     
Impacted Files Coverage Δ
src/App/App.tsx 100.00% <ø> (ø)
src/components/Header/Header.tsx 81.81% <ø> (-0.80%) ⬇️
...rc/components/LoginDialog/LoginDialogFormError.tsx 75.00% <ø> (ø)
src/components/LoginDialog/LoginDialogHeader.tsx 83.33% <ø> (ø)
...onents/RegistryInfoContent/RegistryInfoContent.tsx 90.00% <ø> (ø)
src/components/Versions/Versions.tsx 90.00% <ø> (ø)
src/components/Footer/styles.ts 88.88% <33.33%> (-11.12%) ⬇️
src/components/Package/styles.ts 77.77% <40.00%> (-22.23%) ⬇️
src/components/Header/HeaderRight.tsx 79.16% <42.85%> (-14.96%) ⬇️
src/components/Header/HeaderToolTipIcon.tsx 75.00% <50.00%> (-8.34%) ⬇️
... and 19 more

@juanpicado juanpicado added the enhancement New feature or request label Mar 24, 2020
@juanpicado juanpicado added this to the candidate for next release milestone Mar 24, 2020
</EmotionThemeProvider>
);
const ThemeProvider: React.FC = ({ children }) => {
const [isDarkMode, setIsDarkMode] = useState();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If users want to have dark mode by default, how we can achieve that right now? I think this might be the entry point using UI_OPTIONS as we did with language, by default would be the default theme.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done 😉

Copy link
Copy Markdown
Member

@juanpicado juanpicado left a comment

Choose a reason for hiding this comment

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

Great job, CSS styling is really nice touched. I'll keep digging and check what else I can do to pass some props from backend to this PR.

types/index.ts Outdated
base: string;
language?: string;
darkMode?: boolean;
dark_mode?: boolean;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I prefer cammelCase, hopefully we can remove some day all the _ ...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

me too, but then I noticed that we have url_prefix and I decided to do like this

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

url_prefix is from the sinopia era, the previous author was quite all over the place using that, it took me few years to get rid of those, but some configurations are still using _ due backward compatibility unfortunately.

);
const ThemeProvider: React.FC = ({ children }) => {
const isDarkModeDefault = window?.__VERDACCIO_BASENAME_UI_OPTIONS?.dark_mode;
const [isDarkMode, setIsDarkMode] = useState(!!isDarkModeDefault);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This works really well, but we might use the local storage to persist in the dark mode. Let's imagine the following scenario:

  • Admin set dark_mode as true
  • Dark mode is set by default for all users.
  • But here is one which likes green or primary color.
  • This user will try to persist primary theme but it is not possible right now, on refresh it will switch again.

Copy link
Copy Markdown
Member

@juanpicado juanpicado left a comment

Choose a reason for hiding this comment

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

Before approving, few things need to be done first:

I tested, all looks good, only small detail with links. Feel free to fix it here or new PR.

Screen Shot 2020-03-29 at 12 51 33 PM

@sonarqubecloud
Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@verdacciobot
Copy link
Copy Markdown

Thanks for your PR, the @verdaccio/ui package will be accessible from here for testing purposes:

npm install @verdaccio/ui-theme@v1.0.5-cab2984-pr446.0 --registry https://registry.verdaccio.org

Copy link
Copy Markdown
Member

@juanpicado juanpicado left a comment

Choose a reason for hiding this comment

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

Great 🚀 !! Great stuff 👍

@juanpicado
Copy link
Copy Markdown
Member

@priscilawebdev updated https://github.com/verdaccio/website/blob/master/docs/web.md#configuration feel free to merge :)

@priscilawebdev priscilawebdev merged commit cdad5cf into master Mar 31, 2020
@delete-merged-branch delete-merged-branch bot deleted the feat/add-dark-mode branch March 31, 2020 06:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants