refactor/split css, templates

This commit is contained in:
f0x 2024-11-05 15:53:22 +01:00
commit 70342681c1
54 changed files with 1371 additions and 1600 deletions

View file

@ -0,0 +1,33 @@
/* Displays account with displayname, username and avatar */
.account-card {
display: inline-grid;
grid-template-columns: auto 1fr;
grid-template-rows: auto auto;
text-decoration: none;
gap: 0.5rem 1rem;
border-radius: $br;
padding: 0.5rem;
min-width: 40%;
margin-bottom: 0.3rem;
background: $list-entry-bg;
&:hover {
background: $list-entry-alternate-bg;
}
b {
font-size: 1.25rem;
align-self: end;
margin: 0;
color: $fg;
}
img.avatar {
border-radius: 0.5rem;
width: 5rem;
height: 5rem;
object-fit: cover;
grid-row: 1 / span 2;
}
}

View file

@ -0,0 +1,44 @@
/*
Column header that appears at the top
of threads, at the top of sections of
profiles (About, Pinned Posts, etc).
*/
.col-header {
display: grid;
grid-template-columns: auto 1fr;
gap: 1rem;
justify-content: start;
align-items: center;
margin: 0;
background: $profile-bg;
border-top-left-radius: $br;
border-top-right-radius: $br;
padding: 0.75rem;
a {
justify-self: end;
}
h1, h2, h3, h4 {
font-size: 1.2rem;
line-height: 1.3rem;
margin: 0;
}
&.wrap { /* for headers that can have a lot more text, like thread summary/reply info */
display: flex;
flex-direction: row;
flex-wrap: wrap;
column-gap: 1rem;
row-gap: 0.5rem;
box-shadow: $boxshadow;
border: $boxshadow-border;
h2 {
margin-right: auto;
}
}
}

View file

@ -0,0 +1,23 @@
/* Style emoji to fit in-line with text */
.emoji {
width: 1.45em;
height: 1.45em;
margin: -0.2em 0.02em 0;
object-fit: contain;
vertical-align: middle;
@media (prefers-reduced-motion: no-preference) {
/*
Enlarge emojis on hover to give
viewer a good look at them.
*/
transition: 0.1s;
&:hover, &:active {
transform: scale(2);
background-color: $bg;
box-shadow: $boxshadow;
border: $boxshadow-border;
border-radius: $br-inner;
}
}
}

View file

@ -0,0 +1,68 @@
input, select, textarea, .input {
box-sizing: border-box;
border: 0.15rem solid $input-border;
border-radius: 0.1rem;
color: $fg;
background: $input-bg;
width: 100%;
font-family: 'Noto Sans', sans-serif;
font-size: 1rem;
padding: 0.3rem;
&:focus, &:active {
border-color: $input-focus-border;
}
&:invalid, .invalid & {
border-color: $input-error-border;
}
&:disabled {
background: transparent;
}
&::placeholder {
opacity: 1;
color: $fg-reduced
}
}
.button, button {
border-radius: $br-inner;
color: $button-fg;
background: $button-bg;
box-shadow: $boxshadow;
border: $button-border;
text-decoration: none;
font-size: 1.2rem;
font-weight: bold;
padding: 0.5rem;
border: none;
cursor: pointer;
text-align: center;
font-family: 'Noto Sans', sans-serif;
&.danger {
color: $button-danger-fg;
background: $button-danger-bg;
&:hover {
background: $button-danger-hover-bg;
}
}
&:disabled,
&.disabled {
color: $white2;
background: $gray2;
cursor: not-allowed;
&:hover {
background: $gray3;
}
}
&:hover {
background: $button-hover-bg;
}
}

View file

