Skip to content

Commit 20e5ea3

Browse files
authored
Make Card's link position to be relative instead of absolute (#837)
Resolves: rdar://128642639
1 parent b7ef1b5 commit 20e5ea3

File tree

2 files changed

+20
-32
lines changed

2 files changed

+20
-32
lines changed

src/components/Card.vue

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,21 @@ export default {
152152
@import 'docc-render/styles/_core.scss';
153153
154154
.card {
155+
--margin-link: #{$details-padding-card};
155156
overflow: hidden;
156-
display: block;
157+
display: flex;
158+
flex-direction: column;
157159
transition: box-shadow, transform 160ms ease-out;
158160
will-change: box-shadow, transform;
159161
backface-visibility: hidden;
160-
height: var(--card-height);
162+
163+
&.large {
164+
--margin-link: #{$details-padding-card * 1.5};
165+
166+
&.floating-style {
167+
--margin-link: var(--spacing-stacked-margin-large);
168+
}
169+
}
161170
162171
&:hover {
163172
text-decoration: none;
@@ -182,31 +191,31 @@ export default {
182191
}
183192
184193
&.small {
185-
@include static-card-size(408px, 235px);
194+
--card-cover-height: 235px;
186195
@include breakpoint(medium) {
187-
@include static-card-size(341px, 163px);
196+
--card-cover-height: 163px;
188197
}
189198
}
190199
191200
&.large {
192-
@include static-card-size(556px, 359px);
201+
--card-cover-height: 359px;
193202
@include breakpoint(medium) {
194-
@include static-card-size(420px, 249px);
203+
--card-cover-height: 249px;
195204
}
196205
}
197206
198207
&.floating-style {
199208
--color-card-shadow: transparent;
200-
--card-height: auto;
201-
--card-details-height: auto;
202209
}
203210
}
204211
205212
.details {
213+
flex-grow: 1;
214+
display: flex;
215+
flex-direction: column;
206216
background-color: var(--color-card-background);
207217
padding: $details-padding-card;
208218
position: relative;
209-
height: var(--card-details-height);
210219
@include font-styles(card-content-small);
211220
212221
.large & {
@@ -241,28 +250,22 @@ export default {
241250
}
242251
243252
.card-content {
253+
flex-grow: 1;
244254
color: var(--color-card-content-text);
245255
margin-top: $content-margin-card;
246256
}
247257
248258
.link {
249-
bottom: $details-padding-card;
259+
margin-top: var(--margin-link);
250260
display: flex;
251261
align-items: center;
252-
position: absolute;
253262
254263
.link-icon {
255264
height: 0.6em;
256265
width: 0.6em;
257266
// move the icon closer
258267
margin-left: .3em;
259268
}
260-
261-
.floating-style & {
262-
bottom: unset;
263-
margin-top: var(--spacing-stacked-margin-large);
264-
position: relative;
265-
}
266269
}
267270
268271
@include breakpoint(small) {
@@ -276,9 +279,6 @@ export default {
276279
}
277280
278281
&.small, &.large {
279-
--card-height: auto;
280-
--card-details-height: auto;
281-
282282
@include inTargetWeb {
283283
min-width: 280px;
284284
--card-cover-height: 227px;
@@ -288,7 +288,6 @@ export default {
288288
}
289289
290290
.link {
291-
bottom: unset;
292291
margin-top: 7px;
293292
position: relative;
294293
}

src/styles/core/_helpers.scss

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,6 @@
3232
border: 0;
3333
}
3434

35-
////
36-
/// Applies size for static cards
37-
////
38-
@mixin static-card-size($card-height, $img-height, $details-padding: $details-padding-card) {
39-
@include inTargetWeb {
40-
--card-height: #{$card-height};
41-
--card-details-height: #{$card-height - $img-height - ($details-padding * 2)};
42-
}
43-
--card-cover-height: #{$img-height};
44-
}
45-
4635
////
4736
/// Used to apply the globalish styles that the ".section-content" class
4837
/// provided on /documentation pages

0 commit comments

Comments
 (0)