-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24178 from margelo/@chrispader/theme-switching-ts…
…-types Theme switching: Add TypeScript types
- Loading branch information
Showing
13 changed files
with
155 additions
and
72 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,6 +1,6 @@ | ||
import React from 'react'; | ||
import styles from './styles'; | ||
import styles, {type Styles} from './styles'; | ||
|
||
const ThemeStylesContext = React.createContext(styles); | ||
const ThemeStylesContext = React.createContext<Styles>(styles); | ||
|
||
export default ThemeStylesContext; |
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 was deleted.
Oops, something went wrong.
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 @@ | ||
import React from 'react'; | ||
import darkTheme from './default'; | ||
import {ThemeColors} from './types'; | ||
|
||
const ThemeContext = React.createContext<ThemeColors>(darkTheme); | ||
|
||
export default ThemeContext; |
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 |
---|---|---|
@@ -1,8 +1,89 @@ | ||
import DeepRecord from '@src/types/utils/DeepRecord'; | ||
import defaultTheme from './default'; | ||
type Color = string; | ||
|
||
type ThemeBase = DeepRecord<string, string>; | ||
type ThemeColors = { | ||
// Figma keys | ||
appBG: Color; | ||
splashBG: Color; | ||
highlightBG: Color; | ||
border: Color; | ||
borderLighter: Color; | ||
borderFocus: Color; | ||
icon: Color; | ||
iconMenu: Color; | ||
iconHovered: Color; | ||
iconSuccessFill: Color; | ||
iconReversed: Color; | ||
iconColorfulBackground: Color; | ||
textSupporting: Color; | ||
text: Color; | ||
textColorfulBackground: Color; | ||
link: Color; | ||
linkHover: Color; | ||
buttonDefaultBG: Color; | ||
buttonHoveredBG: Color; | ||
buttonPressedBG: Color; | ||
danger: Color; | ||
dangerHover: Color; | ||
dangerPressed: Color; | ||
warning: Color; | ||
success: Color; | ||
successHover: Color; | ||
successPressed: Color; | ||
transparent: Color; | ||
signInPage: Color; | ||
dangerSection: Color; | ||
|
||
type ThemeDefault = typeof defaultTheme; | ||
// Additional keys | ||
overlay: Color; | ||
inverse: Color; | ||
shadow: Color; | ||
componentBG: Color; | ||
hoverComponentBG: Color; | ||
activeComponentBG: Color; | ||
signInSidebar: Color; | ||
sidebar: Color; | ||
sidebarHover: Color; | ||
heading: Color; | ||
textLight: Color; | ||
textDark: Color; | ||
textReversed: Color; | ||
textBackground: Color; | ||
textMutedReversed: Color; | ||
textError: Color; | ||
offline: Color; | ||
modalBackground: Color; | ||
cardBG: Color; | ||
cardBorder: Color; | ||
spinner: Color; | ||
unreadIndicator: Color; | ||
placeholderText: Color; | ||
heroCard: Color; | ||
uploadPreviewActivityIndicator: Color; | ||
dropUIBG: Color; | ||
receiptDropUIBG: Color; | ||
checkBox: Color; | ||
pickerOptionsTextColor: Color; | ||
imageCropBackgroundColor: Color; | ||
fallbackIconColor: Color; | ||
reactionActiveBackground: Color; | ||
reactionActiveText: Color; | ||
badgeAdHoc: Color; | ||
badgeAdHocHover: Color; | ||
mentionText: Color; | ||
mentionBG: Color; | ||
ourMentionText: Color; | ||
ourMentionBG: Color; | ||
tooltipSupportingText: Color; | ||
tooltipPrimaryText: Color; | ||
skeletonLHNIn: Color; | ||
skeletonLHNOut: Color; | ||
QRLogo: Color; | ||
starDefaultBG: Color; | ||
loungeAccessOverlay: Color; | ||
mapAttributionText: Color; | ||
white: Color; | ||
|
||
export type {ThemeBase, ThemeDefault}; | ||
PAGE_BACKGROUND_COLORS: Record<string, Color>; | ||
}; | ||
|
||
export {type ThemeColors, type Color}; |
5 changes: 3 additions & 2 deletions
5
src/styles/themes/useTheme.js → src/styles/themes/useTheme.ts
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
18 changes: 10 additions & 8 deletions
18
src/styles/themes/useThemePreference.js → src/styles/themes/useThemePreference.ts
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
Oops, something went wrong.