diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-01-08 19:34:18 +0100 | 
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-01-08 19:34:18 +0100 | 
| commit | d738152a59d2ef8f476b16789ba386dc57ff2211 (patch) | |
| tree | 5ed6e82114e50006ba2e3183d00dfbb0fffd746e /src/components/PostFooter | |
| parent | 118f2225e991fad2872e1073eeccb8dbcdd5334d (diff) | |
refactor: improve button-like links styles
The goal was to replace the "read more articles about" links with
button-like links to keep a certain consistence between buttons.
The hasIcon variable was useless so I update some components and
especially the back to top link.
Diffstat (limited to 'src/components/PostFooter')
| -rw-r--r-- | src/components/PostFooter/PostFooter.module.scss | 40 | ||||
| -rw-r--r-- | src/components/PostFooter/PostFooter.tsx | 27 | 
2 files changed, 17 insertions, 50 deletions
| diff --git a/src/components/PostFooter/PostFooter.module.scss b/src/components/PostFooter/PostFooter.module.scss index a34269f..7c1f1ce 100644 --- a/src/components/PostFooter/PostFooter.module.scss +++ b/src/components/PostFooter/PostFooter.module.scss @@ -7,44 +7,12 @@  .list {    @extend %flex-list; -} -.item { -  &:not(:last-child) { -    margin-right: var(--spacing-2xs); -  } +  gap: var(--spacing-xs);  } -.link { -  display: flex; -  align-items: center; -  gap: var(--spacing-2xs); -  padding: fun.convert-px(3) var(--spacing-xs); -  position: relative; -  background: linear-gradient( -      to right, -      var(--color-primary) 50%, -      var(--color-bg) 50% -    ) -    100% 0 / 210% 100%; -  border: fun.convert-px(2) solid var(--color-primary); -  border-radius: fun.convert-px(5); -  box-shadow: fun.convert-px(1) fun.convert-px(1) fun.convert-px(2) 0 -    var(--color-shadow-light); -  font-weight: 600; -  text-decoration: none; -  transition: all 0.5s ease-in-out 0s, color 0.5s ease-in-out 0s; - -  &:hover, -  &:focus { -    background-position: 0 0; -    color: var(--color-fg-inverted); -    transition: all 0.4s ease-in-out 0s, color 0.3s ease-in-out 0.1s; -  } - -  &:active { -    background-position: 100% 0; -    border-color: var(--color-primary-dark); -    color: var(--color-primary-dark); +.item { +  > a { +    padding: calc(var(--spacing-2xs) / 2) var(--spacing-xs);    }  } diff --git a/src/components/PostFooter/PostFooter.tsx b/src/components/PostFooter/PostFooter.tsx index fe933d7..06e86bc 100644 --- a/src/components/PostFooter/PostFooter.tsx +++ b/src/components/PostFooter/PostFooter.tsx @@ -1,3 +1,4 @@ +import { ButtonLink } from '@components/Buttons';  import { t } from '@lingui/macro';  import { SubjectPreview } from '@ts/types/taxonomies';  import Image from 'next/image'; @@ -9,20 +10,18 @@ const PostFooter = ({ subjects }: { subjects: SubjectPreview[] }) => {      return subjects.map((subject) => {        return (          <li className={styles.item} key={subject.id}> -          <Link href={`/sujet/${subject.slug}`}> -            <a className={styles.link}> -              {subject.featuredImage && ( -                <Image -                  src={subject.featuredImage.sourceUrl} -                  alt={subject.featuredImage.altText} -                  layout="intrinsic" -                  width="20" -                  height="20" -                /> -              )} -              {subject.title} -            </a> -          </Link> +          <ButtonLink target={`/sujet/${subject.slug}`}> +            {subject.featuredImage && ( +              <Image +                src={subject.featuredImage.sourceUrl} +                alt={subject.featuredImage.altText} +                layout="intrinsic" +                width="20" +                height="20" +              /> +            )} +            {subject.title} +          </ButtonLink>          </li>        );      }); | 