@ -0,0 +1,71 @@
/*
Outdent block quotes a bit; use
orange strip for left border.
*/
blockquote {
padding: 0.5rem;
border-left: 0.2rem solid $border-accent;
margin: 0;
font-style: normal;
/*
Same background color we
use for code blocks
*/
background-color: $gray2;
border-radius: 0;
}
/*
Nice dashed orange line
for horizontal rules.
*/
hr {
border: 0;
border-top: 1px dashed $border-accent;
}
/*
Don't indent definition
lists and definitions.
*/
dl {
margin: 0;
dd {
margin-left: 0;
}
}
label {
cursor: pointer;
}
/*
Set our own nice background for
monospace code and pre blocks.
*/
pre, pre[class*="language-"],
code, code[class*="language-"] {
background-color: $gray2;
}
/*
Just code on its own inside status
content, ie, `here is some code`.
*/
code {
padding: 0.25rem;
border-radius: $br-inner;
white-space: pre-wrap;
}
select {
/*
By default this looks awful on Gnome
Web so restyle a bit to try to make
it consistent with firefox + chrome.
*/
appearance: none;
line-height: 1.5rem;
}

View file

@ -0,0 +1,128 @@
/*
Restyle unordered lists; outdent
and replace dot with orange dot (unless .nodot class applied).
*/
ul {
padding-left: 2.5rem;
list-style: none;
li::before {
content: "\2022";
color: $border-accent;
font-weight: bold;
display: inline-block;
width: 1.5rem;
margin-left: -1.5rem;
}
&.nodot {
li::before {
content: initial;
}
}
}
/*
Mirror the same styling a little bit
for ordered lists by making marker bold.
*/
ol {
padding-left: 2.5rem;
li::marker {
font-weight: bold;
}
}
/* Tabulated list */
.list {
display: flex;
flex-direction: column;
.header, .entry {
padding: 0.5rem;
}
.header {
border: 0.1rem solid transparent !important; /* for alignment with .entry border padding */
background: $gray1 !important;
display: flex;
font-weight: bold;
}
.entries {
display: flex;
flex-direction: column;
&.scrolling {
height: 20rem;
max-height: 20rem;
overflow: auto;
}
}
input[type=checkbox] {
margin-left: 0.5rem;
}
.entry {
display: flex;
flex-wrap: wrap;
background: $list-entry-bg;
border: 0.1rem solid transparent;
&:nth-child(even) {
background: $list-entry-alternate-bg;
}
&:hover {
background: $list-entry-hover-bg;
}
&:active, &:focus, &:hover, &:target {
border-color: $fg-accent;
}
}
}
/* Extends .list styling for domain-blocklist.tmpl */
.domain-blocklist {
box-shadow: $boxshadow;
.entry {
display: grid;
grid-template-columns: max(30%, 10rem) 1fr;
gap: 0.5rem;
align-items: start;
border: $boxshadow-border;
border-top-color: transparent;
& > div {
display: flex;
align-items: center
}
.domain a {
font-weight: bold;
text-decoration: none;
display: inline-block; /* so it wraps properly */
}
.public_comment p {
margin: 0;
}
}
.header .domain {
color: $fg;
}
}
@media screen and (max-width: 30rem) {
.domain-blocklist .entry {
grid-template-columns: 1fr;
gap: 0;
}
}

View file

@ -0,0 +1,51 @@
/*
Restyle Prism code highlighting toolbar
plugin buttons to our own button style.
We have to use really specific selectors
because of how specific prism.css is.
*/
div.code-toolbar > div.toolbar {
margin-right: 0.5rem;
display: flex;
gap: 0.25rem;
> div.toolbar-item {
> span, > button {
color: $button-fg;
background: $button-bg;
font-weight: bold;
box-shadow: $boxshadow;
&:hover, &:focus {
color: $button-fg;
}
}
.copy-to-clipboard-button:hover {
background: $button-hover-bg;
}
}
}
pre, pre[class*="language-"] {
border-radius: $br;
padding: 0.5rem;
white-space: pre;
overflow-x: auto;
/*
Code inside a pre block, ie.,
```
here is some code
```
*/
code {
width: 100%;
padding: 0;
white-space: pre;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}
}

View file

