-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mudanças na API do modo escuro (#41)
# Contexto Ao passar a usar as APIs do modo escuro no SGLearner, percebi que a implementação seria mais fácil se fossem feitas algumas mudanças no DS. # Mudanças A mudança principal foi na função `toggleTheme`: antes ela simplesmente trocava o tema. Mas a interface que teremos para a escolha não será simplesmente um toggle mas um modal com as opções "claro" e "escuro". Daí achei que seria mais natural se o DS fornecesse uma função para mudar para um tema fornecido. Mudei a `toggleTheme` para uma função `setTheme`. Houve também outras mudanças menores, que vou explicar com comentários no PR. # Como testar * Ver que testes automatizados continuam passando * Apontar o SGLearner para a branch do DS com as mudanças e ver que é possível usar a `setTheme` e outras APIs
- Loading branch information
1 parent
9042e69
commit 7f4af01
Showing
7 changed files
with
67 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
export { | ||
DarkModeEnabledProvider, | ||
useDarkMode, | ||
defaultTheme, | ||
} from './themes/DarkModeEnabledContext'; | ||
export * from './themes'; | ||
|
||
export * from './tokens'; | ||
export * from './token-presets'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export { | ||
DarkModeEnabledContext, | ||
DarkModeEnabledProvider, | ||
useDarkMode, | ||
} from './DarkModeEnabledContext'; | ||
|
||
export { type Theme, themes, labelsByTheme, defaultTheme } from './themes'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
export type ThemeType = 'dark' | 'light'; | ||
export type Theme = 'dark' | 'light'; | ||
|
||
export const themes: ThemeType[] = ['dark', 'light']; | ||
export const themes: Theme[] = ['dark', 'light']; | ||
|
||
export const defaultTheme: ThemeType = 'light'; | ||
export const labelsByTheme = { dark: 'Escuro', light: 'Claro' }; | ||
|
||
export const defaultTheme: Theme = 'light'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters