-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Theme variants #684
Add Theme variants #684
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 22d905c:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few thoughts
src/core/interfaces.d.ts
Outdated
root: string; | ||
} | ||
|
||
export interface ThemeVariant { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this be better as ThemeWithVariant
and then the interface below ThemeWithVariants
?
src/core/interfaces.d.ts
Outdated
} | ||
|
||
export interface ThemeVariant { | ||
theme: Theme | ThemeVariantConfig; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think theme
should now be called css
? Would make it less weird when accessing them, so would be theme.css
over theme.theme
src/core/middleware/theme.ts
Outdated
return theme.hasOwnProperty('variant'); | ||
} | ||
|
||
function isThemeVariantConfig(theme: Theme | ThemeVariantConfig): theme is ThemeVariantConfig { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps isThemeWithVariants
? or hasVariants
src/core/middleware/theme.ts
Outdated
currentTheme.set(css); | ||
variant() { | ||
let theme; | ||
const { theme: themeProp } = properties(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The theme property should be either the explicitly passed theme or the injected theme already, so can just use the property?
Type: bug / feature
The following has been addressed in the PR:
prettier
as per the readme code style guidelinesDescription:
Adds ability to pass both a theme and a variant to widgets via theme middleware / mixin
Related to: #683