-
Notifications
You must be signed in to change notification settings - Fork 65
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
Frontend | Features/loading #196
Conversation
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.
Loading ui должен быть максимально "обезличен" - не имеет никаких названий, все блоки повторяют примерный интерфейс страницы или блока. Текстовые названия или блоки можно делать линиями разных размеров.
Импорт всех компонентов Skeleton должен быть примерно таким:
import {SkeletonCard} from 'components/Skeleton'
Для этого нужно в файле components/Skeleton/index.ts
указать импорты из components/Skeleton/*/**
.
Перед созданием коммита важно проверить изменения (опечатки, лишние комментарии и отступы).
Необходимо подтянуть последние изменения frontend ветки и добавить loading файлы для news details страницы.
frontend/README.md
Outdated
@@ -1,4 +1,4 @@ | |||
# GSpot Frontend | |||
yy# GSpot Frontend |
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.
Это нужно убрать
.openFilter { | ||
@apply mb-[10px] block h-[44px] w-full flex-row items-center justify-center rounded-default | ||
border border-solid border-main-400 bg-main-30 tracking-[0.4px] text-white hover:border-main-500 hover:bg-main-40 lg:hidden; | ||
} | ||
|
||
.components { | ||
@apply mb-[10px] mt-[20px] flex flex-col items-start justify-start; | ||
|
||
@media (min-width: 576px) { | ||
@apply mb-[20px]; | ||
} | ||
@media (min-width: 992px) { | ||
@apply mt-[30px]; | ||
} | ||
@media (min-width: 1310px) { | ||
@apply pr-[10px]; | ||
} | ||
} | ||
|
||
.wrapper { | ||
@apply hidden lg:block; | ||
|
||
&.open { | ||
@apply block; | ||
} | ||
} | ||
|
||
.title { | ||
@apply mb-[25px] flex h-auto w-full flex-row items-center justify-between text-base font-semibold | ||
tracking-default text-white; | ||
} | ||
|
||
.clearFilters { | ||
@apply text-[12px] font-normal tracking-[0px] text-primary; | ||
} | ||
|
||
.applyFilter { | ||
@apply flex h-[44px] w-full flex-row items-center justify-center rounded-default border | ||
border-solid border-main-400 bg-main-30 tracking-[.4px] text-white hover:border-main-500 hover:bg-main-40; | ||
} |
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.
Эти стили тут не нужны, они никак не используются.
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.
Для страницы тоже нужен loading ui. Повторяем примерный интерфейс страницы
frontend/app/(main)/loading.tsx
Outdated
export default function Loading() { | ||
return ( | ||
<> | ||
<Section | ||
title={ | ||
<> | ||
<b>Лучшие игры</b> этого месяца | ||
</> | ||
} | ||
> | ||
<div className={s.bestGames}> | ||
{[...new Array(2)].map((_, index) => ( | ||
<SkeletonGameBigCard key={index} /> | ||
))} | ||
</div> | ||
<Section title={<>Новинки и обновления</>} /> | ||
<div className={s.card}> | ||
{[...new Array(10)].map((_, index) => ( | ||
<SkeletonCard key={index} /> | ||
))} | ||
</div> | ||
</Section> | ||
</> | ||
) | ||
} |
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.
Блоки не должны иметь названия. Вместо названия показываем линию или прямоугольник.
Неправильная вложенность Section:
<Section>
<Section />
</Section>
Должно быть так:
<Section />
<Section />
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.
Лучше на название блока сделать отдельный скелетон тогда?
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.
Или лучше скелетон текст наподобие скелетона инпута и передавать просто размер текста( в описании карточек, в тайтле и на странице детали?)
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.
Название можно сделать линией
frontend/app/(main)/page.module.scss
Outdated
|
||
//Skeleton styles | ||
.bestGames { | ||
@apply mt-3 mb-20 grid grid-cols-2 gap-4 max-lg:grid-cols-1; | ||
} | ||
.card { | ||
@apply mt-3 grid grid-cols-5 gap-4 max-xl:grid-cols-3 max-sm:grid-cols-2 max-[440px]:grid-cols-1; | ||
} |
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.
Стили скелетона не должны хранится в основном файле стилей страницы.
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.
У меня реализован скелетон на 1 карточку. В первом блоке "Лучшие игры" две карточки нужно и ниже где новинки пять, где тогда писать стили , чтобы сверстать блок с двумя и пятью картами? в каталоге для этого я использую стили самой станицы(.row, .columns), на главной же странице все реализовано через карусель.
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.
Для каждого компонента скелетона стили хранятся рядом с этим компонентом
frontend/app/(main)/page.tsx
Outdated
@@ -46,12 +46,14 @@ const Home = async () => { | |||
<div className={s.sections}> | |||
{otherGames && ( | |||
<Section title="Игры"> | |||
{' '} |
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.
Этот отступ не нужен, его нужно убрать. Точно такой же чуть ниже.
frontend/package.json
Outdated
@@ -21,6 +21,7 @@ | |||
"classnames": "^2.3.2", | |||
"next": "^13.3.1-canary.4", | |||
"qs": "^6.11.1", | |||
"rc-progress": "^3.4.1", |
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.
Эта библиотека/модуль нигде не используется. Нужно удалить его локально npm uninstall rc-progress
и он автоматически удалится из этого и package-lock.json
файла.
{[...new Array(17)].map((_, index) => ( | ||
<SkeletonInput size={'44'} key={index} /> | ||
))} |
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.
Размеры инпутов должны быть разные у скелетона фильтров. В идеале повторить примерный интерфейс фильтра.
Важно учитывать, что для мобильных устройств компонент фильтра выглядит по другому.
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.
нужен ли этот второй скелетон на фильтры? я спрашивала в первом комментарии. и как реализовать, чтобы для моб устройств он спрятался, если в файле лоадинг нет логики? создать компонент скелетон на фильтры отдельный?
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.
Прятать можно через стили. В tailwind есть классы для работы с разными размерами.
<SkeletonCard key={index} /> | ||
))} | ||
</div> | ||
<Pagination /> |
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.
Нельзя использовать интерактивные компоненты для loading ui, такие как Paginaton, Carousel и тд. Такие компоненты могут делать запросы в api, делать некоторые вычисления и тд.
Loading ui обычно должен содержать стили для блоков и сами блоки. Никакой сложной js/ts логики не хранит.
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.
Тогда можно создавать стили для лоадинг в разметке или можно для него отдельный файл со стилями? в интернете встречала стили в разметке лоадинг.
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.
В идеале, конечно, делать отдельно. Можно попробовать сделать к примеру loading.module.scss файл для таких стилей
Есть пару вопросов, которые хотелось бы обсудить:
очень жду комментарии)