-
Notifications
You must be signed in to change notification settings - Fork 39
Conversation
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.
minor nits, otherwise looks good to me.
README.md
Outdated
@@ -321,9 +321,9 @@ export const classNameTwo: string; | |||
|
|||
**Important:** at runtime a JavaScript file is required to provide the processed CSS class names. | |||
|
|||
The `ThemeableMixin` provides a method available on the instance `this.classes()` that consumes string class names and converts them into the expected class object when a widget is rendered. Classes that are passed to `this.classes()` are made available to be themed, as described in the [applying a theme](#applying-a-theme) section. | |||
The `ThemedMixin` provides a method available on the instance `this.theme()` that consumes string class names and returns the themes equivalent class names. |
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.
themes equivalent class names -> theme's equivalent class names
README.md
Outdated
} | ||
} | ||
``` | ||
|
||
If an array is passed to `this.theme` then an array will be returned for example, `this.theme([ css.root, css.other ])` will return an array containing the theme's class names `[ 'themedRoot', 'themedOther' ]`. |
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.
be returned for example, -> be returned. For example,
@dylans updated |
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.
Some comments about clarity...
@@ -334,11 +334,13 @@ import { ThemeableMixin, theme } from '@dojo/widget-core/mixins/Themeable'; | |||
@theme(css) | |||
export default class MyWidget extends ThemeableMixin(WidgetBase) { | |||
protected render() { | |||
return v('div', { classes: this.classes(css.root).fixed(css.rootFixed) }); | |||
return v('div', { classes: [ this.theme(css.root), css.rootFixed ] }); |
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.
Isn't this supposed to be:
-return v('div', { classes: [ this.theme(css.root), css.rootFixed ] })
+return v('div', { classes: [ ...this.theme(css.root), css.rootFixed ] })
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.
Nevermind... I see below about it... it does feel a bit confusing without an example maybe actually showing a code example after the return array and spreading it would be useful. Also, IIRC from the changes, this.theme()
only accepts a single argument? If that is correct it might be better to be a bit more specific above when we say this.theme()
that consumes string class names and returns the theme's equivalent class names. to something like this.theme()
takes a single argument that is either a string class name or an array of string class names and returns the theme's equivalent class names as either a single string or array of strings?
Type: feature
The following has been addressed in the PR:
Description:
README updates for the Themed changes