Skip to content

Commit

Permalink
🌐 style(RTL): improve RTL styling consistency
Browse files Browse the repository at this point in the history
- Replace directional properties with logical ones.
- Enhance compatibility with right-to-left languages across the site's design.

Related: #257 #262 #270 #272 #274 #368
  • Loading branch information
welpo committed Sep 15, 2024
1 parent 35dcf55 commit cd32625
Show file tree
Hide file tree
Showing 21 changed files with 125 additions and 145 deletions.
47 changes: 15 additions & 32 deletions sass/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,16 @@ html {
body {
display: flex;
flex-direction: column;
margin: 0 5vmin;
padding: 0;
margin-inline: 5vmin;
margin-block: 0;
min-height: 100vh;
}

.content {
word-wrap: break-word;
margin: 0 auto;
margin-top: 6vmin;
margin-bottom: 4rem;
margin-block-end: 4rem;
width: 100%;
max-width: var(--max-layout-width);
}
Expand All @@ -174,18 +174,18 @@ article {
}

.full-width {
margin-right: -$base-margin;
margin-left: -$base-margin;
margin-inline-start: -$base-margin;
margin-inline-end: -$base-margin;
max-width: calc(100% + 2*$base-margin);
}

li {
p:not(:last-child) {
margin-bottom: 0;
margin-block-end: 0;
}

p + :last-child {
margin-bottom: var(--paragraph-spacing);
margin-block-end: var(--paragraph-spacing);
}
}
}
Expand All @@ -210,62 +210,44 @@ h3,
h4,
h5,
h6 {
display: block;
position: relative;
margin: 0;
}

h1 {
display: block;
margin-top: 0.67em;
margin-right: 0;
margin-bottom: 0em;
margin-left: 0;
font-weight: 550;
font-size: 1.62rem;
}

h2 {
display: block;
margin-top: 0.5em;
margin-right: 0;
margin-bottom: 0em;
margin-left: 0;
font-weight: 550;
font-size: 1.4rem;
}

h3 {
display: block;
margin-top: 0.3em;
margin-right: 0;
margin-bottom: 0em;
margin-left: 0;
font-weight: 550;
font-size: 1.2rem;
}

h4 {
display: block;
margin-top: 0.83em;
margin-right: 0;
margin-bottom: 0em;
margin-left: 0;
font-weight: 550;
font-size: 1rem;
}

h5 {
display: block;
margin-top: 0.83em;
margin-right: 0;
margin-bottom: 0em;
margin-left: 0;
font-weight: normal;
font-size: 1rem;
}

p {
margin-top: 0.4rem;
margin-bottom: var(--paragraph-spacing);
margin-block-end: var(--paragraph-spacing);
font-size: 1em;
line-height: 2rem;
}
Expand Down Expand Up @@ -294,7 +276,7 @@ video {
}

.subheader {
margin-bottom: 2rem;
margin-block-end: 2rem;
}

