Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

fix: make theme variables and styles extensible #292

Merged
merged 4 commits into from
Oct 5, 2018

Conversation

levithomason
Copy link
Member

@levithomason levithomason commented Oct 1, 2018

Currently, consumers cannot add custom component display names to a theme's componentVariables and componentStyles. This is a problem as they will need to add their component's to the theme as well.

I've also added the unlisted component display names the theme.

@codecov
Copy link

codecov bot commented Oct 1, 2018

Codecov Report

Merging #292 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #292   +/-   ##
=======================================
  Coverage   89.54%   89.54%           
=======================================
  Files          62       62           
  Lines        1177     1177           
  Branches      175      152   -23     
=======================================
  Hits         1054     1054           
  Misses        121      121           
  Partials        2        2

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 37ba3dc...6ff137b. Read the comment docs.

@@ -60,6 +60,9 @@ export interface ICSSPseudoElementStyle extends ICSSInJSStyle {
}

export interface ICSSInJSStyle extends React.CSSProperties {
// TODO Questionable: how else would users target their own children?
[key: string]: any
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it wrong to make this [key: string]: CssInJssStyle? I am a bit worried with the any there..

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, yep. Good call.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is actually quite a bit trickier. Not every string property is an ICSSInJSStyle. Some have limited values, such as speak, so they cannot be typed as ICSSInJSStyle.

Since this is currently blocking and broken, let's continue with a more permissive object (as is) for now. We can always improve typings.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it! Approved.

@@ -163,72 +166,142 @@ export interface IThemePrepared {
}

export interface IThemeComponentStylesInput {
[key: string]: any

Copy link
Contributor

Choose a reason for hiding this comment

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

As in the previous comment, can we make this: [key: string]: IComponentPartStylesInput? What else can be the value of this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, here we can since all keys have the same value type. Same with IThemeComponentStylesPrepared below which I have updated as well.

Text?: IComponentPartStylesPrepared
}

export interface IThemeComponentVariablesInput {
[key: string]: any
Copy link
Contributor

Choose a reason for hiding this comment

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

I guesss the same can be applied here as well as in the IThemeComponentVariablesPrepared? [key: string]: ComponentVariablesInput & [key: string]: ComponentVariablesPrepared? Otherwise we have some typings errors already..

@kuzhelov kuzhelov added postponed Item is postponed and will be reconsidered in future and removed postponed Item is postponed and will be reconsidered in future labels Oct 4, 2018
@levithomason levithomason merged commit 2c8fca9 into master Oct 5, 2018
@levithomason levithomason deleted the fix/theme-styles-typings branch October 5, 2018 01:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants