Skip to content

Commit

Permalink
Update to Ginevra 0.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nipafx committed Aug 15, 2024
1 parent 2ec29cc commit 705a69b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 34 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<dependency>
<groupId>dev.nipafx.ginevra</groupId>
<artifactId>ginevra</artifactId>
<version>0.6.2</version>
<version>0.7.1</version>
</dependency>

<dependency>
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/zone/nox/data/Post.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package zone.nox.data;

import dev.nipafx.ginevra.html.Element;
import dev.nipafx.ginevra.outline.Document;
import dev.nipafx.ginevra.outline.HtmlContent;

import java.nio.file.Path;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Optional;

import static java.util.function.Predicate.not;
Expand Down
33 changes: 8 additions & 25 deletions src/main/java/zone/nox/templates/FourOhFour.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,32 @@

import dev.nipafx.ginevra.css.Css;
import dev.nipafx.ginevra.css.CssStyle;
import dev.nipafx.ginevra.css.CssStyled;
import dev.nipafx.ginevra.html.Classes;
import dev.nipafx.ginevra.outline.HtmlPage;
import dev.nipafx.ginevra.outline.Query;
import dev.nipafx.ginevra.outline.Query.RootQuery;
import dev.nipafx.ginevra.outline.Template;
import zone.nox.data.Root;
import dev.nipafx.ginevra.outline.HtmlPage.SlugStyle;
import dev.nipafx.ginevra.outline.SingleTemplate;

import java.nio.file.Path;

import static dev.nipafx.ginevra.html.HtmlElement.h1;
import static dev.nipafx.ginevra.html.HtmlElement.p;
import static zone.nox.components.Components.layout;
import static zone.nox.components.Components.pageHeader;

public class FourOhFour implements Template<Root>, CssStyled<FourOhFour.Style> {
public class FourOhFour implements SingleTemplate {

public record Style(Css css) implements CssStyle { }

private static final Style STYLE = Css.parse(Style.class, """
""");

@Override
public Style style() {
return STYLE;
}

@Override
public Query<Root> query() {
return new RootQuery<>(Root.class);
}
public record Style(Classes red, Css css) implements CssStyle { }

@Override
public HtmlPage compose(Root root) {
public HtmlPage composeSingle() {
return new HtmlPage(
Path.of("404"),
SlugStyle.FILE,
layout
.title("404")
.description("Page not found")
.content(
pageHeader
.title("404 - Page not Found")
.summary("Sorry, this page doesn't exist. (Is what they want you to believe.)"))
.summary("Sorry, this page doesn't exist... is what they want you to believe"))
);
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/zone/nox/templates/LandingTemplate.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import dev.nipafx.ginevra.outline.HtmlPage;
import dev.nipafx.ginevra.outline.Query;
import dev.nipafx.ginevra.outline.Query.RootQuery;
import dev.nipafx.ginevra.outline.Template;
import dev.nipafx.ginevra.outline.QuerySingleTemplate;
import zone.nox.data.Post;
import zone.nox.data.Root;

Expand All @@ -19,7 +19,7 @@
import static zone.nox.components.Components.layout;
import static zone.nox.components.Components.postBlock;

public class LandingTemplate implements Template<Root>, CssStyled<LandingTemplate.Style> {
public class LandingTemplate implements QuerySingleTemplate<Root>, CssStyled<LandingTemplate.Style> {

public record Style(Classes posts, Classes post, Css css) implements CssStyle { }
private static final Style STYLE = Css.parse(Style.class, """
Expand All @@ -42,7 +42,7 @@ public Query<Root> query() {
}

@Override
public HtmlPage compose(Root root) {
public HtmlPage composeSingle(Root root) {
return new HtmlPage(Path.of(""), composePage(root));
}

Expand Down
7 changes: 4 additions & 3 deletions src/main/java/zone/nox/templates/PostTemplate.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@
import dev.nipafx.ginevra.outline.HtmlPage;
import dev.nipafx.ginevra.outline.Query;
import dev.nipafx.ginevra.outline.Query.CollectionQuery;
import dev.nipafx.ginevra.outline.Template;
import dev.nipafx.ginevra.outline.QuerySingleTemplate;
import zone.nox.Target;
import zone.nox.data.Post;

import static dev.nipafx.ginevra.html.HtmlElement.a;
import static zone.nox.components.Components.layout;
import static zone.nox.components.Components.postContent;

public record PostTemplate(Target target) implements Template<Post>, CssStyled<PostTemplate.Style> {
public record PostTemplate(Target target) implements QuerySingleTemplate<Post>, CssStyled<PostTemplate.Style> {

public record Style(Classes back, Css css) implements CssStyle { }

private static final Style STYLE = Css.parse(Style.class, """
.back {
margin-top: var(--gap);
Expand All @@ -36,7 +37,7 @@ public Query<Post> query() {
}

@Override
public HtmlPage compose(Post post) {
public HtmlPage composeSingle(Post post) {
return new HtmlPage(post.slug(), composePage(post));
}

Expand Down

0 comments on commit 705a69b

Please sign in to comment.