Skip to content

Commit 2ab1fda

Browse files
authored
Merge pull request #1370 from prezly/feature/dev-21920-fix-bea-card-interactivity
[DEV-21920] Fix - boxed card interactivity
2 parents 8c82ad8 + c3e7cc1 commit 2ab1fda

File tree

4 files changed

+33
-21
lines changed

4 files changed

+33
-21
lines changed

src/components/StoryCards/StoryCard.module.scss

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
.container {
22
position: relative;
3+
text-decoration: none;
34

45
@include desktop-up {
56
&:hover .image {
67
transform: scale(1.05);
78
}
8-
99
}
1010
}
1111

@@ -57,14 +57,22 @@
5757
}
5858

5959
.content {
60+
position: relative;
6061
padding: $spacing-4 0;
6162
}
6263

64+
.linkOverlay {
65+
position: absolute;
66+
inset: 0;
67+
z-index: 1;
68+
}
69+
6370
.title {
6471
margin: 0;
6572
font-size: 1.625rem;
6673
line-height: 140%;
6774
font-weight: $font-weight-semi-bold;
75+
color: var(--prezly-text-color);
6876

6977
@include tablet-up {
7078
@include ensure-max-text-height(3, 140%);
@@ -75,22 +83,13 @@
7583
}
7684
}
7785

78-
.titleLink {
79-
text-decoration: none;
80-
color: var(--prezly-text-color);
81-
}
82-
8386
.subtitle {
8487
@include ensure-max-text-height(3, 160%);
8588

8689
margin: $spacing-2 0 0;
8790
font-size: 1rem;
8891
line-height: 160%;
8992
font-weight: $font-weight-regular;
90-
}
91-
92-
.subtitleLink {
93-
text-decoration: none;
9493
color: var(--prezly-text-color-secondary);
9594
}
9695

@@ -166,6 +165,15 @@
166165
border: 0;
167166
}
168167

168+
&:hover {
169+
@include shadow-xs;
170+
}
171+
172+
&.vertical {
173+
display: grid;
174+
grid-template-rows: auto 1fr;
175+
}
176+
169177
&.vertical .imageWrapper {
170178
border-bottom: 1px solid var(--prezly-border-color);
171179
}
@@ -181,7 +189,7 @@
181189
.title {
182190
@include heading-3;
183191
}
184-
192+
185193
@include mobile-only {
186194
.content {
187195
padding: $spacing-4;
@@ -224,3 +232,8 @@
224232
}
225233
}
226234
}
235+
236+
.categories {
237+
position: relative;
238+
z-index: 2;
239+
}

src/components/StoryCards/StoryCard.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,12 @@ export function StoryCard({
8484
/>
8585
</Link>
8686
<div className={styles.content}>
87+
<Link aria-label={titleAsString} className={styles.linkOverlay} href={href} />
8788
<div className={styles.meta}>
8889
{hasCategories && (
8990
<CategoriesList
9091
categories={translatedCategories}
92+
className={styles.categories}
9193
external={external}
9294
isStatic
9395
showAllCategories
@@ -100,17 +102,9 @@ export function StoryCard({
100102
[styles.expanded]: !showSubtitle || !subtitle,
101103
})}
102104
>
103-
<Link href={href} className={styles.titleLink}>
104-
{title}
105-
</Link>
105+
{title}
106106
</HeadingTag>
107-
{showSubtitle && subtitle && (
108-
<p className={styles.subtitle}>
109-
<Link href={href} className={styles.subtitleLink}>
110-
{subtitle}
111-
</Link>
112-
</p>
113-
)}
107+
{showSubtitle && subtitle && <p className={styles.subtitle}>{subtitle}</p>}
114108
{showDate && publishedAt && (
115109
<div className={styles.date}>
116110
<FormattedDate value={publishedAt} />

src/styles/mixins/_shadows.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
@mixin shadow-xs {
2+
box-shadow: $shadow-xs;
3+
}
4+
15
@mixin shadow-s {
26
box-shadow: $shadow-s;
37
}

src/styles/variables/_shadows.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
$shadow-xs: 0px 0px 12px rgba(55, 65, 81, 8%);
12
$shadow-s: 0 1px 2px rgb(17 24 39 / 6%), 0 1px 3px rgb(17 24 39 / 10%);
23
$shadow-m: 0 2px 4px rgb(17 24 39 / 6%), 0 4px 6px rgb(17 24 39 / 10%);
34
$shadow-l: 0 10px 15px rgb(17 24 39 / 10%), 0 4px 6px rgb(17 24 39 / 5%);

0 commit comments

Comments
 (0)