Started working on blogposts
continuous-integration/drone/push Build is failing Details

This commit is contained in:
DutchEllie 2022-03-24 13:25:07 +01:00
parent 6b4c6bb447
commit acbdd113d4
Signed by: DutchEllie
SSH Key Fingerprint: SHA256:dKq6ZSgN5E3Viqrw/+xAdf2VdR6hdRGNyrYqXXwfjTY
11 changed files with 103 additions and 34 deletions

View File

@ -17,7 +17,7 @@ steps:
from_secret: docker_password
repo: dutchellie/proper-website-2
build_args:
- APIURL=https://api.nicecock.eu/api/testingcomment
- APIURL=https://api.nicecock.eu/api/testing
tags:
- dev
- ${DRONE_COMMIT_SHA:0:8}
@ -65,7 +65,7 @@ steps:
from_secret: docker_password
repo: dutchellie/proper-website-2
build_args:
- APIURL=https://api.nicecock.eu/api/comment
- APIURL=https://api.nicecock.eu/api
tags:
- latest
- ${DRONE_COMMIT_SHA:0:8}

0
src/bloglinks.go Normal file
View File

28
src/blogpage.go Normal file
View File

@ -0,0 +1,28 @@
package main
import "github.com/maxence-charriere/go-app/v9/pkg/app"
type BlogPage struct {
app.Compo
}
// TODO: write the backend API for this
// TODO: Find a proper way of rendering blog posts in markdown
// Backend ideas: In the DB, create an entry for each post and a link to where the html file is located!
// That way, I don't have to parse and render markdown!!
// Layout, the leftbar contains the blogpost links and the mainbar contains the post itself!
// Function: After pressing a link for a blog post, that blog post ID gets put in the state instead of the URL
func NewBlogPage() *BlogPage {
return &BlogPage{}
}
func (b *BlogPage) Render() app.UI {
return newPage().
Title("Blog").
LeftBar(
newHTMLBlock().
Class("left leftbarblock"),
)
}

View File

@ -162,7 +162,7 @@ func (g guestbook) Render() app.UI {
func (g *guestbook) LoadComments(ctx app.Context) {
// TODO: maybe you can put this in a localbrowser storage?
url := ApiURL
url := ApiURL + "/comment"
ctx.Async(func() {
res, err := http.Get(url)
if err != nil {

View File

@ -53,7 +53,7 @@ func (p *Homepage) Render() app.UI {
fmt.Printf("err: %v\n", err)
return
}
url := ApiURL
url := ApiURL + "/comment"
ctx.Async(func() {
req, err := http.Post(url, "application/json", bytes.NewBuffer(jsondata))

View File

@ -20,11 +20,9 @@ func (n *navbar) Render() app.UI {
app.Li().Body(
app.A().Href("/galaxies").Text("Galaxies"),
),
app.Li().
Style("display", "none").
Body(
app.A().Href("/undertale").Text("Undertale"),
),
app.Li().Body(
app.A().Href("/blog").Text("Blog"),
),
),
).Class("navbar")
}

View File

@ -11,8 +11,10 @@ type page struct {
Blah blah
etc*/
IleftBar []app.UI
Imain []app.UI
IbackgroundClass string
Ibackground []app.UI
IleftBar []app.UI
Imain []app.UI
// TODO: Possibly add "updateavailable" here, so it shows up on every page
}
@ -21,6 +23,16 @@ func newPage() *page {
return &page{}
}
func (p *page) Background(v ...app.UI) *page {
p.Ibackground = app.FilterUIElems(v...)
return p
}
func (p *page) BackgroundClass(t string) *page {
p.IbackgroundClass = app.AppendClass(p.IbackgroundClass, t)
return p
}
func (p *page) Title(t string) *page {
p.Ititle = t
return p
@ -37,25 +49,35 @@ func (p *page) Main(v ...app.UI) *page {
}
func (p *page) Render() app.UI {
if p.IbackgroundClass == "" {
p.IbackgroundClass = app.AppendClass(p.IbackgroundClass, "background")
}
return app.Div().
Class("main").
Class(p.IbackgroundClass).
Body(
// Header and navbar
&header{},
app.Range(p.Ibackground).Slice(func(i int) app.UI {
return p.Ibackground[i]
}),
app.Div().
Class("left").
Class("main").
Body(
&navbar{},
app.Range(p.IleftBar).Slice(func(i int) app.UI {
return p.IleftBar[i]
}),
),
app.Div().
Class("right").
Body(
app.Range(p.Imain).Slice(func(i int) app.UI {
return p.Imain[i]
}),
// Header and navbar
&header{},
app.Div().
Class("left").
Body(
&navbar{},
app.Range(p.IleftBar).Slice(func(i int) app.UI {
return p.IleftBar[i]
}),
),
app.Div().
Class("right").
Body(
app.Range(p.Imain).Slice(func(i int) app.UI {
return p.Imain[i]
}),
),
),
)
}

View File

@ -15,6 +15,8 @@ func NewUndertalePage() *UndertalePage {
func (u *UndertalePage) Render() app.UI {
return newPage().
Title("Undertale").
BackgroundClass("undertale-bg").
Background().
LeftBar(
newHTMLBlock().
Class("left").

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

@ -1,16 +1,24 @@
html {
background-image: url(images/background_star.gif);
overflow-y: scroll;
margin: 0px;
height: 100%;
}
body {
width: 900px;
position: relative;
margin-left: auto;
margin-right: auto;
color:aliceblue;
font-family: havakana;
font-size: 1.1em;
margin: 0px;
height: 100%;
}
.background {
background-image: url(images/background_star.gif);
width: 100%;
position: absolute;
}
.undertale-bg {
background-image: url(images/ut-bg.webp);
width: 100%;
position: sticky;
}
.header {
@ -35,6 +43,13 @@ body {
.main {
margin-top: 5px;
width: 900px;
position: relative;
margin-left: auto;
margin-right: auto;
color:aliceblue;
font-family: havakana;
font-size: 1.1em;
}
.navbar {
@ -109,6 +124,10 @@ body {
padding: 10px;
}
.no-border {
border: none;
}
.content-text {
max-width: 75%;
width: auto;