Skip to content

Commit

Permalink
2.10. Шаблонизируй это
Browse files Browse the repository at this point in the history
  • Loading branch information
lunianka committed Mar 4, 2024
1 parent f178443 commit b08d8ad
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"copy-webpack-plugin": "11.0.0",
"eslint": "8.28.0",
"eslint-config-htmlacademy": "8.0.0",
"html-webpack-plugin": "^5.6.0",
"html-webpack-plugin": "5.6.0",
"webpack": "5.75.0",
"webpack-cli": "5.0.0",
"webpack-dev-server": "4.11.1"
Expand All @@ -31,6 +31,6 @@
"node": "18"
},
"dependencies": {
"dayjs": "^1.11.6"
"dayjs": "1.11.6"
}
}
2 changes: 1 addition & 1 deletion src/presenter/trip-presenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default class TripPresenter {
this.offersModel = offersModel;
this.pointsModel = pointsModel;
this.points = [...pointsModel.get()];
}
}

init() {
render(new SortView(), this.tripContainer);
Expand Down
4 changes: 2 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const Duration = {
MIN: 59
};

let date = dayjs().subtract(getRandomInteger(0, Duration.DAY), 'day').toDate();
//let date = dayjs().subtract(getRandomInteger(0, Duration.DAY), 'day').toDate();

function getDate({ next }) {
const minsGap = getRandomInteger(0, Duration.MIN);
Expand Down Expand Up @@ -88,4 +88,4 @@ export {
formatStringToShortDate,
formatStringToTime,
getPointDuration
}
};
12 changes: 6 additions & 6 deletions src/view/edit-point-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,25 @@ function createPointTypesTemplate(currentType) {
</div>`).join('');
}

function createPointOffersTemplate({ pointOffers }) {
const offerItems = pointOffers.map(function (offer) {
return (
`<div class="event__offer-selector">
const createPointOffersTemplate = ({pointOffers}) => {
const offerItems = pointOffers.map(offer => {

Check failure on line 31 in src/view/edit-point-view.js

View workflow job for this annotation

GitHub Actions / Check

Expected parentheses around arrow function argument

Check failure on line 31 in src/view/edit-point-view.js

View workflow job for this annotation

GitHub Actions / Check

Unexpected block statement surrounding arrow body; move the returned value immediately after the `=>`
return (

Check failure on line 32 in src/view/edit-point-view.js

View workflow job for this annotation

GitHub Actions / Check

Expected indentation of 4 spaces but found 6
`<div class="event__offer-selector">

Check failure on line 33 in src/view/edit-point-view.js

View workflow job for this annotation

GitHub Actions / Check

Expected indentation of 6 spaces but found 10
<input class="event__offer-checkbox visually-hidden" id="${offer.id}" type="checkbox" name="event-offer-luggage" checked>
<label class="event__offer-label" for="${offer.id}">
<span class="event__offer-title">${offer.title}</span>
&plus;&euro;&nbsp;
<span class="event__offer-price">${offer.price}</span>
</label>
</div>`
);
);

Check failure on line 41 in src/view/edit-point-view.js

View workflow job for this annotation

GitHub Actions / Check

Expected indentation of 4 spaces but found 6
}).join('');

return `<div class="event__available-offers">${offerItems}</div>`;
}

Check failure on line 45 in src/view/edit-point-view.js

View workflow job for this annotation

GitHub Actions / Check

Missing semicolon

function createEditPointTemplate({point, pointDestination, pointOffers}) {
const { basePrice, dateFrom, dateTo, offers, type } = point;
const { basePrice, dateFrom, dateTo, type } = point;
return (`
<li class="trip-events__item">
<form class="event event--edit" action="#" method="post">
Expand Down
12 changes: 6 additions & 6 deletions src/view/point-view.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { createElement } from '../render.js';
import { formatStringToDateTime, formatStringToShortDate, formatStringToTime, getPointDuration } from '../utils.js';

function createPointOffersTemplate({ pointOffers }) {
const offerItems = pointOffers.map(function (offer) {
return (
`<li class="event__offer">
const createPointOffersTemplate = ({pointOffers}) => {
const offerItems = pointOffers.map(offer => {
return (
`<li class="event__offer">
<span class="event__offer-title">${offer.title}</span>
&plus;&euro;&nbsp;
<span class="event__offer-price">${offer.price}</span>
</li>`
);
);
}).join('');

return `<ul class="event__selected-offers">${offerItems}</ul>`;
}

function createPointTemplate({point, pointDestination, pointOffers}) {
const { basePrice, dateFrom, dateTo, offers, isFavorite, type } = point;
const { basePrice, dateFrom, dateTo, isFavorite, type } = point;
const favoriteClassName = isFavorite ? 'event__favorite-btn--active' : '';
return (`
<li class="trip-events__item">
Expand Down

0 comments on commit b08d8ad

Please sign in to comment.