diff --git a/public/icons/list-bowtie-dark.svg b/public/icons/list-bowtie-dark.svg new file mode 100644 index 00000000..8fd7a40a --- /dev/null +++ b/public/icons/list-bowtie-dark.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/public/icons/list-bowtie-light.svg b/public/icons/list-bowtie-light.svg new file mode 100644 index 00000000..597d56e4 --- /dev/null +++ b/public/icons/list-bowtie-light.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/styles/markdown/lists.scss b/src/styles/markdown/lists.scss new file mode 100644 index 00000000..cd3457cd --- /dev/null +++ b/src/styles/markdown/lists.scss @@ -0,0 +1,29 @@ +@import "src/tokens/index"; + +:root { + --list_margin: var(--spc-4x); + --list_padding-start: var(--spc-1x); + + // should match public/icons/list-bowtie-*.svg + --list_bowtie_size: 16px; + + --list_item_padding-start: var(--spc-3x); + --list_item_padding-vertical: var(--spc-1x); +} + +.post-body ul { + list-style-type: none; + margin: var(--list-margin) 0; + padding: calc(var(--list_item_padding-vertical) / 2) 0; + padding-left: var(--list_padding-start); + + &> li { + background: url('/icons/list-bowtie-light.svg') no-repeat 0 center; + padding: calc(var(--list_item_padding-vertical) / 2) 0; + padding-left: calc(var(--list_bowtie_size) + var(--list_item_padding-start)); + + @include darkTheme { + background: url('/icons/list-bowtie-dark.svg') no-repeat 0 center; + } + } +} diff --git a/src/styles/post-body.scss b/src/styles/post-body.scss index 572775fd..67e54033 100644 --- a/src/styles/post-body.scss +++ b/src/styles/post-body.scss @@ -158,5 +158,6 @@ } @import "src/styles/markdown/hints"; +@import "src/styles/markdown/lists"; @import "src/styles/markdown/table"; @import "src/styles/markdown/tooltips"; diff --git a/src/tokens/_utils.scss b/src/tokens/_utils.scss index 3ef25b77..65a3ed33 100644 --- a/src/tokens/_utils.scss +++ b/src/tokens/_utils.scss @@ -13,7 +13,11 @@ } @mixin darkTheme() { - :global(html.dark) &, :global(body.dark) &, :global(.darkTheme) & { + // these need to be defined separately because :global does not work outside of CSS modules + html.dark & { + @content; + } + :global(html.dark) & { @content; } }