Skip to content

Commit

Permalink
feat: Show edit page link on tutorial pages
Browse files Browse the repository at this point in the history
  • Loading branch information
rschristian committed Apr 14, 2023
1 parent 5c473e4 commit dd922ab
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/controllers/page/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export default function Page({ route, prev, next }, ctx) {
// "current" is the currently *displayed* page ID.

const showTitle = current != 'index' && meta.show_title !== false;
const canEdit = showTitle && current != '404' && current !== '/blog';
const canEdit = showTitle && current != '404';
const hasSidebar = meta.toc !== false && isDocPage(url);

return (
Expand Down
10 changes: 9 additions & 1 deletion src/components/controllers/tutorial/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import { useStore, storeCtx } from '../../store-adapter';
import { InjectPrerenderData } from '../../../lib/prerender-data';
import { getContent } from '../../../lib/content';
import { Splitter } from '../../splitter';
import Hydrator from '../../../lib/hydrator';
import EditThisPage from '../../edit-button';

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

Expand Down Expand Up @@ -284,7 +286,13 @@ function TutorialView({
}
>
<div class={style.tutorialWindow} ref={content}>
<h1 class={style.title}>{title}</h1>
<Hydrator
boot={!loading}
component={EditThisPage}
show={title != 'Error'}
isFallback={page.isFallback}
/>
<h1>{title}</h1>

<ContentRegion
name={page.current}
Expand Down
4 changes: 2 additions & 2 deletions src/components/controllers/tutorial/style.module.less
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
}

& > h1 {
margin: 0;
margin: 2.5rem 0 0;
padding: 0.25em 0;
font-size: 2.5rem;
font-weight: 200;
Expand Down Expand Up @@ -214,7 +214,7 @@
.tutorialWindow {
flex-basis: 100%;

& > * {
& > :not(:first-child) {
max-width: 700px;
margin-left: auto;
margin-right: auto;
Expand Down

0 comments on commit dd922ab

Please sign in to comment.