Skip to content

Commit dd922ab

Browse files
committed
feat: Show edit page link on tutorial pages
1 parent 5c473e4 commit dd922ab

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/components/controllers/page/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export default function Page({ route, prev, next }, ctx) {
158158
// "current" is the currently *displayed* page ID.
159159

160160
const showTitle = current != 'index' && meta.show_title !== false;
161-
const canEdit = showTitle && current != '404' && current !== '/blog';
161+
const canEdit = showTitle && current != '404';
162162
const hasSidebar = meta.toc !== false && isDocPage(url);
163163

164164
return (

src/components/controllers/tutorial/index.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ import { useStore, storeCtx } from '../../store-adapter';
2727
import { InjectPrerenderData } from '../../../lib/prerender-data';
2828
import { getContent } from '../../../lib/content';
2929
import { Splitter } from '../../splitter';
30+
import Hydrator from '../../../lib/hydrator';
31+
import EditThisPage from '../../edit-button';
3032

3133
const IS_PRERENDERING = typeof window === 'undefined';
3234

@@ -284,7 +286,13 @@ function TutorialView({
284286
}
285287
>
286288
<div class={style.tutorialWindow} ref={content}>
287-
<h1 class={style.title}>{title}</h1>
289+
<Hydrator
290+
boot={!loading}
291+
component={EditThisPage}
292+
show={title != 'Error'}
293+
isFallback={page.isFallback}
294+
/>
295+
<h1>{title}</h1>
288296

289297
<ContentRegion
290298
name={page.current}

src/components/controllers/tutorial/style.module.less

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
}
8686

8787
& > h1 {
88-
margin: 0;
88+
margin: 2.5rem 0 0;
8989
padding: 0.25em 0;
9090
font-size: 2.5rem;
9191
font-weight: 200;
@@ -214,7 +214,7 @@
214214
.tutorialWindow {
215215
flex-basis: 100%;
216216

217-
& > * {
217+
& > :not(:first-child) {
218218
max-width: 700px;
219219
margin-left: auto;
220220
margin-right: auto;

0 commit comments

Comments
 (0)