Browse Source

Add sidebar

Getty Ritter 1 year ago
parent
commit
443aa3d866
3 changed files with 20 additions and 5 deletions
  1. 0 1
      by/model.py
  2. 19 4
      js/index.jsx
  3. 1 0
      static/index.html

+ 0 - 1
by/model.py

@@ -63,7 +63,6 @@ class Page(Model):
                      .where(Page.slug == slug)
                      .order_by(-Revision.modified)
                      .limit(1))
-        print(len(query))
         if len(query) != 1:
             raise e.PageNotFound()
         q = query[0]

+ 19 - 4
js/index.jsx

@@ -35,7 +35,7 @@ class Page extends React.Component {
                 },
                 (error) => {
                     this.setState({
-                        page: "failed",
+                        rendered: "not found",
                     });
                 }
             );
@@ -43,11 +43,26 @@ class Page extends React.Component {
 
     render() {
         if (this.state.loaded) {
-            return <div dangerouslySetInnerHTML={{__html: this.state.rendered}} />
+            return <div className="page" dangerouslySetInnerHTML={{__html: this.state.rendered}} />;
         } else {
-            return <div>Loading...</div>
+            return <div className="page">Loading...</div>;
         }
     }
 }
 
-ReactDOM.render(<Page/>, document.getElementById('root'))
+const Sidebar = () => {
+    return (
+        <div className="sidebar"><img src="/static/baba-yaga-sidebar-plain.svg"/></div>
+    );
+};
+
+const Board = () => {
+    return (
+        <div className="board">
+          <Sidebar/>
+          <Page/>
+        </div>
+    );
+};
+
+ReactDOM.render(<Board/>, document.getElementById('root'));

+ 1 - 0
static/index.html

@@ -2,6 +2,7 @@
 <html>
   <head>
     <title>Baba Yaga</title>
+    <link rel="stylesheet" type="text/css" href="/static/by.css"/>
   </head>
   <body>
     <div id="root"></div>