Skip to content

Commit 28b47cb

Browse files
committed
refactor: simplify page footer into single help callout
- remove Yes/No voting widget from page footer - consolidate "Edit this page" and "Help us improve" into single HelpCallout component - delete redundant LegacyCallout.vue - keep Feedback.vue for ContentStatus WIP pages
1 parent 04dd310 commit 28b47cb

File tree

3 files changed

+155
-112
lines changed

3 files changed

+155
-112
lines changed
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
<template>
2+
<div class="help-callout">
3+
<p>
4+
<b>Help us improve this site!</b>
5+
</p>
6+
<section>
7+
<div class="block" v-if="editLink">
8+
<ul>
9+
<li>
10+
<a :href="editLink" target="_blank" rel="noopener noreferrer">
11+
Edit this page
12+
</a>
13+
<span v-if="openIssueLink">
14+
or
15+
<a :href="openIssueLink" target="_blank" rel="noopener noreferrer">
16+
open an issue
17+
</a>
18+
</span>
19+
</li>
20+
</ul>
21+
</div>
22+
<div class="block">
23+
<ul>
24+
<li>
25+
<a
26+
href="https://github.com/ipfs/ipfs-docs/issues/new?assignees=&labels=OKR+3%3A+Content+Improvement%2C+docs-ipfs&template=content-request.md&title=%5BCONTENT+REQUEST%5D+%28add+your+title+here%21%29"
27+
target="_blank"
28+
rel="noopener noreferrer"
29+
>
30+
Suggest new content
31+
</a>
32+
</li>
33+
</ul>
34+
</div>
35+
<div class="block">
36+
<ul>
37+
<li>
38+
<a
39+
href="https://github.com/ipfs/ipfs-docs/issues/new?assignees=&labels=OKR+3%3A+Content+Improvement%2C+docs-ipfs&template=documentation-issue.md&title=%5BDOCS+ISSUE%5D+%28add+your+title+here%21%29"
40+
target="_blank"
41+
rel="noopener noreferrer"
42+
>
43+
Give general feedback
44+
</a>
45+
</li>
46+
</ul>
47+
</div>
48+
</section>
49+
</div>
50+
</template>
51+
52+
<script>
53+
const endingSlashRE = /\/$/
54+
const outboundRE = /^[a-z]+:/i
55+
56+
export default {
57+
name: 'HelpCallout',
58+
computed: {
59+
openIssueLink() {
60+
const feedbackWidget = this.$site.themeConfig.feedbackWidget
61+
if (!feedbackWidget || !feedbackWidget.docsRepoIssue) {
62+
return null
63+
}
64+
return `https://github.com/${feedbackWidget.docsRepoIssue}/issues/new?assignees=&labels=need%2Ftriage&template=open_an_issue.md&title=${encodeURIComponent(this.$page.title)}`
65+
},
66+
67+
editLink() {
68+
const {
69+
repo,
70+
docsDir = '',
71+
docsBranch = 'master',
72+
docsRepo = repo
73+
} = this.$site.themeConfig
74+
75+
if (docsRepo && this.$page.relativePath) {
76+
return this.createEditLink(
77+
repo,
78+
docsRepo,
79+
docsDir,
80+
docsBranch,
81+
this.$page.relativePath
82+
)
83+
}
84+
return null
85+
}
86+
},
87+
88+
methods: {
89+
createEditLink(repo, docsRepo, docsDir, docsBranch, path) {
90+
const bitbucket = /bitbucket.org/
91+
if (bitbucket.test(repo)) {
92+
const base = outboundRE.test(docsRepo) ? docsRepo : repo
93+
return (
94+
base.replace(endingSlashRE, '') +
95+
`/src` +
96+
`/${docsBranch}/` +
97+
(docsDir ? docsDir.replace(endingSlashRE, '') + '/' : '') +
98+
path +
99+
`?mode=edit&spa=0&at=${docsBranch}&fileviewer=file-view-default`
100+
)
101+
}
102+
103+
const base = outboundRE.test(docsRepo)
104+
? docsRepo
105+
: `https://github.com/${docsRepo}`
106+
return (
107+
base.replace(endingSlashRE, '') +
108+
`/edit` +
109+
`/${docsBranch}/` +
110+
(docsDir ? docsDir.replace(endingSlashRE, '') + '/' : '') +
111+
path
112+
)
113+
}
114+
}
115+
}
116+
</script>
117+
118+
<style lang="stylus" scoped>
119+
.help-callout {
120+
background-color: lighten($badgeTipColor, 95%);
121+
color: lighten($textColor, 20%);
122+
border-color: $badgeTipColor;
123+
padding: 1rem 2rem;
124+
margin-top: 3rem;
125+
}
126+
127+
section {
128+
margin: 1rem 0;
129+
130+
ul {
131+
margin: 0;
132+
padding: 0;
133+
list-style: none;
134+
135+
li {
136+
margin: 0;
137+
line-height: 2em;
138+
padding: 0;
139+
}
140+
}
141+
}
142+
143+
@media (min-width: $MQNarrow) {
144+
section {
145+
display: flex;
146+
147+
.block {
148+
flex: 1;
149+
}
150+
}
151+
}
152+
</style>

docs/.vuepress/theme/components/LegacyCallout.vue

Lines changed: 0 additions & 73 deletions
This file was deleted.

docs/.vuepress/theme/components/Page.vue

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,7 @@
55
<Content class="theme-default-content" />
66

77
<div class="content-footer" v-if="!isContentStatus">
8-
<Feedback
9-
class="content-feedback"
10-
evtYes="information_helpful"
11-
evtNo="information_not_helpful"
12-
/>
13-
<LegacyCallout />
14-
<PageEdit />
8+
<HelpCallout />
159
<PageNav v-bind="{ sidebarItems }" />
1610
</div>
1711

@@ -22,20 +16,16 @@
2216
</template>
2317

2418
<script>
25-
import PageEdit from '@parent-theme/components/PageEdit.vue'
2619
import PageNav from '@parent-theme/components/PageNav.vue'
2720
28-
import Feedback from './Feedback.vue'
29-
import LegacyCallout from './LegacyCallout.vue'
21+
import HelpCallout from './HelpCallout.vue'
3022
import Analytics from './Analytics.vue'
3123
3224
export default {
3325
name: 'Page',
3426
components: {
35-
PageEdit,
3627
PageNav,
37-
Feedback,
38-
LegacyCallout,
28+
HelpCallout,
3929
Analytics
4030
},
4131
props: ['sidebarItems'],
@@ -107,36 +97,10 @@ export default {
10797
max-width: $contentWidth;
10898
}
10999
110-
.page-edit {
111-
max-width: 100%;
112-
padding: 2rem 2rem;
113-
}
114-
115-
.content-feedback {
116-
padding: 0 2rem;
117-
}
118-
119100
@media (min-width: $MQMobile) {
120101
.content-footer {
121102
padding: 0 2.5rem;
122103
padding-top: 0;
123104
}
124-
125-
.content-feedback {
126-
padding: 0;
127-
margin: 0;
128-
}
129-
130-
.page-edit {
131-
padding: 2.5rem 0;
132-
}
133-
134-
section {
135-
display: flex;
136-
137-
.block {
138-
flex: 1;
139-
}
140-
}
141105
}
142106
</style>

0 commit comments

Comments
 (0)