Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
496 changes: 496 additions & 0 deletions dist/main.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions getDate.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Не используется
export const getDate = (commentDate) => {
let d = new Date(commentDate);
function addZero(a) {
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
background-color: red;
}
</style>
<script type="module" src="main.js"></script>
<script type="module" src="./dist/main.js"></script>

</html>
1,373 changes: 1,373 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "webdev-dom-homework",
"version": "1.0.0",
"description": "https://glebkaf.github.io/webdev-dom-homework/",
"main": "main.js",
"scripts": {
"dev": "webpack --mode development --watch"
},
"author": "",
"license": "ISC",
"dependencies": {
"date-fns": "^3.6.0"
},
"devDependencies": {
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
}
}
6 changes: 4 additions & 2 deletions renderСomments.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import { getDate } from "./getDate.js";
// import { getDate } from "./getDate.js";
import { changementLikes } from "./likes.js";
import { answerComment } from "./answerComment.js";
import { user, token } from "./api.js";
import { renderLogin } from "./loginPage.js";
import { formEvents } from "./main.js";
import { format } from "date-fns"



export const renderComments = ({comments}) => {
const appElement = document.querySelector('#app');
const commentsHtml = comments.map((comment, index) => {
const getDate = format(new Date(comment.date), 'yyyy-MM-dd hh.mm.ss');
return `<li class="comment">
<div class="comment-header">
<div>${comment.name}</div>
<div>${getDate(comment.date)}</div>
<div>${getDate}</div>
</div>
<div class="comment-body">
<div class="comment-text">
Expand Down
6 changes: 6 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
entry: "./main.js",
output: {
filename: "main.js"
}
}