Skip to content

Commit f835c0d

Browse files
committed
Some initial stlying for file tree lists
See #260
1 parent ee60fbd commit f835c0d

File tree

3 files changed

+57
-4
lines changed

3 files changed

+57
-4
lines changed

src/assets/sass/modules/_lists.scss

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,55 @@ dd {
125125
list-style-type: decimal;
126126
}
127127

128+
/**
129+
* Have a 'file-tree'-style list (without any semantics implied).
130+
*
131+
* 1. Don't use ligatures on monospace font.
132+
*
133+
* Example HTML:
134+
*
135+
* <ul class="list--tree">
136+
* <ol class="list--tree">
137+
*/
138+
139+
.list--tree,
140+
.list--tree ol,
141+
.list--tree ul {
142+
list-style: none;
143+
}
144+
145+
.list--tree {
146+
.directory::before,
147+
.document::before {
148+
display: inline-block;
149+
width: 16px;
150+
height: 16px;
151+
margin-bottom: -2px;
152+
padding-right: 0.5em;
153+
background-repeat: no-repeat;
154+
background-size: 16px 16px;
155+
text-indent: -9999px;
156+
content: "";
157+
overflow: hidden;
158+
vertical-align: baseline;
159+
}
160+
161+
.directory::before {
162+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cg fill='%23333'%3E%3Cpath d='M14 2h-1V1h-3L9 2H1v12h13V2zM2 3h11v10H2V3z'/%3E%3Cpath d='M2 4h11v1H2z'/%3E%3C/g%3E%3C/svg%3E");
163+
}
164+
165+
.document::before {
166+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cg fill='%23333'%3E%3Cpath d='m10 15h-7v-14h10v11zm2-3v-10h-8v12h6z'/%3E%3Cpath d='m10 12v2h-1v-3h3v1z'/%3E%3C/g%3E%3C/svg%3E");
167+
}
168+
}
169+
170+
@include dark-mode {
171+
.list--tree .directory::before,
172+
.list--tree .document::before {
173+
filter: brightness(3) sepia(1) hue-rotate(168deg) saturate(33%);
174+
}
175+
}
176+
128177
/**
129178
* Have a compact definition list.
130179
*

src/assets/sass/modules/_responsive.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,8 @@
499499
figcaption,
500500
tfoot,
501501
.footnote,
502-
.footnotes {
502+
.footnotes,
503+
.list--tree {
503504
line-height: $line-height-desktop;
504505
}
505506

src/assets/sass/modules/_typography.scss

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,8 @@ var {
246246
pre,
247247
code,
248248
kbd,
249-
samp {
249+
samp,
250+
.list--tree {
250251
border: 1px solid $color-border-extra-light;
251252
border-radius: 0.2857143em; // 4px / 14px
252253
background-color: $color-background-box;
@@ -261,7 +262,8 @@ samp {
261262
pre,
262263
code,
263264
kbd,
264-
samp {
265+
samp,
266+
.list--tree {
265267
border-color: $dark-color-border-extra-light;
266268
background-color: $dark-color-background-box;
267269
color: $dark-color-text;
@@ -282,7 +284,8 @@ samp {
282284
* 3. Set tab size to 4 spaces.
283285
*/
284286

285-
pre {
287+
pre,
288+
.list--tree {
286289
padding: 0.5714286em 1.1428571em; // 8px / 14px + 16px / 14px
287290
word-wrap: normal; /* 1 */
288291
overflow-x: auto; /* 2 */

0 commit comments

Comments
 (0)