@ -0,0 +1,67 @@
.status .status-header > address {
/*
Avoid stretching so wide that user
can't click on open thread link that's
behind the status header link.
*/
width: fit-content;
> a {
padding: 0 0.75rem;
display: grid;
grid-template-columns: 3.5rem 1fr auto;
grid-template-rows: auto auto;
grid-template-areas:
"avatar author-strapline author-strapline"
"avatar author-strapline author-strapline";
gap: 0 0.5rem;
font-style: normal;
.avatar {
grid-area: avatar;
height: 3.5rem;
width: 3.5rem;
object-fit: cover;
border: 0.15rem solid $avatar-border;
border-radius: $br;
overflow: hidden; /* hides corners from img overflowing */
img {
height: 100%;
width: 100%;
object-fit: cover;
background: $bg;
}
}
.author-strapline {
grid-area: author-strapline;
display: grid;
grid-template-columns: 1fr auto;
grid-template-rows: auto;
grid-template-areas:
"display display"
"user user";
gap: 0 0.5rem;
.displayname, .username {
justify-self: start;
align-self: start;
max-width: 100%;
font-size: 1rem;
line-height: 1.3rem;
}
.displayname {
grid-area: display;
font-weight: bold;
}
.username {
grid-area: user;
color: $link-fg;
}
}
}
}

View file

@ -0,0 +1,43 @@
.status {
&.indent-1 {
margin-left: 0.5rem;
}
&.indent-2 {
margin-left: 1rem;
}
&.indent-3 {
margin-left: 1.5rem;
}
&.indent-4 {
margin-left: 2rem;
}
&.indent-5 {
margin-left: 2.5rem;
}
&.indent-1,
&.indent-2,
&.indent-3,
&.indent-4,
&.indent-5 {
.status-link {
margin-left: -0.5rem;
border-left: 0.15rem dashed $border-accent;
}
}
border-radius: 0;
&:last-child {
border-bottom-left-radius: $br;
border-bottom-right-radius: $br;
.status-info {
border-bottom-left-radius: $br;
border-bottom-right-radius: $br;
}
}
}

View file