.mobile-only {
Expand All @@ -312,8 +294,8 @@ video {

article .full-width {
display: block;
margin-right: 0;
margin-left: 0;
margin-inline-start: 0;
margin-inline-end: 0;
max-width: none;
overflow-x: auto;
}
Expand All @@ -334,7 +316,8 @@ video {
}

body {
margin: 0 16px;
margin-inline: 16px;
margin-block: 0;
}
}

Expand Down
8 changes: 4 additions & 4 deletions sass/parts/_admonitions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,16 @@
.admonition {
display: flex;
align-items: flex-start;
margin: 1em 0;
border-left: 6px solid;
margin-block: 1em;
border-radius: 10px;
border-inline-start: 6px solid;
padding: 0.8rem;
color: var(--text-color-high-contrast);
font-family: var(--sans-serif-font);

p {
margin-bottom: 0;
margin-left: -1.75rem;
margin-inline-start: -1.75rem;
margin-block-end: 0;
font-family: inherit;
}

Expand Down
15 changes: 8 additions & 7 deletions sass/parts/_archive.scss
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
.archive {
margin-top: 4vmin;
margin-block-start: 4vmin;

.listing-title {
margin-bottom: 1rem;
margin-block-end: 1rem;
font-size: 1.5rem;
}

.listing-item {
display: flex;
gap: 1rem;
margin-bottom: 0.5rem;
padding: 0.2rem 1rem;
margin-block-end: 0.5rem;
padding-inline: 1rem;
padding-block: 0.2rem;

.post-time {
padding-left: 1vmin;
min-width: 5rem;
text-align: left;
padding-inline-start: 1vmin;
min-inline-size: 5rem;
text-align: start;

.date {
color: var(--meta-color);
Expand Down
6 changes: 4 additions & 2 deletions sass/parts/_cards.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 24px;
margin-top: 4vmin;
padding: 12px 0;
padding-block: 12px;

.card {
box-shadow: rgba(50, 50, 93, 0.25) 0px 2px 5px -1px, rgba(0, 0, 0, 0.3) 0px 1px 3px -1px;
Expand All @@ -22,7 +22,9 @@
}

.card-info {
padding: 0 24px 24px;
padding-inline: 24px;
padding-block-start: 0;
padding-block-end: 24px;
text-align: center;
}

Expand Down
19 changes: 11 additions & 8 deletions sass/parts/_code.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
code {
border-radius: 5px;
background-color: var(--bg-1);
padding: 0.1em 0.2em;
padding-inline: 0.2em;
padding-block: 0.1em;
font-size: 0.9rem;
font-family: var(--code-font);

Expand All @@ -17,7 +18,7 @@ code {
border-collapse: collapse;
border-spacing: 0rem;
width: 100%;
text-align: left;
text-align: start;

td,
th,
Expand All @@ -29,7 +30,7 @@ code {
tbody td:first-child {
width: 2rem;
user-select: none;
text-align: left;
text-align: start;
}

tbody tr:nth-child(even) {
Expand All @@ -46,7 +47,9 @@ pre {
display: block;
position: relative;
border-radius: 5px;
padding: 2.4rem 1rem 1rem;
padding-inline: 1rem;
padding-block-start: 2.4rem;
padding-block-end: 1rem;
overflow: hidden;
overflow-x: auto;
line-height: 1.4;
Expand All @@ -69,13 +72,13 @@ pre {
left: 0;
background-color: var(--primary-color);
padding: 0.3rem;
padding-left: 1rem;
padding-inline-start: 1rem;
width: calc(100% - 1.3rem);
height: 0.9rem;
content: attr(data-lang);
color: var(--hover-color);
font-size: 0.65rem;
text-align: left;
text-align: start;
text-transform: uppercase;
}

Expand All @@ -85,13 +88,13 @@ pre {
top: 0;
right: 1.3rem;
padding-top: 0.3rem;
padding-right: 1.3rem;
padding-inline-end: 1.3rem;
max-width: calc(100% - 14em);
height: 0.9rem;
overflow: hidden;
color: var(--hover-color);
font-size: 0.65rem;
text-align: right;
text-align: end;
text-overflow: ellipsis;
white-space: nowrap;
}
Expand Down
3 changes: 2 additions & 1 deletion sass/parts/_comments.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
margin: 0.5em auto;
border: none;
background: none;
padding: 0.5em 1em;
padding-block: 0.5em;
padding-inline: 1em;
color: inherit;
font-size: 0.95rem;
font-family: var(--sans-serif-font);
Expand Down
2 changes: 1 addition & 1 deletion sass/parts/_footer.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
footer {
margin-top: auto;
margin-bottom: 1.4rem;
margin-block-end: 1.4rem;
color: var(--meta-color);
font-size: 0.88rem;
font-family: var(--post-font-family);
Expand Down
9 changes: 2 additions & 7 deletions sass/parts/_header-anchor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
justify-content: center;
align-items: center;
opacity: 0;
margin-left: -2rem;
padding-right: 0.3rem;
margin-inline-start: -2rem;
padding-inline-end: 0.3rem;
width: 1.9rem;
height: 100%;
user-select: none;
Expand All @@ -15,11 +15,6 @@
}
}

:dir(rtl) .header-anchor {
margin-right: -2rem;
padding-left: 0.3rem;
}

.link-icon {
-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M14.78 3.653a3.936 3.936 0 1 1 5.567 5.567l-3.627 3.627a3.936 3.936 0 0 1-5.88-.353.75.75 0 0 0-1.18.928 5.436 5.436 0 0 0 8.12.486l3.628-3.628a5.436 5.436 0 1 0-7.688-7.688l-3 3a.75.75 0 0 0 1.06 1.061l3-3Z'%3E%3C/path%3E%3Cpath d='M7.28 11.153a3.936 3.936 0 0 1 5.88.353.75.75 0 0 0 1.18-.928 5.436 5.436 0 0 0-8.12-.486L2.592 13.72a5.436 5.436 0 1 0 7.688 7.688l3-3a.75.75 0 1 0-1.06-1.06l-3 3a3.936 3.936 0 0 1-5.567-5.568l3.627-3.627Z'%3E%3C/path%3E%3C/svg%3E");
align-self: center;
Expand Down
16 changes: 8 additions & 8 deletions sass/parts/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ header {
}

.page-header {
margin: 4rem 0px 1rem 0px;
margin-block: 4rem 1rem;
font-size: 3em;
line-height: 100%;
font-family: var(--header-font);
Expand All @@ -17,7 +17,7 @@ header {
justify-content: space-between;
align-items: center;
margin: 0 auto;
padding: 1em 0;
padding-block: 1em;
max-width: var(--max-layout-width);
}

Expand Down Expand Up @@ -48,7 +48,7 @@ header {
}

.home-title {
margin-left: -0.12rem;
margin-inline-start: -0.12rem;
border: none;
padding: 0.12rem;
color: var(--primary-color);
Expand Down Expand Up @@ -85,8 +85,8 @@ header {
display: flex;
justify-content: center;
align-items: center;
margin-right: 0.5rem;
margin-left: 0.5rem;
margin-inline-start: 0.5rem;
margin-inline-end: 0.5rem;

.language-switcher-icon {
-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-width='1.8' d='M1 12a11 11 90 0 0 22 0 11 11 90 0 0-22 0m1-4h20M2 16h20M11 1a21 21 90 0 0 0 22m2-22a21 21 90 0 1 0 22'/%3E%3C/svg%3E%0A");
Expand Down Expand Up @@ -125,12 +125,12 @@ header {
.dropdown-content {
display: none;
position: absolute;
left: 50%;
transform: translateX(-50%);
z-index: 1;
inset-inline-start: 50%;
background: var(--background-color);
padding-right: 0.5rem;
padding-left: 0.5rem;
padding-inline-start: 0.5rem;
padding-inline-end: 0.5rem;
text-align: center;
white-space: nowrap;

Expand Down
Loading

0 comments on commit cd32625

Please sign in to comment.