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: improve article card hover style #300

Merged
merged 7 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
8 changes: 5 additions & 3 deletions resources/js/Components/Articles/ArticleCard/ArticleCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ export type ArticleCardVariant = "normal" | "large";
export const ArticleCard = ({
article,
variant,
className,
}: {
article: App.Data.Articles.ArticleData;
variant?: ArticleCardVariant;
className?: string;
}): JSX.Element => {
const { t } = useTranslation();
const { user } = useActiveUser();
Expand All @@ -27,11 +29,12 @@ export const ArticleCard = ({
className={cn(
"transition-default group flex h-full w-full flex-col overflow-hidden rounded-xl border border-theme-secondary-300",
{
"bg-white ring-inset ring-theme-primary-100 hover:ring dark:border-theme-dark-700 dark:bg-theme-dark-900 dark:hover:ring-theme-dark-500":
"bg-white ring-theme-primary-100 hover:ring dark:border-theme-dark-700 dark:bg-theme-dark-900 dark:hover:ring-theme-dark-500":
!isLargeVariant,
"bg-theme-dark-900 hover:bg-theme-primary-700 dark:border-none dark:bg-theme-primary-700 dark:hover:bg-theme-primary-600":
isLargeVariant,
},
className,
)}
>
<div className="mx-2 mt-2 aspect-video overflow-hidden rounded-lg bg-theme-secondary-300">
Expand Down Expand Up @@ -75,8 +78,7 @@ export const ArticleCard = ({

<div
className={cn("transition-default flex items-center rounded-b-lg px-6 py-3", {
"bg-theme-secondary-50 group-hover:mx-[3px] group-hover:mb-[3px] group-hover:px-[21px] group-hover:pb-[9px] dark:bg-theme-dark-800":
!isLargeVariant,
"bg-theme-secondary-50 dark:bg-theme-dark-800": !isLargeVariant,
"bg-theme-dark-950 group-hover:bg-theme-primary-800 dark:bg-theme-primary-800 dark:group-hover:bg-theme-primary-700":
isLargeVariant,
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export const ArticlesScroll = ({ articles }: { articles: App.Data.Articles.Artic
<Carousel
horizontalOffset={horizontalOffset}
headerClassName="mx-6 sm:mx-8 2xl:mx-0"
swiperClassName="m-0 lg:mx-8 2xl:m-0"
spaceBetween={8}
swiperClassName="-m-1 lg:-my-1 2xl:-m-1 lg:mx-7"
spaceBetween={0}
slidesPerView={slidesPerView}
title={
<>
Expand All @@ -32,7 +32,9 @@ export const ArticlesScroll = ({ articles }: { articles: App.Data.Articles.Artic
>
{articles.map((article) => (
<CarouselItem key={article.id}>
<ArticleCard article={article} />
<div className="h-full p-1">
<ArticleCard article={article} />
</div>
</CarouselItem>
))}
</Carousel>
Expand Down
Loading