@ -0,0 +1,429 @@
@import "photoswipe/dist/photoswipe.css";
@import "photoswipe-dynamic-caption-plugin/photoswipe-dynamic-caption-plugin.css";
@import "plyr/dist/plyr.css";
.status {
background: $status-bg;
box-shadow: $boxshadow;
border: $boxshadow-border;
border-radius: $br;
position: relative;
padding-top: 0.75rem;
a {
position: relative;
z-index: 1;
color: inherit;
text-decoration: none;
}
.status-body {
padding: 0.5rem 0.75rem;
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.text-spoiler > summary, .text {
position: relative;
z-index: 2;
}
.text-spoiler > summary {
list-style: none;
display: flex;
flex-direction: column;
gap: 0.5rem;
padding-bottom: 0.5rem;
&::-webkit-details-marker {
display: none; /* Safari */
}
.button {
width: fit-content;
white-space: nowrap;
cursor: pointer;
padding: 0.2rem 0.3rem;
font-size: 1rem;
}
}
.text {
margin: 0;
grid-row: span 1;
grid-column: 1 / span 3;
display: flex;
flex-direction: column;
gap: 0.5rem;
width: 100%;
a {
color: $link-fg;
text-decoration: underline;
}
.content {
word-break: break-word;
line-height: 1.6rem;
width: 100%;
/*
Normalize header sizes to fit better
with the line-height we use for statuses.
*/
h1 {
margin: 0;
font-size: 1.8rem;
line-height: initial;
}
h2 {
margin: 0;
font-size: 1.6rem;
line-height: initial;
}
h3 {
margin: 0;
font-size: 1.4rem;
line-height: initial;
}
h4 {
margin: 0;
font-size: 1.2rem;
line-height: initial;
}
h5 {
margin: 0;
font-size: 1rem;
line-height: initial;
}
}
.poll {
background-color: $gray2;
z-index: 2;
display: flex;
flex-direction: column;
border-radius: $br;
padding: 0.5rem;
margin: 0;
gap: 1rem;
.poll-options {
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
gap: 1rem;
.poll-option {
display: flex;
flex-direction: column;
gap: 0.1rem;
label {
cursor: default;
}
meter {
width: 100%;
}
.poll-vote-summary {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
white-space: nowrap;
}
}
}
.poll-info {
background-color: $gray4;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
border-radius: $br-inner;
padding: 0.25rem;
gap: 0.25rem;
span {
justify-self: center;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
}
}
.media {
grid-column: span 3;
display: grid;
grid-template-columns: 50% 50%;
grid-auto-rows: 10rem;
overflow: hidden;
.media-wrapper {
height: 100%;
width: 100%;
box-sizing: border-box;
border: 0.15rem solid $gray1;
border-radius: $br;
position: relative;
overflow: hidden;
z-index: 2;
details {
position: absolute;
height: 100%;
width: 100%;
&[open] summary {
height: auto;
width: auto;
margin: 1rem;
padding: 0;
.show, video, img {
display: none;
}
.eye.button .hide {
display: inline-block;
grid-column: 1 / span 3;
grid-row: 1 / span 2;
}
}
summary {
position: absolute;
height: 100%;
width: 100%;
z-index: 3;
overflow: hidden;
display: grid;
padding: 1rem;
grid-template-columns: 1fr auto 1fr;
grid-template-rows: 1fr 1fr;
grid-template-areas:
"eye sensitive ."
". sensitive .";
&::-webkit-details-marker {
display: none; /* Safari */
}
.eye.button {
grid-area: eye;
align-self: start;
justify-self: start;
margin: 0;
padding: 0.4rem;
.fa-fw {
line-height: $fa-fw;
}
.hide {
display: none;
}
}
.show.sensitive {
grid-area: sensitive;
align-self: center;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
.button {
cursor: pointer;
align-self: center;
}
}
video, img {
z-index: -1;
position: absolute;
height: calc(100% + 1.2rem);
width: calc(100% + 1.2rem);
top: -0.6rem;
left: -0.6rem;
filter: blur(1.2rem);
}
}
video.plyr-video, .plyr {
position: absolute;
height: 100%;
width: 100%;
object-fit: contain;
background: $gray1;
}
.unknown-attachment {
.placeholder {
width: 100%;
height: 100%;
padding: 0.8rem;
border: 0.2rem dashed $white2;
display: flex;
flex-direction: column;
align-items: center;
gap: 0.25rem;
color: $white2;
.placeholder-external-link {
align-self: end;
font-size: 2.5rem;
}
.placeholder-icon {
width: 100%;
font-size: 3.5rem;
text-align: center;
margin-top: auto;
}
.placeholder-link-to {
width: 100%;
text-align: center;
margin-bottom: auto;
}
}
}
}
}
&.single .media-wrapper {
grid-column: span 2;
}
&.odd .media-wrapper:first-child,
&.double .media-wrapper {
grid-row: span 2;
}
@media screen and (max-width: 42rem) {
.media-wrapper {
grid-column: span 2;
grid-row: span 2;
}
}
img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
.status-info {
background: $status-info-bg;
color: $fg-reduced;
border-top: 0.15rem solid $status-info-border;
padding: 0.5rem 0.75rem;
.status-stats {
display: flex;
gap: 1rem;
.stats-grouping {
display: flex;
flex-wrap: wrap;
column-gap: 1rem;
}
.stats-item {
display: flex;
gap: 0.4rem;
}
.stats-item:not(.published-at) {
z-index: 1;
user-select: none;
}
.language {
margin-left: auto;
}
}
grid-column: span 3;
}
.status-link {
top: 0;
right: 0;
bottom: 0;
left: 0;
overflow: hidden;
text-indent: 100%;
white-space: nowrap;
position: absolute;
z-index: 0;
}
&:first-child {
/* top left, top right */
border-top-left-radius: $br;
border-top-right-radius: $br;
}
&:last-child, &:last-child .info {
/* bottom left, bottom right */
border-bottom-left-radius: $br;
border-bottom-right-radius: $br;
}
&.expanded {
background: $status-focus-bg;
.status-info {
background: $status-focus-info-bg;
}
}
}
.plyr--video {
flex-direction: column-reverse;
.plyr__video-wrapper {
position: relative;
}
.plyr__controls {
align-self: stretch;
position: initial;
padding: 0.1rem;
padding-top: 0.2rem;
}
.plyr__control {
box-shadow: none;
}
.plyr__control--overlaid {
top: calc(50% - 18px);
}
}
.pswp__content {
padding: 2rem;
.plyr {
max-height: 100%;
}
}

View file

@ -0,0 +1,21 @@
.hidden {
display: none;
}
.nounderline {
text-decoration: none;
}
.accent {
color: $acc1;
}
.text-cutoff {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.wrap-text {
word-wrap: anywhere;
}