diff --git a/photoalbum/generate.py b/photoalbum/generate.py
index b041239..ddd4975 100644
--- a/photoalbum/generate.py
+++ b/photoalbum/generate.py
@@ -169,7 +169,7 @@ def generate_html(config: Config, root_dir: ImageDirectory) -> None:
)
)
- for image_path in album_dir.images:
+ for pos, image_path in enumerate(album_dir.images):
# TODO: If a file with a matching name but .txt or .md, add that as the
# description for the image
html_path = image_path.html_path()
@@ -178,12 +178,21 @@ def generate_html(config: Config, root_dir: ImageDirectory) -> None:
) / "static"
html_path.parent.mkdir(exist_ok=True)
+ prev_image = None
+ next_image = None
+ if pos != 0:
+ prev_image = album_dir.images[pos-1]
+ if pos < len(album_dir.images) - 1:
+ next_image = album_dir.images[pos+1]
+
logger.debug(f"Rendering {html_path}")
with html_path.open("w") as f:
f.write(
photo_tmpl.render(
static_dir=static_path,
image_path=image_path,
+ prev_image=prev_image,
+ next_image=next_image,
)
)
diff --git a/photoalbum/skel/_templates/album.html b/photoalbum/skel/_templates/album.html
index 9985b0d..819a16c 100644
--- a/photoalbum/skel/_templates/album.html
+++ b/photoalbum/skel/_templates/album.html
@@ -3,21 +3,23 @@
{% block content %}
{% if not album_dir.is_root %}
- up
+
+
+
{% endif %}
{% if album_dir.children %}
Albums
-
+
{% for child in album_dir.children %}
-
+
{% endfor %}
-
+
{% endif %}
{% if album_dir.images %}
diff --git a/photoalbum/skel/_templates/photo.html b/photoalbum/skel/_templates/photo.html
index 12302f8..82aa97c 100644
--- a/photoalbum/skel/_templates/photo.html
+++ b/photoalbum/skel/_templates/photo.html
@@ -2,9 +2,25 @@
{% block content %}
- prev
-
up
- next
+
+ {% if prev_image %}
+
+
+
+ {% endif %}
+
+
+
+ {% if next_image %}
+
+
+
+ {% endif %}
+
diff --git a/photoalbum/skel/static/index.css b/photoalbum/skel/static/index.css
index f9325a8..f5ba8c6 100644
--- a/photoalbum/skel/static/index.css
+++ b/photoalbum/skel/static/index.css
@@ -4,6 +4,18 @@ body {
#content {
width: 1500px;
text-align: center;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+#content > * {
+ width: fit-content;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+ul {
+ padding-left: 1.5em;
}
#album-photos {
@@ -17,3 +29,36 @@ body {
display: flex;
align-items: center;
}
+
+#nav {
+ width: 150px;
+ margin: auto;
+ display: flex;
+ padding: 0.5em;
+}
+
+#nav div {
+ width: 50px;
+}
+
+.arrow {
+ border: solid black;
+ border-width: 0 3px 3px 0;
+ display: inline-block;
+ padding: 3px;
+}
+
+.arrow-right {
+ transform: rotate(-45deg);
+ -webkit-transform: rotate(-45deg);
+}
+
+.arrow-left {
+ transform: rotate(135deg);
+ -webkit-transform: rotate(135deg);
+}
+
+.arrow-up {
+ transform: rotate(-135deg);
+ -webkit-transform: rotate(-135deg);
+}