Skip to content

Commit e87a72d

Browse files
authored
Pager UI updates (#787)
* Move vars from Card to global scope * Update UI for the medium viewport at Pager component * Add details-padding argument to static-card-size * Add details-padding-card to link bottom * Fix medium breakpoint comment
1 parent bc475a8 commit e87a72d

File tree

7 files changed

+30
-22
lines changed

7 files changed

+30
-22
lines changed

src/components/Card.vue

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,6 @@ export default {
151151
<style scoped lang="scss">
152152
@import 'docc-render/styles/_core.scss';
153153
154-
$details-padding: 17px;
155-
$content-margin: 4px;
156-
157-
@mixin static-card-size($card-height, $img-height) {
158-
@include inTargetWeb {
159-
--card-height: #{$card-height};
160-
--card-details-height: #{$card-height - $img-height - ($details-padding * 2)};
161-
}
162-
--card-cover-height: #{$img-height};
163-
}
164-
165154
.card {
166155
overflow: hidden;
167156
display: block;
@@ -215,7 +204,7 @@ $content-margin: 4px;
215204
216205
.details {
217206
background-color: var(--color-card-background);
218-
padding: $details-padding;
207+
padding: $details-padding-card;
219208
position: relative;
220209
height: var(--card-details-height);
221210
@include font-styles(card-content-small);
@@ -226,14 +215,14 @@ $content-margin: 4px;
226215
227216
.floating-style & {
228217
--color-card-background: transparent;
229-
padding: $details-padding 0;
218+
padding: $details-padding-card 0;
230219
}
231220
}
232221
233222
.eyebrow {
234223
color: var(--color-card-eyebrow);
235224
display: block;
236-
margin-bottom: $content-margin;
225+
margin-bottom: $content-margin-card;
237226
@include font-styles(card-eyebrow-small);
238227
239228
.large & {
@@ -253,11 +242,11 @@ $content-margin: 4px;
253242
254243
.card-content {
255244
color: var(--color-card-content-text);
256-
margin-top: $content-margin;
245+
margin-top: $content-margin-card;
257246
}
258247
259248
.link {
260-
bottom: 17px;
249+
bottom: $details-padding-card;
261250
display: flex;
262251
align-items: center;
263252
position: absolute;

src/components/DocumentationTopic/TopicsLinkCardGrid.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<template #page="{ page }">
1818
<Row :columns="{
1919
large: compactCards ? 3 : 2,
20-
medium: 2,
20+
medium: compactCards ? 3 : 2,
2121
}">
2222
<Column
2323
v-for="item in page"
@@ -82,7 +82,7 @@ export default {
8282
}) => (usePager ? {
8383
[TopicSectionsStyle.compactGrid]: {
8484
[BreakpointName.large]: 6,
85-
[BreakpointName.medium]: 4,
85+
[BreakpointName.medium]: 6,
8686
[BreakpointName.small]: 1,
8787
},
8888
[TopicSectionsStyle.detailedGrid]: {

src/components/Pager.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ export default {
343343
justify-content: center;
344344
margin-top: 1rem;
345345
346-
@include breakpoint(small) {
346+
@include breakpoint(medium) {
347347
display: none;
348348
}
349349
}

src/components/PagerControl.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ export default {
5454
width: var(--control-size, 1rem);
5555
5656
&[disabled] {
57-
opacity: 0;
57+
opacity: 0.6;
58+
59+
@include breakpoints-from(large) {
60+
opacity: 0;
61+
}
5862
}
5963
}
6064

src/styles/core/_helpers.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@
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+
3546
////
3647
/// Used to apply the globalish styles that the ".section-content" class
3748
/// provided on /documentation pages

src/styles/core/_vars.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,7 @@ $localizedQuotes: (
9090

9191
// Localized Fonts
9292
$localizedFonts: () !default;
93+
94+
// Cards
95+
$details-padding-card: 17px;
96+
$content-margin-card: 4px;

tests/unit/components/DocumentationTopic/TopicsLinkCardGrid.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ describe('TopicsLinkCardGrid', () => {
5656
expect(pager.exists()).toBe(true);
5757
expect(pager.props('pages').length).toBe(2);
5858

59-
// 10 items => 3 pages at medium breakpoint (4 links per page)
59+
// 10 items => 2 pages at medium breakpoint (6 links per page)
6060
wrapper.setData({ breakpoint: BreakpointName.medium });
6161
pager = wrapper.find(Pager);
6262
expect(pager.exists()).toBe(true);
63-
expect(pager.props('pages').length).toBe(3);
63+
expect(pager.props('pages').length).toBe(2);
6464

6565
// 10 items => 10 pages at small breakpoint (1 links per page)
6666
wrapper.setData({ breakpoint: BreakpointName.small });

0 commit comments

Comments
 (0)