Skip to content

Commit

Permalink
fix dynamic CSS for some widget types
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Oct 14, 2024
1 parent debb7fc commit b070a9a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
3 changes: 2 additions & 1 deletion packages/project-editor/features/style/style.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,8 @@ export class Style extends EezObject {

cssDeclarations: computed,
cssPreview: computed,
classNames: computed
classNames: computed,
dynamicCSS: observable
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ export class TextDashboardWidget extends Widget {
<span
className={classNames(
this.style.classNames,
this.style.getConditionalClassNames(flowContext)
this.style.getConditionalClassNames(flowContext),
this.style.getDynamicCSSClassName(flowContext)
)}
onClick={this.onClick(flowContext)}
style={{ opacity: style.opacity }}
Expand Down Expand Up @@ -828,7 +829,8 @@ export class NumberInputDashboardWidget extends Widget {
<NumberInputDashboardWidgetElement
className={classNames(
this.style.classNames,
this.style.getConditionalClassNames(flowContext)
this.style.getConditionalClassNames(flowContext),
this.style.getDynamicCSSClassName(flowContext)
)}
component={this}
flowContext={flowContext}
Expand Down Expand Up @@ -975,7 +977,8 @@ export class CheckboxWidget extends Widget {
className={classNames(
"form-check",
this.style.classNames,
this.style.getConditionalClassNames(flowContext)
this.style.getConditionalClassNames(flowContext),
this.style.getDynamicCSSClassName(flowContext)
)}
style={{ opacity: style.opacity }}
>
Expand Down Expand Up @@ -1154,7 +1157,8 @@ export class RadioWidget extends Widget {
className={classNames(
"form-check",
this.style.classNames,
this.style.getConditionalClassNames(flowContext)
this.style.getConditionalClassNames(flowContext),
this.style.getDynamicCSSClassName(flowContext)
)}
style={{ opacity: style.opacity }}
>
Expand Down Expand Up @@ -1300,7 +1304,8 @@ export class SwitchDashboardWidget extends Widget {
className={classNames(
"form-check form-switch",
this.style.classNames,
this.style.getConditionalClassNames(flowContext)
this.style.getConditionalClassNames(flowContext),
this.style.getDynamicCSSClassName(flowContext)
)}
style={{ opacity: style.opacity }}
>
Expand Down Expand Up @@ -1993,7 +1998,8 @@ export class ButtonDashboardWidget extends Widget {
<button
className={classNames(
buttonStyle.classNames,
this.style.getConditionalClassNames(flowContext)
this.style.getConditionalClassNames(flowContext),
this.style.getDynamicCSSClassName(flowContext)
)}
style={{ opacity: style.opacity }}
disabled={!buttonEnabled}
Expand Down Expand Up @@ -2327,6 +2333,9 @@ const SliderDashboardWidgetElement = observer(
this.props.component.style.classNames,
this.props.component.style.getConditionalClassNames(
flowContext
),
this.props.component.style.getDynamicCSSClassName(
flowContext
)
)}
type="range"
Expand Down

0 comments on commit b070a9a

Please sign in to comment.