Skip to content

Commit

Permalink
Match inscription preview and site background colors (#1175)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey committed Jan 9, 2023
1 parent 39104f1 commit 494456d
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/templates/iframe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl Display for Iframe {
if self.main {
write!(
f,
"<a href=/content/{}><iframe sandbox=allow-scripts scrolling=no src=/preview/{}></iframe></a>",
"<a href=/preview/{}><iframe sandbox=allow-scripts scrolling=no src=/preview/{}></iframe></a>",
self.inscription_id,
self.inscription_id,
)
Expand Down Expand Up @@ -59,7 +59,7 @@ mod tests {
assert_regex_match!(
Iframe::main(txid(1))
.0.to_string(),
"<a href=/content/1{64}><iframe sandbox=allow-scripts scrolling=no src=/preview/1{64}></iframe></a>",
"<a href=/preview/1{64}><iframe sandbox=allow-scripts scrolling=no src=/preview/1{64}></iframe></a>",
);
}
}
4 changes: 3 additions & 1 deletion src/templates/inscription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ mod tests {
},
"
<h1>Inscription 1{64}</h1>
<div class=inscription><a href=/content/1{64}><iframe .* src=/preview/1{64}></iframe></a></div>
<div class=inscription><a href=/preview/1{64}><iframe .* src=/preview/1{64}></iframe></a></div>
<dl>
<dt>content</dt>
<dd><a href=/content/1{64}>link</a></dd>
<dt>content size</dt>
<dd>10 bytes</dd>
<dt>content type</dt>
Expand Down
2 changes: 1 addition & 1 deletion static/index.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
:root {
--common: grey;
--dark-bg: hsl(200, 7%, 8%);
--dark-bg: #131516;
--dark-fg: #98a3ad;
--epic: darkorchid;
--legendary: gold;
Expand Down
9 changes: 5 additions & 4 deletions static/preview-text.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
body {
margin: 0;
html {
background-color: #131516;
color: white;
}

pre {
color: white;
body {
margin: 0;
}
2 changes: 2 additions & 0 deletions templates/inscription.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ <h1>Inscription {{ self.inscription_id }}</h1>
<div class=inscription>{{Iframe::main(self.inscription_id)}}</div>
<dl>
%% if let Some(content_size) = self.inscription.content_size() {
<dt>content</dt>
<dd><a href=/content/{{self.inscription_id}}>link</a></dd>
<dt>content size</dt>
<dd>{{ content_size }} bytes</dd>
%% }
Expand Down
1 change: 1 addition & 0 deletions templates/preview-image.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<meta name=format-detection content='telephone=no'>
<style>
html {
background-color: #131516;
height: 100%;
}

Expand Down
4 changes: 3 additions & 1 deletion tests/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ fn inscription_page() {
format!(
".*<meta property=og:image content='/content/{reveal_tx}'>.*
<h1>Inscription {reveal_tx}</h1>
.*<a href=/content/{reveal_tx}><iframe .* src=/preview/{reveal_tx}></iframe></a>.*
.*<a href=/preview/{reveal_tx}><iframe .* src=/preview/{reveal_tx}></iframe></a>.*
<dl>
<dt>content</dt>
<dd><a href=/content/{reveal_tx}>link</a></dd>
<dt>content size</dt>
<dd>10 bytes</dd>
<dt>content type</dt>
Expand Down

0 comments on commit 494456d

Please sign in to comment.