This is an automated email from the ASF dual-hosted git repository.

garyw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mnemonic-site.git

commit 42581db8f69d0fd6b00d9122483c09b71183b3bb
Author: Yanhui Zhao <[email protected]>
AuthorDate: Mon Mar 14 21:49:33 2022 -0700

    MNEMONIC-735: Re-structure fastapi app content for integration with Jinja 
template and css files
---
 .gitignore                              |   1 +
 fastapi/server.py                       |  32 ------
 mnemonic-fastapi/app/main.py            |  33 ++++++
 mnemonic-fastapi/static/css/mystyle.css |  25 +++++
 mnemonic-fastapi/static/css/style3.css  | 191 ++++++++++++++++++++++++++++++++
 mnemonic-fastapi/templates/page.html    |   5 +
 6 files changed, 255 insertions(+), 32 deletions(-)

diff --git a/.gitignore b/.gitignore
index 7135eac..ae3a113 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,4 @@ public/
 node_modules/
 site/
 /src/.jekyll-metadata
+.DS_Store
diff --git a/fastapi/server.py b/fastapi/server.py
deleted file mode 100644
index 3b6c89f..0000000
--- a/fastapi/server.py
+++ /dev/null
@@ -1,32 +0,0 @@
-from typing import Optional
-from fastapi import FASTAPI
-
-app = FastAPI()
-
[email protected]("/")
-def mnemonic_home():
-    return {"Apache Mnemonic Home"}
-
[email protected]("/docs")
-def mnemonic_docs():
-    return {"Mnemonic documentation home page"}
-
[email protected]("/downloads")
-def mnemonic_downloads():
-    return {"Mnemonic downloads home page"}
-
[email protected]("/talks")
-def mnemonic_talks():
-    return {"Mnemonic talks home page"}
-
[email protected]("/news")
-def mnemonic_news():
-    return {"Mnemonic news home page"}
-
[email protected]("/develop")
-def mnemonic_develop():
-    return {"Mnemonic development home page"}
-
[email protected]("/help")
-def mnemonic_help():
-    return {"Mnemonic help home page"}
diff --git a/mnemonic-fastapi/app/main.py b/mnemonic-fastapi/app/main.py
new file mode 100644
index 0000000..442a92e
--- /dev/null
+++ b/mnemonic-fastapi/app/main.py
@@ -0,0 +1,33 @@
+from urllib import response
+from fastapi import FastAPI, Request
+from fastapi.responses import HTMLResponse
+from fastapi.staticfiles import StaticFiles
+from fastapi.templating import Jinja2Templates
+
+from .library.helpers import *
+
+app = FastAPI()
+
+templates = Jinja2Templates(directory="templates")
+app.mount("/static", StaticFiles(directory="static"), name="static")
+
[email protected]("/", response_class=HTMLResponse)
+async def home(request: Request):
+    data = {
+        "page": "Home page"
+    }
+    return templates.TemplateResponse("page.html", {"request": request, 
"data": data})
+
[email protected]("/page/{page_name}", response_class=HTMLResponse)
+async def page(request: Request, page_name: str):
+    data = {
+        "page": page_name
+    }
+    return templates.TemplateResponse("page.html", {"request": request, 
"data": data})
+
[email protected]("/docs", response_class=HTMLResponse)
+async def mnemonic_docs(request: Request):
+    data = {
+        "page": "docs"
+    }
+    return templates.TemplateResponse("page.html", {"request": request, 
"data": data})
\ No newline at end of file
diff --git a/mnemonic-fastapi/static/css/mystyle.css 
b/mnemonic-fastapi/static/css/mystyle.css
new file mode 100644
index 0000000..adbd218
--- /dev/null
+++ b/mnemonic-fastapi/static/css/mystyle.css
@@ -0,0 +1,25 @@
+body {
+    min-height: 100vh;
+    position: relative;
+    margin: 0;
+    padding-bottom: 100px; 
+    box-sizing: border-box;
+}
+
+.wrapper{
+    max-width: 960px;
+}
+
+footer {
+    position: absolute;
+    bottom: 0;
+    height: 100px;
+    padding-top:50px;
+}
+
+.responsive{
+    max-width: 100%;
+    height: auto;
+    margin-left: auto;
+    margin-right: auto;
+}
\ No newline at end of file
diff --git a/mnemonic-fastapi/static/css/style3.css 
b/mnemonic-fastapi/static/css/style3.css
new file mode 100644
index 0000000..aeb15c8
--- /dev/null
+++ b/mnemonic-fastapi/static/css/style3.css
@@ -0,0 +1,191 @@
+/*
+    DEMO STYLE
+*/
+
+@import "https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700";;
+body {
+    font-family: 'Poppins', sans-serif;
+    background: #fafafa;
+}
+
+p {
+    font-family: 'Poppins', sans-serif;
+    font-size: 1.1em;
+    font-weight: 300;
+    line-height: 1.7em;
+    color: #999;
+}
+
+a,
+a:hover,
+a:focus {
+    color: inherit;
+    text-decoration: none;
+    transition: all 0.3s;
+}
+
+.navbar {
+    padding: 15px 10px;
+    background: #fff;
+    border: none;
+    border-radius: 0;
+    margin-bottom: 40px;
+    box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
+}
+
+.navbar-btn {
+    box-shadow: none;
+    outline: none !important;
+    border: none;
+}
+
+.line {
+    width: 100%;
+    height: 1px;
+    border-bottom: 1px dashed #ddd;
+    margin: 40px 0;
+}
+
+/* ---------------------------------------------------
+    SIDEBAR STYLE
+----------------------------------------------------- */
+
+#sidebar {
+    width: 250px;
+    position: fixed;
+    top: 0;
+    left: -250px;
+    height: 100vh;
+    z-index: 999;
+    background: #7386D5;
+    color: #fff;
+    transition: all 0.3s;
+    overflow-y: scroll;
+    box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.2);
+}
+
+#sidebar.active {
+    left: 0;
+}
+
+#dismiss {
+    width: 35px;
+    height: 35px;
+    line-height: 35px;
+    text-align: center;
+    background: #7386D5;
+    position: absolute;
+    top: 10px;
+    right: 10px;
+    cursor: pointer;
+    -webkit-transition: all 0.3s;
+    -o-transition: all 0.3s;
+    transition: all 0.3s;
+}
+
+#dismiss:hover {
+    background: #fff;
+    color: #7386D5;
+}
+
+.overlay {
+    display: none;
+    position: fixed;
+    width: 100vw;
+    height: 100vh;
+    background: rgba(0, 0, 0, 0.7);
+    z-index: 998;
+    opacity: 0;
+    transition: all 0.5s ease-in-out;
+}
+.overlay.active {
+    display: block;
+    opacity: 1;
+}
+
+#sidebar .sidebar-header {
+    padding: 20px;
+    background: #6d7fcc;
+}
+
+#sidebar ul.components {
+    padding: 20px 0;
+    border-bottom: 1px solid #47748b;
+}
+
+#sidebar ul p {
+    color: #fff;
+    padding: 10px;
+}
+
+#sidebar ul li a {
+    padding: 10px;
+    font-size: 1.1em;
+    display: block;
+}
+
+#sidebar ul li a:hover {
+    color: #7386D5;
+    background: #fff;
+}
+
+#sidebar ul li.active>a,
+a[aria-expanded="true"] {
+    color: #fff;
+    background: #6d7fcc;
+}
+
+a[data-toggle="collapse"] {
+    position: relative;
+}
+
+.dropdown-toggle::after {
+    display: block;
+    position: absolute;
+    top: 50%;
+    right: 20px;
+    transform: translateY(-50%);
+}
+
+ul ul a {
+    font-size: 0.9em !important;
+    padding-left: 30px !important;
+    background: #6d7fcc;
+}
+
+ul.CTAs {
+    padding: 20px;
+}
+
+ul.CTAs a {
+    text-align: center;
+    font-size: 0.9em !important;
+    display: block;
+    border-radius: 5px;
+    margin-bottom: 5px;
+}
+
+a.download {
+    background: #fff;
+    color: #7386D5;
+}
+
+a.article,
+a.article:hover {
+    background: #6d7fcc !important;
+    color: #fff !important;
+}
+
+/* ---------------------------------------------------
+    CONTENT STYLE
+----------------------------------------------------- */
+
+#content {
+    width: 100%;
+    padding: 20px;
+    min-height: 100vh;
+    transition: all 0.3s;
+    position: absolute;
+    top: 0;
+    right: 0;
+}
\ No newline at end of file
diff --git a/mnemonic-fastapi/templates/page.html 
b/mnemonic-fastapi/templates/page.html
new file mode 100644
index 0000000..12654c2
--- /dev/null
+++ b/mnemonic-fastapi/templates/page.html
@@ -0,0 +1,5 @@
+<h1>
+    Welcome to Apache Mnemonic!
+</h1>
+
+{{data.page}}
\ No newline at end of file

Reply via email to