-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Задачи CreateApp, WeatherApp, CounterApp и MapApp #3
Conversation
Добавляю преподавателя (@ShGKme) для код-ревью. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Принято
const timeToTimestamp = (time) => { | ||
return Date.parse('1970-01-01T' + time) | ||
} | ||
|
||
const isNignt = (dt, sunrise, sunset) => { | ||
const ts = timeToTimestamp(dt); | ||
return ts < timeToTimestamp(sunrise) || ts > timeToTimestamp(sunset) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Строки в формате HH:MM
можно сравнивать просто лексикографически как строки без преобразований. '08:30' < '09:12'
:class="{ | ||
'weather-card': true, | ||
'weather-card--night': isNignt(row.current.dt, row.current.sunrise, row.current.sunset) | ||
}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Статические классы, которые всегда есть у элемента, можно описывать явно в шаблоне через обычный атрибут class="weather-card"
. Так будет видно и основные классы верстки, и какие классы определяются динамически.
<div class="weather-details__item" v-for="details in [ | ||
{label: 'Давление, мм рт. ст.', value: pressureHpaToMmhg(row.current.pressure)}, | ||
{label: 'Влажность, %', value: row.current.humidity}, | ||
{label: 'Облачность, %', value: row.current.clouds}, | ||
{label: 'Ветер, м/с', value: row.current.wind_speed}, | ||
]"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лучше такие большие значения выносить в setup
В задачу CreateApp внёс поправки по вашим рекомендациям