From 0f8f963ba3eccd7fd94785bf7fb216b6287cec57 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Sun, 22 May 2022 19:26:45 +0200 Subject: chore: adjust dark mode styles --- src/components/atoms/icons/plus-minus.stories.tsx | 2 +- src/components/atoms/links/link.module.scss | 158 +++++++++++++++++----- src/components/atoms/links/link.stories.tsx | 58 ++++++++ src/components/molecules/layout/card.tsx | 2 +- src/components/molecules/layout/code.module.scss | 2 + src/styles/pages/partials/_article-links.scss | 100 ++++++++++++++ 6 files changed, 288 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/components/atoms/icons/plus-minus.stories.tsx b/src/components/atoms/icons/plus-minus.stories.tsx index f7e55f8..eebf1e5 100644 --- a/src/components/atoms/icons/plus-minus.stories.tsx +++ b/src/components/atoms/icons/plus-minus.stories.tsx @@ -24,9 +24,9 @@ export default { state: { control: { type: 'radio', - options: ['plus', 'minus'], }, description: 'Which state should be displayed.', + options: ['plus', 'minus'], type: { name: 'enum', required: true, diff --git a/src/components/atoms/links/link.module.scss b/src/components/atoms/links/link.module.scss index 1b89727..bb5775f 100644 --- a/src/components/atoms/links/link.module.scss +++ b/src/components/atoms/links/link.module.scss @@ -1,6 +1,7 @@ @use "@styles/abstracts/functions" as fun; @use "@styles/abstracts/variables" as var; +/* stylelint-disable no-descending-specificity */ .link { &[hreflang] { &::after { @@ -21,20 +22,14 @@ /* Prettier is removing spacing between content parts. */ /* prettier-ignore */ - content: "\0000a0" url( -fun.encode-svg( - '' -)); + content: "\0000a0" url(fun.encode-svg('')); } &:focus:not(:active)::after { /* Prettier is removing spacing between content parts. */ /* prettier-ignore */ - content: "\0000a0" url( -fun.encode-svg( - '' -)); + content: "\0000a0" url(fun.encode-svg('')); } &[hreflang] { @@ -42,10 +37,14 @@ fun.encode-svg( /* Prettier is removing spacing between content parts. */ /* prettier-ignore */ - content: "\0000a0[" attr(hreflang) "]\0000a0" url( -fun.encode-svg( - '' -)); + content: "\0000a0[" attr(hreflang) "]\0000a0" url(fun.encode-svg('')); + } + + &:focus:not(:active)::after { + /* Prettier is removing spacing between content parts. */ + + /* prettier-ignore */ + content: "\0000a0[" attr(hreflang) "]\0000a0" url(fun.encode-svg('')); } } } @@ -72,20 +71,14 @@ fun.encode-svg( /* Prettier is removing spacing between content parts. */ /* prettier-ignore */ - content: "\0000a0[" attr(hreflang) "]\0000a0" url( -fun.encode-svg( - '' -)); + content: "\0000a0[" attr(hreflang) "]\0000a0" url(fun.encode-svg('')); } &:focus:not(:active)::after { /* Prettier is removing spacing between content parts. */ /* prettier-ignore */ - content: "\0000a0[" attr(hreflang) "]\0000a0" url( -fun.encode-svg( - '' -)); + content: "\0000a0[" attr(hreflang) "]\0000a0" url(fun.encode-svg('')); } } } @@ -95,10 +88,14 @@ fun.encode-svg( /* Prettier is removing spacing between content parts. */ /* prettier-ignore */ - content: "\0000a0" url( -fun.encode-svg( - '' -)) "\0000a0" url(fun.encode-svg('')); + content: "\0000a0" url(fun.encode-svg('')) "\0000a0" url(fun.encode-svg('')); + } + + &:focus:not(:active)::after { + /* Prettier is removing spacing between content parts. */ + + /* prettier-ignore */ + content: "\0000a0" url(fun.encode-svg('')) "\0000a0" url(fun.encode-svg('')); } &[hreflang] { @@ -106,21 +103,118 @@ fun.encode-svg( /* Prettier is removing spacing between content parts. */ /* prettier-ignore */ - content: "\0000a0[" attr(hreflang) "]\0000a0" url( -fun.encode-svg( - '' -)) "\0000a0" url(fun.encode-svg('')); + content: "\0000a0[" attr(hreflang) "]\0000a0" url(fun.encode-svg('')) "\0000a0" url(fun.encode-svg('')); } &:focus:not(:active)::after { /* Prettier is removing spacing between content parts. */ /* prettier-ignore */ - content: "\0000a0[" attr(hreflang) "]\0000a0" url( -fun.encode-svg( - '' -)) "\0000a0" url(fun.encode-svg('')); + content: "\0000a0[" attr(hreflang) "]\0000a0" url(fun.encode-svg('')) "\0000a0" url(fun.encode-svg('')); + } + } + } +} + +:global([data-theme="dark"]) { + :local { + .link { + &--download { + &::after { + /* Prettier is removing spacing between content parts. */ + + /* prettier-ignore */ + content: "\0000a0" url(fun.encode-svg('')); + } + + &:focus:not(:active)::after { + /* Prettier is removing spacing between content parts. */ + + /* prettier-ignore */ + content: "\0000a0" url(fun.encode-svg('')); + } + + &[hreflang] { + &::after { + /* Prettier is removing spacing between content parts. */ + + /* prettier-ignore */ + content: "\0000a0[" attr(hreflang) "]\0000a0" url(fun.encode-svg('')); + } + + &:focus:not(:active)::after { + /* Prettier is removing spacing between content parts. */ + + /* prettier-ignore */ + content: "\0000a0[" attr(hreflang) "]\0000a0" url(fun.encode-svg('')); + } + } + } + + &--external { + &::after { + /* Prettier is removing spacing between content parts. */ + + /* prettier-ignore */ + content: "\0000a0" url(fun.encode-svg('')); + } + + &:focus:not(:active)::after { + /* Prettier is removing spacing between content parts. */ + + /* prettier-ignore */ + content: "\0000a0" url(fun.encode-svg('')); + } + + &[hreflang] { + &::after { + /* Prettier is removing spacing between content parts. */ + + /* prettier-ignore */ + content: "\0000a0[" attr(hreflang) "]\0000a0" url(fun.encode-svg('')); + } + + &:focus:not(:active)::after { + /* Prettier is removing spacing between content parts. */ + + /* prettier-ignore */ + content: "\0000a0[" attr(hreflang) "]\0000a0" url(fun.encode-svg('')); + } + } + } + + &--external.link--download { + &::after { + /* Prettier is removing spacing between content parts. */ + + /* prettier-ignore */ + content: "\0000a0" url(fun.encode-svg('')) "\0000a0" url(fun.encode-svg('')); + } + + &:focus:not(:active)::after { + /* Prettier is removing spacing between content parts. */ + + /* prettier-ignore */ + content: "\0000a0" url(fun.encode-svg('')) "\0000a0" url(fun.encode-svg('')); + } + + &[hreflang] { + &::after { + /* Prettier is removing spacing between content parts. */ + + /* prettier-ignore */ + content: "\0000a0[" attr(hreflang) "]\0000a0" url(fun.encode-svg('')) "\0000a0" url(fun.encode-svg('')); + } + + &:focus:not(:active)::after { + /* Prettier is removing spacing between content parts. */ + + /* prettier-ignore */ + content: "\0000a0[" attr(hreflang) "]\0000a0" url(fun.encode-svg('')) "\0000a0" url(fun.encode-svg('')); + } + } } } } } +/* stylelint-enable no-descending-specificity */ diff --git a/src/components/atoms/links/link.stories.tsx b/src/components/atoms/links/link.stories.tsx index 420eafe..4baabe5 100644 --- a/src/components/atoms/links/link.stories.tsx +++ b/src/components/atoms/links/link.stories.tsx @@ -98,6 +98,29 @@ Default.args = { external: false, }; +/** + * Links Stories - Download + */ +export const Download = Template.bind({}); +Download.args = { + children: 'A link to a file', + href: '#', + download: true, + external: false, +}; + +/** + * Links Stories - DownloadWithLang + */ +export const DownloadWithLang = Template.bind({}); +DownloadWithLang.args = { + children: 'A link to a file', + href: '#', + download: true, + external: false, + lang: 'en', +}; + /** * Links Stories - External */ @@ -109,6 +132,17 @@ External.args = { external: true, }; +/** + * Links Stories - External download + */ +export const ExternalDownload = Template.bind({}); +ExternalDownload.args = { + children: 'A link', + href: '#', + download: true, + external: true, +}; + /** * Links Stories - External With Lang */ @@ -120,3 +154,27 @@ ExternalWithLang.args = { external: true, lang: 'en', }; + +/** + * Links Stories - External download with lang + */ +export const ExternalDownloadWithLang = Template.bind({}); +ExternalDownloadWithLang.args = { + children: 'A link', + href: '#', + download: true, + external: true, + lang: 'en', +}; + +/** + * Links Stories - With Lang + */ +export const WithLang = Template.bind({}); +WithLang.args = { + children: 'A link', + href: '#', + download: false, + external: false, + lang: 'en', +}; diff --git a/src/components/molecules/layout/card.tsx b/src/components/molecules/layout/card.tsx index 003060f..e465f76 100644 --- a/src/components/molecules/layout/card.tsx +++ b/src/components/molecules/layout/card.tsx @@ -95,7 +95,7 @@ const Card: FC = ({ {title} -
{tagline}
+ {tagline &&
{tagline}
} {meta && (