diff --git a/src/pages/NotFoundPage/model/NotFoundPageModel.ts b/src/pages/NotFoundPage/model/NotFoundPageModel.ts new file mode 100644 index 00000000..c689a352 --- /dev/null +++ b/src/pages/NotFoundPage/model/NotFoundPageModel.ts @@ -0,0 +1,17 @@ +import type { PageInterface } from '@/shared/types/interfaces.ts'; + +import NotFoundPageView from '../view/NotFoundPageView.ts'; + +class NotFoundPageModel implements PageInterface { + private view: NotFoundPageView; + + constructor(parent: HTMLDivElement) { + this.view = new NotFoundPageView(parent); + } + + public getHTML(): HTMLDivElement { + return this.view.getHTML(); + } +} + +export default NotFoundPageModel; diff --git a/src/pages/NotFoundPage/view/NotFoundPageView.ts b/src/pages/NotFoundPage/view/NotFoundPageView.ts new file mode 100644 index 00000000..5ab7cfd6 --- /dev/null +++ b/src/pages/NotFoundPage/view/NotFoundPageView.ts @@ -0,0 +1,41 @@ +import { TAG_NAMES } from '@/shared/constants/enums.ts'; +import createBaseElement from '@/shared/utils/createBaseElement.ts'; + +import NOT_FOUND_PAGE_STYLES from './notFoundPageView.module.scss'; + +class NotFoundPageView { + private page: HTMLDivElement; + + private parent: HTMLDivElement; + + constructor(parent: HTMLDivElement) { + this.parent = parent; + this.page = this.createHTML(); + } + + private createHTML(): HTMLDivElement { + this.page = createBaseElement({ + cssClasses: [NOT_FOUND_PAGE_STYLES.notFoundPage], + tag: TAG_NAMES.DIV, + }); + + this.parent.append(this.page); + + return this.page; + } + + public getHTML(): HTMLDivElement { + return this.page; + } + + public hide(): boolean { + this.page.classList.add(NOT_FOUND_PAGE_STYLES.notFoundPage_hidden); + return true; + } + + public show(): boolean { + this.page.classList.remove(NOT_FOUND_PAGE_STYLES.notFoundPage_hidden); + return true; + } +} +export default NotFoundPageView; diff --git a/src/pages/NotFoundPage/.gitkeep b/src/pages/NotFoundPage/view/notFoundPageView.module.scss similarity index 100% rename from src/pages/NotFoundPage/.gitkeep rename to src/pages/NotFoundPage/view/notFoundPageView.module.scss