Skip to content

Commit

Permalink
refactor: property name
Browse files Browse the repository at this point in the history
  • Loading branch information
ochairo committed Mar 29, 2024
1 parent cadc346 commit 41a8d01
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,12 @@ You have multiple options for development.
## Development sample

Component

```ts
class TitleComponent extends BaseComponent {
constructor() {
super();
this._shadowRoot.innerHTML = `<h1>Title: Sample</h1>`;
this._dom.innerHTML = `<h1>Title: Sample</h1>`;
}
onInit() { ... }
Expand All @@ -152,4 +153,3 @@ class TitleComponent extends BaseComponent {
customElements.define("title-component", TitleComponent);
export default TitleComponent;
```
2 changes: 1 addition & 1 deletion src/app/features/error/presentation/error.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import BaseComponent from "@infrastructure/base-component/base.component";
export class ErrorComponent extends BaseComponent {
constructor() {
super();
this._shadowRoot.innerHTML = `<style>${style}</style>${template}`;
this._dom.innerHTML = `<style>${style}</style>${template}`;
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/app/features/showcase/presentation/showcase.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "@infrastructure/ui-components/atoms/input/input.component";
import { ShowcaseData } from "@showcase/domain/entities/showcase.entity";
import GetShowcase from "@showcase/domain/usecases/get-showcase.usecase";
import style from "@showcase/presentation/showcase.component.css";
import template from "@showcase/presentation/showcase.component.html";
import html from "@showcase/presentation/showcase.component.html";

/**
* [ShowcaseComponent] Component to display UI samples
Expand All @@ -16,7 +16,7 @@ class ShowcaseComponent extends BaseComponent {

constructor(getShowcase?: GetShowcase) {
super();
this._shadowRoot.innerHTML = `<style>${style}</style>${template}`;
this._dom.innerHTML = `<style>${style}</style>${html}`;
this._getShowcase = getShowcase || null;
}

Expand All @@ -40,7 +40,7 @@ class ShowcaseComponent extends BaseComponent {
* Render the table with the data
*/
private renderTable(): void {
const tbody = this._shadowRoot.querySelector("tbody");
const tbody = this._dom.querySelector("tbody");
if (tbody) {
tbody.innerHTML = this._apiData
.map(
Expand All @@ -59,7 +59,7 @@ class ShowcaseComponent extends BaseComponent {
}

private displayError(message: string) {
this._shadowRoot.innerHTML = `<h1>Error: ${message}</h1>`;
this._dom.innerHTML = `<h1>Error: ${message}</h1>`;
}

private navigateToErrorPage() {
Expand Down
4 changes: 2 additions & 2 deletions src/app/infrastructure/base-component/base.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
*/
export default class BaseComponent extends HTMLElement {
/** [BaseComponent] Shadow root of the element */
protected _shadowRoot: ShadowRoot;
protected _dom: ShadowRoot;

constructor() {
super();
this._shadowRoot = this.attachShadow({ mode: "open" });
this._dom = this.attachShadow({ mode: "open" });
}

connectedCallback() {
Expand Down

0 comments on commit 41a8d01

Please sign in to comment.