Skip to content
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

refactor: skeleton loader for article cards #309

Merged
merged 4 commits into from
Oct 30, 2023
Merged
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
26 changes: 26 additions & 0 deletions resources/css/_skeletons.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,29 @@
rgb(var(--theme-color-dark-700))
);
}

.dark .react-loading-skeleton.skeleton-primary {
background-color: rgb(var(--theme-color-primary-400));
}

.dark .react-loading-skeleton.skeleton-primary::after {
background-image: linear-gradient(
90deg,
rgb(var(--theme-color-primary-500)),
rgb(var(--theme-color-primary-600)),
rgb(var(--theme-color-primary-500))
);
}

.react-loading-skeleton.skeleton-primary {
background-color: rgb(var(--theme-color-dark-600));
}

.react-loading-skeleton.skeleton-primary::after {
background-image: linear-gradient(
90deg,
rgb(var(--theme-color-dark-700)),
rgb(var(--theme-color-dark-800)),
rgb(var(--theme-color-dark-700))
);
}
2 changes: 1 addition & 1 deletion resources/js/Components/Articles/Article.blocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const FeaturedCollections = ({
isCircle
className={cn("h-6 w-6 rounded-full ring-2", {
"bg-white ring-white dark:bg-theme-dark-800 dark:ring-theme-dark-800": !isLargeVariant,
"bg-theme-dark-900 ring-theme-dark-900 dark:bg-theme-primary-800 dark:ring-theme-primary-800":
"skeleton-primary bg-theme-dark-900 ring-theme-dark-900 dark:bg-theme-primary-800 dark:ring-theme-primary-800":
isLargeVariant,
})}
errorClassName="!p-0"
Expand Down
6 changes: 4 additions & 2 deletions resources/js/Components/Articles/ArticleCard/ArticleCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ export const ArticleCard = ({
>
<div className="mx-2 mt-2 aspect-video overflow-hidden rounded-lg bg-theme-secondary-300">
<Img
className="h-full w-full rounded-lg object-cover"
className={cn("h-full w-full rounded-lg object-cover", {
"skeleton-primary": isLargeVariant,
})}
wrapperClassName={cn("h-full [&>span]:h-full", {
"bg-white dark:bg-theme-dark-900": !isLargeVariant,
"bg-white dark:bg-theme-primary-900 ": !isLargeVariant,
"bg-theme-dark-900 group-hover:bg-theme-primary-700 dark:bg-theme-primary-700 dark:group-hover:bg-theme-primary-600":
isLargeVariant,
})}
Expand Down
2 changes: 1 addition & 1 deletion resources/js/Pages/Articles/Index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const ArticlesIndex = ({
className="pb-2 text-center dark:text-theme-dark-50 sm:text-left"
>
{t("pages.articles.header_title")}{" "}
<span className="text-theme-primary-600">
<span className="text-theme-primary-600 dark:text-theme-primary-400">
{initialHighlightedArticles.length + initialArticles.paginated.meta.total}
</span>{" "}
{initialHighlightedArticles.length + initialArticles.paginated.meta.total === 1
Expand Down
Loading