From ee04742d1f0645908baa30e47845126c28848f50 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Tue, 3 May 2022 16:53:55 +0200 Subject: chore: add a CV page --- src/components/atoms/links/link.module.scss | 87 +++++++++++++++++++++++++++-- src/components/atoms/links/link.stories.tsx | 20 ++++++- src/components/atoms/links/link.tsx | 18 +++++- 3 files changed, 117 insertions(+), 8 deletions(-) (limited to 'src/components/atoms') diff --git a/src/components/atoms/links/link.module.scss b/src/components/atoms/links/link.module.scss index d23667a..1b89727 100644 --- a/src/components/atoms/links/link.module.scss +++ b/src/components/atoms/links/link.module.scss @@ -5,23 +5,64 @@ &[hreflang] { &::after { display: inline-block; + /* Prettier is removing spacing between content parts. */ + /* prettier-ignore */ content: "\0000a0[" attr(hreflang) "]"; font-size: var(--font-size-sm); } } + &--download { + &::after { + display: inline-block; + + /* 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( + '' +)); + } + } + } + &--external { &::after { display: inline-block; + /* 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('')); } @@ -29,18 +70,56 @@ &[hreflang] { &::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( '' - )); +)); } &: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( '' - )); +)); + } + } + } + + &--external#{&}--download { + &::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('')); } } } diff --git a/src/components/atoms/links/link.stories.tsx b/src/components/atoms/links/link.stories.tsx index c3b3465..420eafe 100644 --- a/src/components/atoms/links/link.stories.tsx +++ b/src/components/atoms/links/link.stories.tsx @@ -31,14 +31,29 @@ export default { required: false, }, }, - external: { + download: { control: { type: 'boolean', }, + description: 'Determine if the link purpose is to download a file.', table: { category: 'Options', + defaultValue: { summary: false }, + }, + type: { + name: 'boolean', + required: false, + }, + }, + external: { + control: { + type: 'boolean', }, description: 'Determine if the link is external of the current website.', + table: { + category: 'Options', + defaultValue: { summary: false }, + }, type: { name: 'boolean', required: false, @@ -79,6 +94,7 @@ export const Default = Template.bind({}); Default.args = { children: 'A link', href: '#', + download: false, external: false, }; @@ -89,6 +105,7 @@ export const External = Template.bind({}); External.args = { children: 'A link', href: '#', + download: false, external: true, }; @@ -99,6 +116,7 @@ export const ExternalWithLang = Template.bind({}); ExternalWithLang.args = { children: 'A link', href: '#', + download: false, external: true, lang: 'en', }; diff --git a/src/components/atoms/links/link.tsx b/src/components/atoms/links/link.tsx index 674c07b..c8ba273 100644 --- a/src/components/atoms/links/link.tsx +++ b/src/components/atoms/links/link.tsx @@ -11,6 +11,10 @@ export type LinkProps = { * Set additional classnames to the link. */ className?: string; + /** + * True if it is a download link. Default: false. + */ + download?: boolean; /** * True if it is an external link. Default: false. */ @@ -33,21 +37,29 @@ export type LinkProps = { const Link: FC = ({ children, className = '', + download = false, + external = false, href, lang, - external = false, }) => { + const downloadClass = download ? styles['link--download'] : ''; + return external ? ( {children} ) : ( - {children} + + {children} + ); }; -- cgit v1.2.3