Skip to content

Commit

Permalink
feature: added empty sets texts
Browse files Browse the repository at this point in the history
  • Loading branch information
Regikon committed Dec 20, 2024
1 parent 01e6826 commit 7307c2a
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/application/components/alert_window/alert_window.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,12 @@
&__text {
font-size: var(--text-size-3);
}

&__header {
font-size: var(--text-size-7);
font-weight: var(--text-weight-bold);
color: var(--color-main-100);
margin: 0;
text-align: center;
}
}
8 changes: 6 additions & 2 deletions src/application/components/alert_window/alert_window.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ export interface AlertWindowProps {
text: string;
href: string;
buttonText: string;
header?: string;
}
export class AlertWindow extends Component {
constructor({ elementClass, text, href, buttonText }: AlertWindowProps) {
super({ elementClass, text, href, buttonText });
constructor({ elementClass, text, href, buttonText, header = '' }: AlertWindowProps) {
super({ elementClass, text, href, buttonText, header });
}
render() {
return (
<div className={`${this.props.elementClass} alert-window alert-window_theme-dark`}>
{(this.props.header || false) && (
<div className="alert-window__header">{this.props.header}</div>
)}
<div className="alert-window__text">{this.props.text}</div>
<a className="alert-window__button button button_main-primary" href={this.props.href}>
{this.props.buttonText}
Expand Down
1 change: 1 addition & 0 deletions src/application/components/item_list/item_list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class ItemList extends Component {
});
return (
<div className={`${this.props.elementClass} item-list`}>
{listItems && listItems.length === 0 && 'Пока ничего нет'}
{this.props.isOwner && (
<div className="item-list__add-button-container">
<a
Expand Down
30 changes: 30 additions & 0 deletions src/application/pages/not_found_page/not_found_page.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@use '@/scss/variables' as v;

@media screen and (min-width: v.$mobile-breakpoint) {
.not-found-page {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
margin-top: 0px;
}
}

.not-found-page {
display: flex;
flex-direction: column;
align-items: stretch;
justify-content: center;
width: var(--4-col);
max-width: 425px;
margin-top: 16px;

-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;

&__alert-window {
padding: 16px;
border-radius: var(--radius-m);
}
}
16 changes: 15 additions & 1 deletion src/application/pages/not_found_page/not_found_page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { Component, VirtualNodeSpec } from '@/modules/vdom/virtual_node';
import * as vdom from '@/modules/vdom/virtual_dom';
import { AlertWindow } from '@/application/components/alert_window/alert_window';
import { resolveUrl } from '@/modules/common_utils/url_utils/url_utils';
import './not_found_page.scss';

export interface NotFoundPageProps {
url: URL;
Expand All @@ -11,6 +14,17 @@ export class NotFoundPage extends Component {
}

render(): VirtualNodeSpec {
return <div>{this.props.url.toString()} Not Found (404)</div>;
return (
<div key="not-found-page" className="not-found-page">
<AlertWindow
key="alert-window"
elementClass="not-found-page__alert-window"
header="Ой... Вы попали не туда"
text="Но всегда можно вернуться на главную"
href={resolveUrl('vacancies', null)}
buttonText="Вернуться на главную"
/>
</div>
);
}
}
4 changes: 4 additions & 0 deletions src/application/pages/vacancies_page/vacancies_page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@
background-color: var(--color-background-900);
color: var(--color-main-100);
}

&__no-vacancies {
font-size: var(--text-size-5);
}
}

/* Vacancy-container component */
Expand Down
5 changes: 5 additions & 0 deletions src/application/pages/vacancies_page/vacancies_page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ export class VacanciesPage extends Component {
{this.getVacancyHeader(this.searchQuery, this.searchCategory)}
</h1>
<div className="content-body__vacancy-container vacancy-container ruler ruler_theme-dark ruler_direction-vertical">
{vacancyCards.length === 0 && (
<div className="content-body__no-vacancies">
По вашему запросу ничего не найдено
</div>
)}
{...vacancyCards}
</div>
</div>
Expand Down

0 comments on commit 7307c2a

Please sign in to comment.