Skip to content

Commit

Permalink
fix(documentation): fix about and legal
Browse files Browse the repository at this point in the history
  • Loading branch information
goncalosard authored and danielleroux committed Oct 18, 2022
1 parent 174c49b commit f393f6e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
29 changes: 20 additions & 9 deletions packages/core/src/components/menu-about/menu-about.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ export class MenuAbout {
/**
* Active tab
*/
@Prop({ mutable: true, reflect: true }) activeTabLabel: string =
this.i18nImprintLabel;
@Prop({ mutable: true }) activeTabLabel: string;

/**
* Label of first tab
Expand Down Expand Up @@ -71,11 +70,12 @@ export class MenuAbout {
}

componentWillLoad() {
this.setTab(this.activeTabLabel || this.aboutItems[0]?.label);
if (this.aboutItems.length) {
this.setTab(this.activeTabLabel || this.aboutItems[0].label);
}
}

componentDidLoad() {
this.setTab(this.activeTabLabel || this.aboutItems[0]?.label);
forceUpdate(this.el);
}

Expand All @@ -98,6 +98,21 @@ export class MenuAbout {
return this.aboutItems.indexOf(selectedItem);
}

private getTabItems() {
return this.aboutItems.map(({ label }) => {
return (
<ix-tab-item
class={{
active: label === this.activeTabLabel,
}}
onClick={() => this.setTab(label)}
>
{label}
</ix-tab-item>
);
});
}

render() {
return (
<Host
Expand All @@ -120,11 +135,7 @@ export class MenuAbout {
selected={this.getSelectedTabIndex(this.activeTabLabel)}
class="about-tabs"
>
{this.labels.map((label) => (
<ix-tab-item onClick={() => this.setTab(label)}>
{label}
</ix-tab-item>
))}
{this.getTabItems()}
</ix-tabs>
<div class="about-items">
<slot></slot>
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/menu-about/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ SPDX-License-Identifier: MIT

| Property | Attribute | Description | Type | Default |
| ------------------ | ---------------------- | ------------------ | --------- | ----------------------------- |
| `activeTabLabel` | `active-tab-label` | Active tab | `string` | `this.i18nImprintLabel` |
| `activeTabLabel` | `active-tab-label` | Active tab | `string` | `undefined` |
| `i18nImprintLabel` | `i-1-8n-imprint-label` | | `string` | `'Imprint'` |
| `label` | `label` | Label of first tab | `string` | `'About & legal information'` |
| `show` | `show` | Internal | `boolean` | `false` |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import SourceAngular from './../../auto-generated/previews/angular/about-and-leg

## Usage

<Preview name="about-and-legal" height="30rem">
<Preview name="about-and-legal" height="30rem" width="100%" noMargin>
<TabItem value="javascript">
<SourceWebComponent />
</TabItem>
Expand Down
1 change: 1 addition & 0 deletions packages/documentation/src/components/Color.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export default function Color() {
<tr key={k}>
<td>
<input
readOnly
className="form-control"
defaultValue={k}
ref={refs[k]}
Expand Down

0 comments on commit f393f6e

Please sign in to comment.