From 60c496ccf81b583ceaaef3fdc092b41c8034bcb2 Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Wed, 12 Feb 2020 20:50:58 -0500 Subject: [PATCH] publish: sidebar switch + popout to note.js --- .../src/js/components/lib/note-navigation.js | 10 ++-- .../publish/src/js/components/lib/note.js | 58 +++++++++++++++---- .../publish/src/js/components/root.js | 1 + 3 files changed, 54 insertions(+), 15 deletions(-) diff --git a/pkg/interface/publish/src/js/components/lib/note-navigation.js b/pkg/interface/publish/src/js/components/lib/note-navigation.js index f6dfc12e9e..ab3d2bb726 100644 --- a/pkg/interface/publish/src/js/components/lib/note-navigation.js +++ b/pkg/interface/publish/src/js/components/lib/note-navigation.js @@ -14,9 +14,11 @@ export class NoteNavigation extends Component { let nextUrl = '' let prevUrl = '' + let popout = (this.props.popout) ? "popout/" : ""; + if (this.props.next && this.props.prev) { - nextUrl = `/~publish/note/${this.props.ship}/${this.props.book}/${this.props.next.id}`; - prevUrl = `/~publish/note/${this.props.ship}/${this.props.book}/${this.props.prev.id}`; + nextUrl = `/~publish/${popout}note/${this.props.ship}/${this.props.book}/${this.props.next.id}`; + prevUrl = `/~publish/${popout}note/${this.props.ship}/${this.props.book}/${this.props.prev.id}`; nextComponent =
Next
@@ -32,7 +34,7 @@ export class NoteNavigation extends Component { } else if (this.props.prev) { - prevUrl = `/~publish/note/${this.props.ship}/${this.props.book}/${this.props.prev.id}`; + prevUrl = `/~publish/${popout}note/${this.props.ship}/${this.props.book}/${this.props.prev.id}`; prevComponent =
Previous
@@ -40,7 +42,7 @@ export class NoteNavigation extends Component {
{this.props.prev.date}
} else if (this.props.next) { - nextUrl = `/~publish/note/${this.props.ship}/${this.props.book}/${this.props.next.id}`; + nextUrl = `/~publish/${popout}note/${this.props.ship}/${this.props.book}/${this.props.next.id}`; nextComponent =
Next
diff --git a/pkg/interface/publish/src/js/components/lib/note.js b/pkg/interface/publish/src/js/components/lib/note.js index 35743df73c..5aff570496 100644 --- a/pkg/interface/publish/src/js/components/lib/note.js +++ b/pkg/interface/publish/src/js/components/lib/note.js @@ -1,4 +1,6 @@ import React, { Component } from 'react'; +import { Route, Link } from 'react-router-dom'; +import { SidebarSwitcher } from './icons/icon-sidebar-switch'; import { Comments } from './comments'; import { NoteNavigation } from './note-navigation'; import moment from 'moment'; @@ -129,18 +131,49 @@ export class Note extends Component { date: moment(notebook.notes[nextId]["date-created"]).fromNow() } + let popout = (props.popout) ? "popout/" : ""; + let hrefIndex = props.location.pathname.indexOf("/note/"); + let publishsubStr = props.location.pathname.substr(hrefIndex); + let popoutHref = `/~publish/popout${publishsubStr}`; + + let hiddenOnPopout = props.popout ? "" : "dib-m dib-l dib-xl"; + + let baseUrl = `/~publish/${popout}notebook/${props.ship}/${props.book}`; return ( -
{this.scrollElement = el}}> -
-
+
{ + this.scrollElement = el; + }}> +
+
+ + + {"<- Notebook index"} + + + + +
+
{title}
-
+
{name}
{date}
@@ -150,20 +183,23 @@ export class Note extends Component {
- + + />
- ) + ); } } diff --git a/pkg/interface/publish/src/js/components/root.js b/pkg/interface/publish/src/js/components/root.js index b475805697..3edbe1971c 100644 --- a/pkg/interface/publish/src/js/components/root.js +++ b/pkg/interface/publish/src/js/components/root.js @@ -181,6 +181,7 @@ export class Root extends Component { note={note} sidebarShown={state.sidebarShown} popout={popout} + {...props} /> );