Skip to content

Commit 1fd665b

Browse files
committed
perf: modify checkbox icon with Liquid
Also optimize list padding start
1 parent e48d66e commit 1fd665b

File tree

6 files changed

+26
-28
lines changed

6 files changed

+26
-28
lines changed

_includes/refactor-content.html

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,15 @@
3131
%}
3232
{% endif %}
3333

34-
<!-- Add attribute 'hide-bullet' to the checkbox list -->
35-
36-
{% if _content contains '<li class="task-list-item"><' %}
34+
<!-- Change the icon of checkbox -->
35+
{% if _content contains '<input type="checkbox"' %}
3736
{% assign _content = _content
38-
| replace: '"task-list-item"><', '"task-list-item" hide-bullet><'
37+
| replace:
38+
'<input type="checkbox" class="task-list-item-checkbox" disabled="disabled" checked="checked" />',
39+
'<i class="fas fa-check-circle fa-fw checked"></i>'
40+
| replace:
41+
'<input type="checkbox" class="task-list-item-checkbox" disabled="disabled" />',
42+
'<i class="far fa-circle fa-fw"></i>'
3943
%}
4044
{% endif %}
4145

_javascript/utils/checkbox.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

_sass/addon/commons.scss

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -468,31 +468,39 @@ img[data-src] {
468468

469469
li {
470470
margin: 0.25rem 0;
471-
padding-left: 0.4rem;
471+
padding-left: 0.25rem;
472472
}
473473

474474
ol,
475475
ul {
476-
-webkit-padding-start: 1.25rem;
477-
padding-inline-start: 1.25rem;
476+
-webkit-padding-start: 1rem;
477+
padding-inline-start: 1rem;
478478
margin: 0.5rem 0;
479479
}
480480
}
481481

482-
ul {
483-
/* attribute 'hide-bullet' was added by liquid */
484-
.task-list-item[hide-bullet] {
482+
ul.task-list {
483+
-webkit-padding-start: 1.25rem;
484+
padding-inline-start: 1.25rem;
485+
486+
li {
485487
list-style-type: none;
488+
padding-left: 0;
486489

487490
> i { /* checkbox icon */
488-
margin: 0 0.5rem 0.2rem -1.4rem;
489-
vertical-align: middle;
491+
width: 2rem;
492+
margin-left: -1.25rem;
490493
color: var(--checkbox-color);
491494

492495
&.checked {
493496
color: var(--checkbox-checked-color);
494497
}
495498
}
499+
500+
ul {
501+
-webkit-padding-start: 1.75rem;
502+
padding-inline-start: 1.75rem;
503+
}
496504
}
497505

498506
input[type="checkbox"] {

assets/js/dist/page.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)