Skip to content

Commit

Permalink
refactor: improve theme naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Wurielle committed Jul 20, 2024
1 parent 82f3ab5 commit f6f23b1
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/react/src/tokens/border.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const borderWidth = {
export type BorderWidth = keyof typeof borderWidth

declare module '@/tokens' {
export interface BearmeanTheme {
export interface Theme {
borderRadius: typeof borderRadius
borderStyle: typeof borderStyle
borderWidth: typeof borderWidth
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/tokens/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export type Colors = typeof colors
export type Color = ObjectDotNotation<Colors>

declare module '@/tokens' {
export interface BearmeanTheme {
export interface Theme {
colors: Colors
}
}
2 changes: 1 addition & 1 deletion packages/react/src/tokens/elevation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const elevation = {
export type Elevation = keyof typeof elevation

declare module '@/tokens' {
export interface BearmeanTheme {
export interface Theme {
elevation: typeof elevation
}
}
12 changes: 6 additions & 6 deletions packages/react/src/tokens/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ export * from './ratio'
export * from './screens'
export * from './spacing'

export interface BearmeanTheme {}
export interface Theme {}

export interface BearmeanThemeOverride {}
export interface ThemeOverride {}

type BearmeanMergedTheme = {
[Key in keyof BearmeanTheme]-?: Key extends keyof BearmeanThemeOverride ? BearmeanThemeOverride[Key] : BearmeanTheme[Key]
type BearmeanTheme = {
[Key in keyof Theme]-?: Key extends keyof ThemeOverride ? ThemeOverride[Key] : Theme[Key]
}

declare module '@emotion/react' {
export interface Theme extends BearmeanMergedTheme {}
export interface Theme extends BearmeanTheme {}
}

/* Override default theme like this: */
// declare module '@/tokens' {
// export interface BearmeanThemeOverride {
// export interface ThemeOverride {
// screens: {
// min: {
// value: number
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/tokens/level.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const level = {
export type Level = keyof typeof level

declare module '@/tokens' {
export interface BearmeanTheme {
export interface Theme {
level: typeof level
}
}
2 changes: 1 addition & 1 deletion packages/react/src/tokens/ratio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const ratio = {
export type Ratio = keyof typeof ratio

declare module '@/tokens' {
export interface BearmeanTheme {
export interface Theme {
ratio: typeof ratio
}
}
2 changes: 1 addition & 1 deletion packages/react/src/tokens/screens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export type Screens = typeof screens
export type Screen = keyof Screens

declare module '@/tokens' {
export interface BearmeanTheme {
export interface Theme {
screens: Screens
}
}
2 changes: 1 addition & 1 deletion packages/react/src/tokens/spacing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export type NegativeSpacing = keyof typeof negativeSpacing
export type PositiveSpacing = keyof typeof positiveSpacing

declare module '@/tokens' {
export interface BearmeanTheme {
export interface Theme {
spacing: typeof spacing
negativeSpacing: typeof negativeSpacing
positiveSpacing: typeof positiveSpacing
Expand Down

0 comments on commit f6f23b1

Please sign in to comment.