Skip to content

Commit f82b8f7

Browse files
d0richStanG4313
andauthored
[DO-599] prev/next buttons description customization (#54)
* Define config for cards description * Implement hidden option * Nuxt config lintfix * Implement display limited * Eslint ignore line * Fix schema declaration * Add docs * Remove unneded lines * Update docs/content/3.customization.md `limit` -> `limited` Co-authored-by: Stanislav Glushkov <[email protected]> --------- Co-authored-by: Stanislav Glushkov <[email protected]>
1 parent 173f322 commit f82b8f7

File tree

4 files changed

+101
-1
lines changed

4 files changed

+101
-1
lines changed

app.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
export default defineAppConfig({
1818
exactproDocs: {
1919
title: 'Exactpro Documentation',
20+
prevNextCards: {
21+
description: {
22+
display: 'full',
23+
limit: 2
24+
}
25+
},
2026
github: {
2127
branch: 'master',
2228
docsDir: '/'

components/ep/layout/SurroundDocCard.vue

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ defineProps<{
2727
doc: ParsedContent
2828
direction: 'before' | 'after'
2929
}>()
30+
31+
const config = useToolkitConfig().prevNextCards!
3032
</script>
3133

3234
<template>
@@ -52,7 +54,30 @@ defineProps<{
5254
</span>
5355
</div>
5456
<h4 class="text-xl font-bold">{{ doc.title }}</h4>
55-
<p class="break-words">{{ doc.description }}</p>
57+
<p
58+
v-if="config.description?.display !== 'hidden'"
59+
class="break-words"
60+
:style="{
61+
'--line-clamp':
62+
config.description?.display === 'limited'
63+
? config.description?.limit
64+
: 'unset'
65+
}"
66+
:class="{
67+
'description--limited': config.description?.display === 'limited'
68+
}"
69+
>
70+
{{ doc.description }}
71+
</p>
5672
</div>
5773
</NuxtLink>
5874
</template>
75+
76+
<style scoped>
77+
.description--limited {
78+
overflow: hidden;
79+
display: -webkit-box;
80+
-webkit-box-orient: vertical;
81+
-webkit-line-clamp: var(--line-clamp);
82+
}
83+
</style>

docs/content/3.customization.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,45 @@ Set up your very own logo with an image of your choice in two ways:
2121

2222
Set up your very own header background with an image of your choice by placing an image file named `header-bg.{some-extension}` in the `assets/theme` folder.
2323

24+
## Documentation body
25+
26+
### Previous and Next buttons
27+
28+
Each page of the documentation has buttons that allow you to navigate to the previous and next pages. These buttons are placed right after article content.
29+
30+
These cards are customizable in `app.config.ts` by key `exactproDocs.prevNextCards` (see below).
31+
32+
```ts
33+
export default defineAppConfig({
34+
exactproDocs: {
35+
prevNextCards: {
36+
/**
37+
* Display options for the description of the page in prev/next cards
38+
*/
39+
description: {
40+
/**
41+
* Choose display type for the description of the page in prev/next cards.
42+
*
43+
* 'full' - display full description
44+
* 'limited' - display first n lines of description
45+
* 'hidden' - hide description
46+
*
47+
* @default "full"
48+
*/
49+
display: 'full',
50+
/**
51+
* Limit of lines for the description of the page in prev/next cards
52+
* It will be used if display type is "limited"
53+
*
54+
* @default 2
55+
*/
56+
limit: 2
57+
}
58+
}
59+
}
60+
})
61+
```
62+
2463
## Footer
2564

2665
### Social Media Links

nuxt.schema.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,36 @@ export default defineNuxtSchema({
5353
required: true
5454
}
5555
},
56+
prevNextCards: {
57+
$schema: {
58+
title: 'Configuration for previous and next pages cards'
59+
},
60+
description: {
61+
$schema: {
62+
title:
63+
'Display options for the description of the page in prev/next cards',
64+
type: 'object'
65+
},
66+
display: {
67+
$schema: {
68+
title:
69+
'Choose display type for the description of the page in prev/next cards',
70+
type: 'string',
71+
tsType: '"full" | "limited" | "hidden"',
72+
default: 'full'
73+
}
74+
},
75+
limit: {
76+
$schema: {
77+
title:
78+
'Limit of lines for the description of the page in prev/next cards',
79+
description: 'It will be used if display type is "limited"',
80+
type: 'number',
81+
default: 2
82+
}
83+
}
84+
}
85+
},
5686
github: {
5787
$schema: {
5888
title: 'Configuration for GitHub integration'

0 commit comments

Comments
 (0)