From cdad5cf70d69b7bb045fce461a32108def81721d Mon Sep 17 00:00:00 2001 From: Priscila Oliveira Date: Tue, 31 Mar 2020 08:44:59 +0200 Subject: [PATCH] feat(style): added dark mode (#446) --- .secrets-baseline | 2 +- i18n/translations/de-DE.json | 1 + i18n/translations/en-US.json | 1 + i18n/translations/es-ES.json | 1 + i18n/translations/pt-BR.json | 1 + src/App/App.tsx | 2 +- src/App/__snapshots__/App.test.tsx.snap | 48 ++++++++++++++++ .../DetailContainer/DetailContainerTabs.tsx | 10 +--- .../DetailContainer.test.tsx.snap | 9 +-- .../DetailSidebar/DetailSidebar.tsx | 8 +-- .../DetailSidebar/DetailSidebarTitle.tsx | 18 +++--- .../__snapshots__/Developers.test.tsx.snap | 2 +- src/components/Footer/styles.ts | 8 +-- src/components/Header/Header.tsx | 3 +- src/components/Header/HeaderLeft.tsx | 7 +-- src/components/Header/HeaderLogo.tsx | 25 --------- src/components/Header/HeaderRight.tsx | 21 ++++++- src/components/Header/HeaderToolTipIcon.tsx | 19 ++++++- .../Header/__snapshots__/Header.test.tsx.snap | 48 ++++++++++++++++ src/components/Loading/styles.ts | 8 ++- .../LoginDialog/LoginDialogFormError.tsx | 5 +- .../LoginDialog/LoginDialogHeader.tsx | 1 + src/components/Logo/Logo.tsx | 43 +++++++++++---- .../Logo/img/logo-black-and-white.svg | 1 + src/components/Package/styles.ts | 26 ++++----- src/components/Readme/Readme.spec.tsx | 4 +- src/components/Readme/Readme.tsx | 11 +++- .../Readme/__snapshots__/Readme.spec.tsx.snap | 4 +- .../RegistryInfoContent.tsx | 14 +---- src/components/RegistryInfoDialog/styles.ts | 5 +- src/components/Repository/Repository.tsx | 10 +++- src/components/Spinner/styles.ts | 4 +- .../__snapshots__/UpLinks.test.tsx.snap | 2 +- src/components/UpLinks/styles.ts | 12 ++-- src/components/Versions/Versions.tsx | 1 + src/components/Versions/styles.ts | 12 ++-- src/design-tokens/ThemeContext.ts | 10 ++++ src/design-tokens/ThemeProvider.tsx | 23 ++++++-- src/design-tokens/theme.ts | 55 +++++++++++++------ src/design-tokens/useLocalStorage.ts | 38 +++++++++++++ src/design-tokens/useTheme.ts | 7 +++ tools/webpack.dev.config.babel.js | 1 - types/index.ts | 1 + 43 files changed, 378 insertions(+), 154 deletions(-) delete mode 100644 src/components/Header/HeaderLogo.tsx create mode 100644 src/components/Logo/img/logo-black-and-white.svg create mode 100644 src/design-tokens/ThemeContext.ts create mode 100644 src/design-tokens/useLocalStorage.ts create mode 100644 src/design-tokens/useTheme.ts diff --git a/.secrets-baseline b/.secrets-baseline index 992b28f..fa4dcba 100644 --- a/.secrets-baseline +++ b/.secrets-baseline @@ -37,4 +37,4 @@ ], "results": {}, "version": "0.12.4" -} +} \ No newline at end of file diff --git a/i18n/translations/de-DE.json b/i18n/translations/de-DE.json index 040ac67..8598dbe 100644 --- a/i18n/translations/de-DE.json +++ b/i18n/translations/de-DE.json @@ -133,6 +133,7 @@ "sorry-we-could-not-find-it": "Entschuldigung, wir konnten es nicht finden..." }, "app-context-not-correct-used": "Der App-Kontext wurde nicht korrekt verwendet", + "theme-context-not-correct-used": "Der Theme-Kontext wurde nicht korrekt verwendet", "package-meta-is-required-at-detail-context": "packageMeta wird bei DetailContext benötigt" } } diff --git a/i18n/translations/en-US.json b/i18n/translations/en-US.json index d3f8df7..b0f3ca8 100644 --- a/i18n/translations/en-US.json +++ b/i18n/translations/en-US.json @@ -133,6 +133,7 @@ "sorry-we-could-not-find-it": "Sorry, we couldn't find it..." }, "app-context-not-correct-used": "The app context was not correct used", + "theme-context-not-correct-used": "The theme context was not correct used", "package-meta-is-required-at-detail-context": "packageMeta is required at DetailContext" } } \ No newline at end of file diff --git a/i18n/translations/es-ES.json b/i18n/translations/es-ES.json index 8258789..204664d 100644 --- a/i18n/translations/es-ES.json +++ b/i18n/translations/es-ES.json @@ -133,6 +133,7 @@ "sorry-we-could-not-find-it": "Lo siento, no hemos podido encontrarlo..." }, "app-context-not-correct-used": "El contexto de la aplicación no fue correctamente usado", + "theme-context-not-correct-used": "El contexto del tema no fue correctamente usado", "package-meta-is-required-at-detail-context": "packageMeta es requerido en DetailContext" } } diff --git a/i18n/translations/pt-BR.json b/i18n/translations/pt-BR.json index 2b1c3a0..f3a8cf9 100644 --- a/i18n/translations/pt-BR.json +++ b/i18n/translations/pt-BR.json @@ -133,6 +133,7 @@ "sorry-we-could-not-find-it": "Desculpe, não conseguimos encontrar..." }, "app-context-not-correct-used": "O contexto do aplicativo não foi usado corretamente", + "theme-context-not-correct-used": "O contexto do tema não foi usado corretamente", "package-meta-is-required-at-detail-context": "packageMeta é requerido em DetailContext" } } \ No newline at end of file diff --git a/src/App/App.tsx b/src/App/App.tsx index 2b21059..99aa2b0 100644 --- a/src/App/App.tsx +++ b/src/App/App.tsx @@ -19,7 +19,7 @@ import AppRoute, { history } from './AppRoute'; import loadDayJSLocale from './load-dayjs-locale'; const StyledBox = styled(Box)<{ theme?: Theme }>(({ theme }) => ({ - backgroundColor: theme && theme.palette.white, + backgroundColor: theme?.palette.background.default, })); const StyledBoxContent = styled(Box)<{ theme?: Theme }>(({ theme }) => ({ diff --git a/src/App/__snapshots__/App.test.tsx.snap b/src/App/__snapshots__/App.test.tsx.snap index 057a7c3..b76b1c4 100644 --- a/src/App/__snapshots__/App.test.tsx.snap +++ b/src/App/__snapshots__/App.test.tsx.snap @@ -522,6 +522,30 @@ exports[` should display the Header component 1`] = ` class="MuiTouchRipple-root" /> + + + +