Skip to content

Commit a19a021

Browse files
committed
Add home button and tweak layout
1 parent 26b12cd commit a19a021

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ WIP
44
* Add support for `h1_title` setting.
55
* Add breadcrumbs navigation
66
* Embed CSS in Smeagol, so no internet connection is required to run [#9](https://github.com/AustinWise/smeagol/issues/9)
7+
* Add "home" button to go to the top of the site.
78

89
0.1.0 (2022-01-04)
910
=====

frontend/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Currently the only purpose of this folder it is enable downloading the
2+
[Primer CSS](https://primer.style/css/)
3+
file so that it can be commited to this repo.

src/requests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ async fn process_file_request(
129129

130130
fn process_smeagol_request(file_path: &str) -> Result<Response<Body>, MyError> {
131131
if file_path == "/_smeagol/primer.css" {
132-
let css_bytes: &[u8] = include_bytes!("primer.css");
132+
let primer_css = include_str!("primer.css");
133133
return Ok(Response::builder()
134134
.status(StatusCode::OK)
135135
.header(header::CONTENT_TYPE, "text/css; charset=UTF-8")
136-
.body(Body::from(css_bytes))?);
136+
.body(Body::from(primer_css))?);
137137
}
138138
return Ok(Response::builder()
139139
.status(StatusCode::NOT_FOUND)

templates/layout.html

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,27 @@
33

44
<head>
55
<title>{{title}}</title>
6-
<!-- TODO: embed css file into the program -->
76
<link href="/_smeagol/primer.css" rel="stylesheet" />
7+
<style>
8+
.markdown-body {
9+
padding: 1em 1em 1em 0;
10+
}
11+
</style>
812
</head>
913

1014
<body class="container-lg">
1115
<header>
1216

1317
</header>
1418
<main>
15-
<h1>{{title}}</h1>
19+
<div class="TableObject pt-4 px-2 px-lg-0 overflow-x-scroll">
20+
<div class="TableObject-item">
21+
<a class="btn btn-sm" id="minibutton-home" href="/">
22+
Home
23+
</a>
24+
</div>
25+
</div>
26+
<h1 class="pt-4">{{title}}</h1>
1627
<nav aria-label="Breadcrumb">
1728
<ol>
1829
{% for crumb in breadcrumbs %}
@@ -22,9 +33,9 @@ <h1>{{title}}</h1>
2233
{% endfor %}
2334
</ol>
2435
</nav>
25-
<dic class="markdown-body">
36+
<div class="markdown-body">
2637
{{content}}
27-
</dic>
38+
</div>
2839
</main>
2940

3041
</body>

0 commit comments

Comments
 (0)