Style and interaction improvments

This commit is contained in:
Romain de Laage 2022-11-24 09:52:47 +01:00
parent ce3f2cc1c4
commit 2d79422364
Signed by: rdelaage
GPG Key ID: 534845FADDF0C329
5 changed files with 76 additions and 16 deletions

View File

@ -3,11 +3,8 @@
{{- partial "head.html" . -}}
<body>
<header>
<h1>{{ .Site.Title }}</h1>
<h1>{{ if .Params.Title}}{{ .Params.Title }}{{ else }}{{ .Site.Title }}{{ end }}</h1>
</header>
{{- block "main" . }}{{- end }}
<footer>
PoC fedicomment, Romain de Laage
</footer>
</body>
</html>

View File

@ -1,6 +1,5 @@
{{ define "main" }}
<article>
{{ if .Params.Title }}<h1>{{ .Params.Title }}</h1>{{ end }}
{{ .Content }}
</article>
{{ if .Params.postid }}

View File

@ -1,5 +1,32 @@
:root {
--fedi-button-color: #502102;
--fedi-warning-color: #b5680b;
--fedi-error-color: #fca01d;
--fedi-light-color: #f8efd5;
--fedi-dark-color: #2e1600;
--fedi-hl-color: #7c7672;
}
#fedicomment-button {
background-color: var(--fedi-button-color);
border: none;
border-radius: 10px;
margin: auto;
color: var(--fedi-light-color);
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: block;
font-size: 16px;
transition: 0.2s;
}
#fedicomment-button:hover {
border-radius: 15px;
}
.fedicomment-alert {
color: white;
color: var(--fedi-light-color);
text-align: center;
font-weight: bold;
padding: 30px;
@ -9,17 +36,17 @@
}
.fedicomment-error {
background-color: red;
background-color: var(--fedi-error-color);
}
.fedicomment-warning {
background-color: blue;
background-color: var(--fedi-warning-color);
}
.fedicomment-comment {
margin: 10px;
padding: 10px;
border: solid grey 1px;
border: solid var(--fedi-hl-color) 1px;
border-radius: 10px;
}
@ -30,7 +57,7 @@
margin-left: 5px;
padding: 0;
padding-left: 5px;
border-left: solid grey 1px;
border-left: solid var(--fedi-hl-color) 1px;
}
.fedicomment-comment-header img {
@ -45,7 +72,7 @@
.fedicomment-reactions {
margin: 10px;
padding: 10px;
border: solid grey 1px;
border: solid var(--fedi-hl-color) 1px;
border-radius: 10px;
}

View File

@ -1,6 +1,6 @@
class Fedicomment {
container;
postod;
postid;
mastodonurl;
constructor() {
@ -50,7 +50,7 @@ class Fedicomment {
.then((resp) => {
if (resp.ok) {
resp.json().then((data) => {
this.container.innerHTML = `<div class="fedicomment-reactions"><span class="fedicomment-share">${data.reblogs_count}</span> - <span class="fedicomment-fav">${data.favourites_count}</span> - ${data.replies_count} replies</div>`;
this.container.innerHTML = `<details><summary>Interact with this post</summary>Copy and paste this URL in your Mastodon application: ${data.url}</details><div class="fedicomment-reactions"><span class="fedicomment-share">${data.reblogs_count}</span> - <span class="fedicomment-fav">${data.favourites_count}</span> - ${data.replies_count} replies</div>`;
})
}
else {

View File

@ -1,21 +1,58 @@
:root {
--bg-color: #fefee2;
--fg-color: #000000;
--hl-color1: #2f1b0c;
--hl-color2: #370028;
--link-color1: #2e006c;
--link-color2: #2c007a;
}
* {
margin: 0;
box-sizing: border-box;
font-family: sans-serif;
color: var(--fg-color);
}
a {
color: var(--link-color1);
}
a:hover {
color: var(--link-color2);
}
h1, h2, h3, h3, h5, h6 {
color: var(--hl-color1);
}
h1:hover, h2:hover, h3:hover, h3:hover, h5:hover, h6:hover {
color: var(--hl-color2);
}
body {
height: 100%;
padding: 15px;
width: 70%;
width: 60%;
margin: auto;
background-color: var(--bg-color);
}
h1 {
margin: 15px;
header h1 {
margin: 60px;
text-align: center;
}
article h1, article h2, article h3, article h4, article h5, article h6 {
margin-bottom: 35px;
padding-left: 35px;
}
article {
padding: 15px;
}
.articles {
line-height: 3em;
margin: 60px;
}