Skip to content

Commit

Permalink
Refactor CSS
Browse files Browse the repository at this point in the history
Co-authored-by: Sam Clark <[email protected]>
  • Loading branch information
samhclark and samhclark authored Nov 11, 2022
1 parent c6b4cd8 commit 67a62af
Show file tree
Hide file tree
Showing 10 changed files with 282 additions and 183 deletions.
66 changes: 66 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ tantivy = "0.18.1"
serde = "1.0.147"
serde_json = "1.0"
tokio = { version = "1", features = ["full"] }
axum = "0.5.17"
tower-http = { version = "0.3.4", features = ["fs", "set-header"] }
axum = { version = "0.5.17", features = ["http2"] }
askama = "0.11.1"
tracing = "0.1"
tracing-subscriber = {version = "0.3", features = ["std"] }
tracing-subscriber = { version = "0.3", features = ["std"] }

[profile.dev]
debug = 0
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ RUN cargo install --path .
FROM docker.io/library/debian:buster-slim
RUN apt-get update --quiet --assume-yes \
&& apt-get upgrade --quiet --assume-yes \
&& apt-get install dumb-init --quiet --assume-yes
&& apt-get install dumb-init --quiet --assume-yes \
&& mkdir /assets

COPY --from=builder /usr/local/cargo/bin/cosmere-epub-parser /usr/local/bin/cosmere-epub-parser
COPY ./assets/* /assets/
COPY ./*.epub /
EXPOSE 8080
ENTRYPOINT ["/usr/bin/dumb-init", "--", "/usr/local/bin/cosmere-epub-parser"]
16 changes: 16 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# just manual: https://github.com/casey/just/#readme

_default:
@just --list

# Formats the source files
format:
cargo fmt

# Runs clippy on the sources
check:
cargo clippy --locked -- -D warnings -D clippy::pedantic -D clippy::nursery

# Runs unit tests
test:
cargo test --locked
4 changes: 4 additions & 0 deletions assets/background.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
102 changes: 36 additions & 66 deletions assets/index.html
Original file line number Diff line number Diff line change
@@ -1,68 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=3.0, user-scalable=1;">
<meta name="referrer" content="origin">
<title>CSearch</title>
<style type="text/css">
html {
background-color: #dbdde5;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='192' height='192' viewBox='0 0 192 192'%3E%3Cpath fill='%239295ac' fill-opacity='0.4' d='M192 15v2a11 11 0 0 0-11 11c0 1.94 1.16 4.75 2.53 6.11l2.36 2.36a6.93 6.93 0 0 1 1.22 7.56l-.43.84a8.08 8.08 0 0 1-6.66 4.13H145v35.02a6.1 6.1 0 0 0 3.03 4.87l.84.43c1.58.79 4 .4 5.24-.85l2.36-2.36a12.04 12.04 0 0 1 7.51-3.11 13 13 0 1 1 .02 26 12 12 0 0 1-7.53-3.11l-2.36-2.36a4.93 4.93 0 0 0-5.24-.85l-.84.43a6.1 6.1 0 0 0-3.03 4.87V143h35.02a8.08 8.08 0 0 1 6.66 4.13l.43.84a6.91 6.91 0 0 1-1.22 7.56l-2.36 2.36A10.06 10.06 0 0 0 181 164a11 11 0 0 0 11 11v2a13 13 0 0 1-13-13 12 12 0 0 1 3.11-7.53l2.36-2.36a4.93 4.93 0 0 0 .85-5.24l-.43-.84a6.1 6.1 0 0 0-4.87-3.03H145v35.02a8.08 8.08 0 0 1-4.13 6.66l-.84.43a6.91 6.91 0 0 1-7.56-1.22l-2.36-2.36A10.06 10.06 0 0 0 124 181a11 11 0 0 0-11 11h-2a13 13 0 0 1 13-13c2.47 0 5.79 1.37 7.53 3.11l2.36 2.36a4.94 4.94 0 0 0 5.24.85l.84-.43a6.1 6.1 0 0 0 3.03-4.87V145h-35.02a8.08 8.08 0 0 1-6.66-4.13l-.43-.84a6.91 6.91 0 0 1 1.22-7.56l2.36-2.36A10.06 10.06 0 0 0 107 124a11 11 0 0 0-22 0c0 1.94 1.16 4.75 2.53 6.11l2.36 2.36a6.93 6.93 0 0 1 1.22 7.56l-.43.84a8.08 8.08 0 0 1-6.66 4.13H49v35.02a6.1 6.1 0 0 0 3.03 4.87l.84.43c1.58.79 4 .4 5.24-.85l2.36-2.36a12.04 12.04 0 0 1 7.51-3.11A13 13 0 0 1 81 192h-2a11 11 0 0 0-11-11c-1.94 0-4.75 1.16-6.11 2.53l-2.36 2.36a6.93 6.93 0 0 1-7.56 1.22l-.84-.43a8.08 8.08 0 0 1-4.13-6.66V145H11.98a6.1 6.1 0 0 0-4.87 3.03l-.43.84c-.79 1.58-.4 4 .85 5.24l2.36 2.36a12.04 12.04 0 0 1 3.11 7.51A13 13 0 0 1 0 177v-2a11 11 0 0 0 11-11c0-1.94-1.16-4.75-2.53-6.11l-2.36-2.36a6.93 6.93 0 0 1-1.22-7.56l.43-.84a8.08 8.08 0 0 1 6.66-4.13H47v-35.02a6.1 6.1 0 0 0-3.03-4.87l-.84-.43c-1.59-.8-4-.4-5.24.85l-2.36 2.36A12 12 0 0 1 28 109a13 13 0 1 1 0-26c2.47 0 5.79 1.37 7.53 3.11l2.36 2.36a4.94 4.94 0 0 0 5.24.85l.84-.43A6.1 6.1 0 0 0 47 84.02V49H11.98a8.08 8.08 0 0 1-6.66-4.13l-.43-.84a6.91 6.91 0 0 1 1.22-7.56l2.36-2.36A10.06 10.06 0 0 0 11 28 11 11 0 0 0 0 17v-2a13 13 0 0 1 13 13c0 2.47-1.37 5.79-3.11 7.53l-2.36 2.36a4.94 4.94 0 0 0-.85 5.24l.43.84A6.1 6.1 0 0 0 11.98 47H47V11.98a8.08 8.08 0 0 1 4.13-6.66l.84-.43a6.91 6.91 0 0 1 7.56 1.22l2.36 2.36A10.06 10.06 0 0 0 68 11 11 11 0 0 0 79 0h2a13 13 0 0 1-13 13 12 12 0 0 1-7.53-3.11l-2.36-2.36a4.93 4.93 0 0 0-5.24-.85l-.84.43A6.1 6.1 0 0 0 49 11.98V47h35.02a8.08 8.08 0 0 1 6.66 4.13l.43.84a6.91 6.91 0 0 1-1.22 7.56l-2.36 2.36A10.06 10.06 0 0 0 85 68a11 11 0 0 0 22 0c0-1.94-1.16-4.75-2.53-6.11l-2.36-2.36a6.93 6.93 0 0 1-1.22-7.56l.43-.84a8.08 8.08 0 0 1 6.66-4.13H143V11.98a6.1 6.1 0 0 0-3.03-4.87l-.84-.43c-1.59-.8-4-.4-5.24.85l-2.36 2.36A12 12 0 0 1 124 13a13 13 0 0 1-13-13h2a11 11 0 0 0 11 11c1.94 0 4.75-1.16 6.11-2.53l2.36-2.36a6.93 6.93 0 0 1 7.56-1.22l.84.43a8.08 8.08 0 0 1 4.13 6.66V47h35.02a6.1 6.1 0 0 0 4.87-3.03l.43-.84c.8-1.59.4-4-.85-5.24l-2.36-2.36A12 12 0 0 1 179 28a13 13 0 0 1 13-13zM84.02 143a6.1 6.1 0 0 0 4.87-3.03l.43-.84c.8-1.59.4-4-.85-5.24l-2.36-2.36A12 12 0 0 1 83 124a13 13 0 1 1 26 0c0 2.47-1.37 5.79-3.11 7.53l-2.36 2.36a4.94 4.94 0 0 0-.85 5.24l.43.84a6.1 6.1 0 0 0 4.87 3.03H143v-35.02a8.08 8.08 0 0 1 4.13-6.66l.84-.43a6.91 6.91 0 0 1 7.56 1.22l2.36 2.36A10.06 10.06 0 0 0 164 107a11 11 0 0 0 0-22c-1.94 0-4.75 1.16-6.11 2.53l-2.36 2.36a6.93 6.93 0 0 1-7.56 1.22l-.84-.43a8.08 8.08 0 0 1-4.13-6.66V49h-35.02a6.1 6.1 0 0 0-4.87 3.03l-.43.84c-.79 1.58-.4 4 .85 5.24l2.36 2.36a12.04 12.04 0 0 1 3.11 7.51A13 13 0 1 1 83 68a12 12 0 0 1 3.11-7.53l2.36-2.36a4.93 4.93 0 0 0 .85-5.24l-.43-.84A6.1 6.1 0 0 0 84.02 49H49v35.02a8.08 8.08 0 0 1-4.13 6.66l-.84.43a6.91 6.91 0 0 1-7.56-1.22l-2.36-2.36A10.06 10.06 0 0 0 28 85a11 11 0 0 0 0 22c1.94 0 4.75-1.16 6.11-2.53l2.36-2.36a6.93 6.93 0 0 1 7.56-1.22l.84.43a8.08 8.08 0 0 1 4.13 6.66V143h35.02z'%3E%3C/path%3E%3C/svg%3E");
font-family: "Gill Sans", "Gill Sans MT", "Franklin Gothic Medium", "Franklin Gothic", "ITC Franklin Gothic", Helvetica, Arial, sans-serif;
}
body {
position: relative;
top: 25%;
text-align: center;
background-color: #fcfcfc;
border-radius: 8px;
box-shadow: 0 16px 16px rgba(0, 0, 0, 0.10);
margin: 1rem;
padding: 1rem;
}
.header {
font-size: 3.0rem;
font-weight: bold;
color: #1237b1
}
@media only screen and (max-device-width: 700px) {
.query { width: 160px; }
}
.query {
border-color: #1237b1;
border-style: solid solid solid solid;
border-width: 1px 1px 1px 1px;
-moz-border-radius: 3px;
border-radius: 3px;
font-size: 20px;
padding: 5px 6px;
text-align: left;
width: 60%;
max-width: 600px;
height: 28px;
}
.submit {
height: 40px;
font-size: 20px;
cursor: pointer;
}
</style>
</head>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="icon.svg" type="image/svg+xml" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=3.0, user-scalable=1"
/>
<!--TODO increase maximum-scale after testing-->
<meta name="author" content="Sam Clark" />
<meta
name="description"
content="Full-text search for Brandon Sanderson's Cosmere"
/>
<meta name="robots" content="index,nofollow" />
<title>CSearch</title>
<link href="styles.css" rel="stylesheet" />
</head>

<body>
<a name="top"></a>

<br>
<span class="header">CSearch</span>
<br><br>

<form action="/search" method="get">
<input class='query' type="text" size="40" name="q" autocomplete="off" value="" autofocus />
<input class='submit' type="submit" value="Search" />
</form>

<br>

</body>
</html>
<body>
<div class="search-header">
<h1>CSearch</h1>
<form action="/search" method="get">
<input
class="query"
type="text"
size="40"
name="q"
autocomplete="off"
value=""
autofocus
/>
<input class="submit" type="submit" value="Search" />
</form>
</div>
</body>
</html>
83 changes: 83 additions & 0 deletions assets/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
html, body {
display: flex;
flex-direction: column;
justify-items: flex-start;
max-width: 100%;
background-color: #dbdde5;
background-image: url("background.svg");
font-family: "Gill Sans", "Gill Sans MT", "Franklin Gothic Medium",
"Franklin Gothic", "ITC Franklin Gothic", Helvetica, Arial, sans-serif;
}
.search-header {
align-self: center;
position: relative;
top: 25%;
text-align: center;
background-color: #fcfcfc;
border-radius: 4px;
box-shadow: 0 16px 16px rgba(0, 0, 0, 0.1);
margin: 0.5rem;
padding: 1rem;
width: 700px;
}
h1 {
font-size: 3rem;
font-weight: bold;
color: #1237b1;
}
@media only screen and (max-device-width: 700px) {
.query {
width: 160px;
}
.search-header {
width: 80vw;
}
.card {
width: 80vw;
}
}
.query {
border-color: #1237b1;
border-style: solid solid solid solid;
border-width: 1px 1px 1px 1px;
-moz-border-radius: 3px;
border-radius: 3px;
font-size: 20px;
padding: 5px 6px;
margin-bottom: 1rem;
text-align: left;
width: 60%;
max-width: 600px;
height: 28px;
}
.submit {
height: 40px;
font-size: 20px;
cursor: pointer;
}
.cards {
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
}
.card {
display: flex;
background-color: #fcfcfc;
border-radius: 4px;
box-shadow: 0 8px 8px rgba(0, 0, 0, 0.1);
margin: 0.5rem;
padding: 1rem;
}
ul {
margin: 0;
padding: 0;
}
.query:focus-visible {
outline: black solid 2px;
outline-offset: 1px;
}
.submit:focus-visible {
outline: black solid 2px;
outline-offset: 1px;
}
Loading

0 comments on commit 67a62af

Please sign in to comment.