Skip to content
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

DEV: Introduce RenderGlimmer helper for use in widgets #17592

Merged
merged 2 commits into from Jul 21, 2022

Conversation

davidtaylorhq
Copy link
Member

This allows an arbitrary Glimmer template to be rendered inside a Widget. That template can include any kind content, including Classic Ember components and Glimmer components. This leans on Ember's official {{#in-element}} helper which means that all component lifecycle hooks are called correctly.

This is a modern replacement for our existing ComponentConnector implementation. We'll deprecate ComponentConnector in the near future.

Example usage:

// (inside an existing widget)
html(){
  return [
    new RenderGlimmer(
      this,
      "div.my-wrapper-class",
      hbs`<MyComponent @arg1={{@data.arg1}} />`,
      {
        arg1: "some argument value"
      }
    ),
  ]
}

See widgets/render-glimmer.js for documentation, and render-glimmer-test for more example uses.

This allows an arbitrary Glimmer template to be rendered inside a Widget. That template can include any kind content, including Classic Ember components and Glimmer components. This leans on Ember's official `{{#in-element}}` helper which means that all component lifecycle hooks are called correctly.

This is a modern replacement for our existing `ComponentConnector` implementation. We'll deprecate `ComponentConnector` in the near future.

Example usage:

```javascript
// (inside an existing widget)
html(){
  return [
    new RenderGlimmer(
      this,
      "div.my-wrapper-class",
      hbs`<MyComponent @Arg1={{@data.arg1}} />`,
      {
        arg1: "some argument value"
      }
    ),
  ]
}
```

See `widgets/render-glimmer.js` for documentation, and `render-glimmer-test` for more example uses.
Co-authored-by: Jarek Radosz <jradosz@gmail.com>
@davidtaylorhq davidtaylorhq merged commit 6c5efb6 into main Jul 21, 2022
@davidtaylorhq davidtaylorhq deleted the render-glimmer branch July 21, 2022 17:58
@discoursebot
Copy link

This pull request has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/add-settings-to-your-discourse-theme/82557/77

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants