Skip to content

Commit

Permalink
Поправил верстку
Browse files Browse the repository at this point in the history
  • Loading branch information
YarikMix committed Mar 4, 2024
1 parent ee0b0d3 commit 158d90f
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 12 deletions.
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ handlebars -m public/src/components/button/button.hbs -f public/build/button.js
handlebars -m public/src/components/settings-panel/settings-panel.hbs -f public/build/settings-panel.js
handlebars -m public/src/components/span/span.hbs -f public/build/span.js
handlebars -m public/src/components/logo/logo.hbs -f public/build/logo.js
handlebars -m public/src/components/empty-note/empty-note.hbs -f public/build/empty-note.js

2 changes: 1 addition & 1 deletion public/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const registerPage = {
inputs: {
login: {
type: "text",
placeholder: "Введите логин"
placeholder: "Придумайте логин"
},
password: {
type: "password",
Expand Down
1 change: 1 addition & 0 deletions public/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
@import "src/components/footer/footer.css";
@import "src/components/settings-panel/settings-panel.css";
@import "src/components/logo/logo.css";
@import "src/components/empty-note/empty-note.css";

*, *::before, *::after {
box-sizing: border-box;
Expand Down
10 changes: 10 additions & 0 deletions public/src/components/empty-note/empty-note.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.empty-note-wrapper {
display: flex;
justify-content: center;
gap: 10px;
background: #fff;
box-shadow: rgba(149, 157, 165, 0.2) 0px 8px 24px;
border-radius: 15px;
padding: 15px;
width: 300px;
}
3 changes: 3 additions & 0 deletions public/src/components/empty-note/empty-note.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="empty-note-wrapper">
<h3>У вас еще нет заметок ;(</h3>
</div>
18 changes: 18 additions & 0 deletions public/src/components/empty-note/empty-note.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import "../../../build/empty-note.js";

export class EmptyNote {
#parent;
#config;

constructor(parent, config) {
this.#parent = parent;
this.#config = config;
}

render() {
this.#parent.insertAdjacentHTML(
"beforeend",
window.Handlebars.templates["empty-note.hbs"](this.#config)
);
}
}
2 changes: 1 addition & 1 deletion public/src/modules/ajax.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {AppEventMaker} from "./eventMaker.js";
import {UserStoreEvents} from "../stores/user/events.js";

const isDebug = false;
const isDebug = true;

const baseUrl = `http://${isDebug ? "127.0.0.1" : "you-note.ru"}:8080/api`;

Expand Down
14 changes: 4 additions & 10 deletions public/src/pages/notes/notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {Note} from "../../components/note/note.js";
import {AppNoteRequests} from "../../modules/ajax.js";
import Page from "../page.js";
import {NoteEditor} from "../../components/note-editor/note-editor.js";
import {EmptyNote} from "../../components/empty-note/empty-note.js";

export default class NotesPage extends Page {
#notesContainer;
Expand All @@ -29,24 +30,17 @@ export default class NotesPage extends Page {

this.#notesContainer = document.querySelector(".notes-container");

const emptyNoteData = {
id: "empty-note",
data: {
title: "У вас пока нет заметок :(",
content: ""
}
}

AppNoteRequests.GetAll().then((notes) => {
if (notes.length > 0) {
this.#renderNotes(notes);
} else {
let emptyNote = new Note(this.#notesContainer, emptyNoteData);
let emptyNote = new EmptyNote(this.#notesContainer);
emptyNote.render()
}
}).catch(() => {
}).catch((err) => {
console.log(err)
let emptyNote = new Note(this.#notesContainer, emptyNoteData);
let emptyNote = new EmptyNote(this.#notesContainer);
emptyNote.render()
})

Expand Down

0 comments on commit 158d90f

Please sign in to comment.