Skip to content

Commit

Permalink
feat: add App component
Browse files Browse the repository at this point in the history
  • Loading branch information
Kleostro committed Apr 29, 2024
1 parent ff236cc commit 8faf877
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/app/App/model/AppModel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import AppView from '../view/AppView.ts';

class AppModel {
private appView: AppView = new AppView();

public getHTML(): HTMLDivElement {
return this.appView.getHTML();
}
}

export default AppModel;
27 changes: 27 additions & 0 deletions src/app/App/view/AppView.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { TAG_NAMES } from '@/shared/constants/enums.ts';
import createBaseElement from '@/shared/utils/createBaseElement.ts';

import APP_STYLES from './appView.module.scss';

class AppView {
private pagesContainer: HTMLDivElement;

constructor() {
this.pagesContainer = this.createHTML();
}

private createHTML(): HTMLDivElement {
this.pagesContainer = createBaseElement({
cssClasses: [APP_STYLES.siteWrapper],
tag: TAG_NAMES.DIV,
});

return this.pagesContainer;
}

public getHTML(): HTMLDivElement {
return this.pagesContainer;
}
}

export default AppView;
File renamed without changes.
4 changes: 4 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
import AppModel from '@/app/App/model/AppModel.ts';
import '@/styles.scss';

const myApp = new AppModel();
document.body.append(myApp.getHTML());

0 comments on commit 8faf877

Please sign in to comment.