Skip to content

Commit

Permalink
feat: add RegistrationPage component
Browse files Browse the repository at this point in the history
  • Loading branch information
Kleostro committed Apr 29, 2024
1 parent e4fb133 commit a129728
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/pages/RegistrationPage/model/RegistrationPageModel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { PageInterface } from '@/shared/types/interfaces.ts';

import RegistrationPageView from '../view/RegistrationPageView.ts';

class LoginPageModel implements PageInterface {
private view: RegistrationPageView;

constructor(parent: HTMLDivElement) {
this.view = new RegistrationPageView(parent);
}

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

export default LoginPageModel;
41 changes: 41 additions & 0 deletions src/pages/RegistrationPage/view/RegistrationPageView.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { TAG_NAMES } from '@/shared/constants/enums.ts';
import createBaseElement from '@/shared/utils/createBaseElement.ts';

import REGISTRATION_PAGE_STYLES from './registrationPageView.module.scss';

class RegistrationPageView {
private page: HTMLDivElement;

private parent: HTMLDivElement;

constructor(parent: HTMLDivElement) {
this.parent = parent;
this.page = this.createHTML();
}

private createHTML(): HTMLDivElement {
this.page = createBaseElement({
cssClasses: [REGISTRATION_PAGE_STYLES.registrationPage],
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(REGISTRATION_PAGE_STYLES.registrationPage_hidden);
return true;
}

public show(): boolean {
this.page.classList.remove(REGISTRATION_PAGE_STYLES.registrationPage_hidden);
return true;
}
}
export default RegistrationPageView;
File renamed without changes.

0 comments on commit a129728

Please sign in to comment.