Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit 60b441f

Browse files
committed
feat: implement feedback
1 parent 4a2f293 commit 60b441f

File tree

3 files changed

+46
-14
lines changed

3 files changed

+46
-14
lines changed
Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,44 @@
11
<template>
2-
<div>
2+
<div v-show="visible === true">
33
<CFlex justify="space-between">
44
<div>
5-
<CLink as="router-link" :to="prevPath">
6-
<CIcon v-show="prevName" name="chevron-left" />
7-
{{ prevName == '' ? "" : prevName }}
5+
<CLink v-if="prevName" as="router-link" class="link" :to="prevPath">
6+
<c-button left-icon="chevron-left" border-color="green.500" variant-color="green" variant="outline">
7+
{{ prevName }}
8+
</c-button>
89
</CLink>
10+
<div v-else />
911
</div>
1012

11-
<CLink as="router-link" :to="nextPath">
12-
{{ nextName == '' ? "" : nextName }}
13-
<CIcon v-show="nextName" name="chevron-right" />
14-
</CLink>
13+
<div>
14+
<CLink v-if="nextName" as="router-link" class="link" :to="nextPath">
15+
<c-button right-icon="chevron-right" border-color="green.500" variant-color="green" variant="outline">
16+
{{ nextName }}
17+
</c-button>
18+
</CLink>
19+
20+
<div v-else />
21+
</div>
1522
</CFlex>
1623
</div>
1724
</template>
1825

1926
<script>
20-
import { CLink, CFlex, CIcon } from '@chakra-ui/vue'
27+
import { CLink, CFlex, CButton } from '@chakra-ui/vue'
2128
import { findNextAndPrevRoute } from '../utils'
2229
2330
export default {
2431
components: {
2532
CLink,
2633
CFlex,
27-
CIcon
34+
CButton
2835
},
2936
data: () => ({
3037
prevPath: '',
3138
prevName: '',
3239
nextPath: '',
33-
nextName: ''
40+
nextName: '',
41+
visible: true
3442
}),
3543
watch: {
3644
'$route.path' (nextPath) {
@@ -45,12 +53,26 @@ export default {
4553
created () {
4654
const { prev, next } = findNextAndPrevRoute(this.$route.path)
4755
56+
if (!prev.path && !next.path) {
57+
this.visible = false
58+
}
4859
this.prevPath = prev.path
4960
this.prevName = prev.name
5061
this.nextPath = next.path
5162
this.nextName = next.name
63+
console.log(this.prevName, this.nextName)
5264
}
5365
}
5466
</script>
5567

56-
<style></style>
68+
<style lang="scss">
69+
.link {
70+
&:focus {
71+
box-shadow: none;
72+
}
73+
74+
&:hover {
75+
text-decoration: none;
76+
}
77+
}
78+
</style>

packages/chakra-ui-docs/utils/all-routes.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77

88
export const components = [
9-
'Index',
109
'Accordion',
1110
'Alert',
1211
'AlertDialog',

packages/chakra-ui-docs/utils/index.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,24 @@ export const removeHyphenFromString = (hyphenatedString) => {
2121
}
2222

2323
export const findNextAndPrevRoute = (path) => {
24+
console.log(path)
2425
const orderedRoutes = [...topNavLinks, ...aboutNavLinks, ...components]
2526

27+
let isValidRoutePath = false
2628
const extractedRoutes = []
2729
orderedRoutes.forEach((singleRoute) => {
28-
extractedRoutes.push({ name: singleRoute, path: stringToUrl(singleRoute) })
30+
const urlString = stringToUrl(singleRoute)
31+
if (urlString === path) {
32+
isValidRoutePath = true
33+
}
34+
extractedRoutes.push({ name: singleRoute, path: urlString })
2935
})
3036

37+
console.log(isValidRoutePath)
38+
if (isValidRoutePath === false) {
39+
return { prev: '', next: '' }
40+
}
41+
3142
const currentRouteIndex = extractedRoutes.map(route => route.path).indexOf(path)
3243

3344
const nextPage = extractedRoutes[currentRouteIndex + 1]

0 commit comments

Comments
 (0)