Skip to content

Commit 174de61

Browse files
authored
docs: clean up HBS references (#12168)
1 parent 7d98c6e commit 174de61

File tree

7 files changed

+186
-1044
lines changed

7 files changed

+186
-1044
lines changed

docs/4-development/01-package.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sidebar_label: Create Web Components Project
44

55
# Create UI5 Web Components Project (Package)
66

7-
This tutorial explains how to create web components project, ready to be published as NPM package, on top of the UI5 Web Components framework (`@ui5/webcomponents-base`) and tools (`@ui5/webcomponents-tools`) to make use of development server, theming, HBS template support, i18n, test setup, etc.
7+
This tutorial explains how to create web components project, ready to be published as NPM package, on top of the UI5 Web Components framework (`@ui5/webcomponents-base`) and tools (`@ui5/webcomponents-tools`) to make use of development server, theming, JSX template support, i18n, test setup, etc.
88

99
## Initialize New Project
1010

@@ -176,7 +176,7 @@ The main files describing a Web Component are:
176176
| File | Purpose |
177177
|----------------------------|----------------|
178178
| `src/MyComponent.js` | Web Component class |
179-
| `src/MyComponent.hbs` | Handlebars template |
179+
| `src/MyComponentTemplate.tsx` | JSX template |
180180
181181
In order to understand how a UI5 Web Component works and what lies behind these two files, read the next articles
182182
to understand more about [Developing web components](./02-component.md).

docs/4-development/02-component.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -109,26 +109,6 @@ class MyDemoComponent extends UI5Element {
109109

110110
**Note:** The build scripts automatically transpile your `.css` files to JavaScript files. For example, your `my-package/src/theme/MyDemoComponent.css` will be transpiled to `my-package/src/generated/themes/MyDemoComponent.css.ts`, which, in addition to your component's CSS, also contains definitions for all CSS variables for the default theme.
111111

112-
### dependencies
113-
This option accepts an array of dependencies, which are all other web components used inside the `.hbs` template file. Without this, the internally used web components won't be defined.
114-
115-
Furthermore, to utilize the Scoping feature, you must list all the internally used web components in the `dependencies` static getter. The framework reads the dependencies and scopes the tag names of the listed web components.
116-
117-
For example, if the `ui5-icon` tag (or any other standard or custom UI5 Web Component) is used inside the template, you must import the `Icon` web component and add it to the `dependencies` static getter as shown:
118-
119-
```ts
120-
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
121-
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
122-
import Icon from "@ui5/webcomponents/dist/Icon.js";
123-
124-
@customElement({
125-
dependencies: [Icon]
126-
})
127-
class MyDemoComponent extends UI5Element {
128-
// class implementation
129-
}
130-
```
131-
132112
### languageAware
133113
This option accepts a boolean value and determines if the component should be re-rendered whenever the language changes. Use this setting if your component has translatable texts and needs to be re-rendered when the app changes the language.
134114

docs/4-development/04-slots.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@ Currently, there are two types of slots: "named" and "unnamed". The difference b
99
## Unnamed slots
1010

1111
Use unnamed slots when your component doesn't need to be aware of or interact with the children passed to a specific slot.
12-
To define an unnamed slot, simply add a `<slot>` element within your `.hbs` template. For example:
12+
To define an unnamed slot, simply add a `<slot>` element within your template. For example:
1313

14-
```hbs
15-
{{!-- MyDemoComponent.hbs --}}
16-
<div>
17-
<slot name="mySlot"></slot>
18-
</div>
14+
```tsx
15+
export default function MyDemoComponentTemplate() {
16+
return <div><slot name="mySlot"></slot></div>;
17+
}
1918
```
2019

2120
On the consuming side, elements can be passed to this slot using the `slot` attribute:
@@ -118,10 +117,14 @@ class MyDemoComponent extends UI5Element {
118117

119118
To render individual slots, you have to iterate all children in that slot and use the `_individualSlot` property that the framework sets automatically on each child:
120119

121-
```hbs
122-
{{#each mySlot}}
123-
<slot name="{{this._individualSlot}}"></slot>
124-
{{/each}}
120+
```tsx
121+
export default function MyDemoComponentTemplate() {
122+
return (
123+
<div>
124+
{ this.mySlot.map(mySlotEl => <slot name={mySlotEl._individualSlot}></slot>)}
125+
</div>
126+
);
127+
}
125128
```
126129

127130
**Note:** When this option is set to `true`, the `_individualSlot` property is set to each direct child, where `_individualSlot` returns a string following the pattern `{nameOfTheSlot}-{index}` and the slot attribute is changed based on that pattern.

0 commit comments

Comments
 (0)