Skip to content

Instantly share code, notes, and snippets.

@MatthieuScarset
Last active July 17, 2023 14:56
Show Gist options
  • Save MatthieuScarset/397da3b000ce6d9523dd50f525eabaf0 to your computer and use it in GitHub Desktop.
Save MatthieuScarset/397da3b000ce6d9523dd50f525eabaf0 to your computer and use it in GitHub Desktop.

Revisions

  1. MatthieuScarset revised this gist Jul 17, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion fullclick.scss
    Original file line number Diff line number Diff line change
    @@ -23,7 +23,7 @@
    /// </a>
    /// </div>

    @mixin fullclick($element: 'a', $wrapper: '>') {
    @mixin fullclick($element: 'a', $wrapper: '') {
    position: relative;

    & #{$wrapper} #{$element}:first-of-type:before {
  2. MatthieuScarset revised this gist Jul 17, 2023. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions fullclick.scss
    Original file line number Diff line number Diff line change
    @@ -23,10 +23,10 @@
    /// </a>
    /// </div>

    @mixin fullclick($element: 'a', $wrapper: '') {
    @mixin fullclick($element: 'a', $wrapper: '>') {
    position: relative;

    & > #{$wrapper} #{$element}:first-of-type:before {
    & #{$wrapper} #{$element}:first-of-type:before {
    display: block;
    content: '';
    position: absolute;
    @@ -45,5 +45,5 @@

    // Example: a div with multiple buttons.
    .node--view-mode--teaser {
    @include fullclick('.button--readmore', '.actions');
    @include fullclick('.button--readmore', '> .actions');
    }
  3. MatthieuScarset revised this gist Jul 17, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion fullclick.scss
    Original file line number Diff line number Diff line change
    @@ -45,5 +45,5 @@

    // Example: a div with multiple buttons.
    .node--view-mode--teaser {
    @include fullclick('.button--readmore', 'actions');
    @include fullclick('.button--readmore', '.actions');
    }
  4. MatthieuScarset revised this gist Apr 25, 2022. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion fullclick.scss
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,9 @@
    /// Make element fully-clickable.
    /// @author Matthieu Scarset
    /// @param $wrapper
    /// @param string $element
    /// (optional) The button element which should get the click. Default: 'a'.
    /// @param string $wrapper
    /// (optional) The element's HTML wrapper(s), useful if convoluted markup. Default: empty string.
    /// @link https://gist.github.com/MatthieuScarset/397da3b000ce6d9523dd50f525eabaf0
    ///
    /// @example Simple card div with the link directly inside.
  5. MatthieuScarset revised this gist Apr 25, 2022. 1 changed file with 8 additions and 2 deletions.
    10 changes: 8 additions & 2 deletions fullclick.scss
    Original file line number Diff line number Diff line change
    @@ -4,14 +4,14 @@
    /// @link https://gist.github.com/MatthieuScarset/397da3b000ce6d9523dd50f525eabaf0
    ///
    /// @example Simple card div with the link directly inside.
    /// <div class="fullclick node node--view-mode--teaser">
    /// <div class="fullclick">
    /// <h2>I am a title</h2>
    /// <p>I am a description and you should read me.</p>
    /// <a href="https://matthieuscarset.com">Click me somewhere on this card</a>
    /// </div>
    ///
    /// @example Card div with multiple links.
    /// <div class="fullclick node node--view-mode--teaser">
    /// <div class="node node--view-mode--teaser">
    /// <h2>I am a title</h2>
    /// <p>I am a description and you should read me.</p>
    /// <div class="actions">
    @@ -35,6 +35,12 @@
    }
    }

    // Utility CSS class.
    .fullclick {
    @include fullclick;
    }

    // Example: a div with multiple buttons.
    .node--view-mode--teaser {
    @include fullclick('.button--readmore', 'actions');
    }
  6. MatthieuScarset revised this gist Apr 25, 2022. 1 changed file with 17 additions and 5 deletions.
    22 changes: 17 additions & 5 deletions fullclick.scss
    Original file line number Diff line number Diff line change
    @@ -1,16 +1,29 @@
    /// Make element fully-clickable.
    /// @author Matthieu Scarset
    /// @param $wrapper
    /// @link https://gist.github.com/MatthieuScarset/397da3b000ce6d9523dd50f525eabaf0
    /// @example
    ///
    /// @example Simple card div with the link directly inside.
    /// <div class="fullclick node node--view-mode--teaser">
    /// <h2>I am a title</h2>
    /// <p>I am a description and you should read me.</p>
    /// <a href="https://matthieuscarset.com">Click me somewhere on this card</a>
    /// </div>
    @mixin fullclick {
    ///
    /// @example Card div with multiple links.
    /// <div class="fullclick node node--view-mode--teaser">
    /// <h2>I am a title</h2>
    /// <p>I am a description and you should read me.</p>
    /// <div class="actions">
    /// <a class="button button--share" href="#">Share</a>
    /// <a class="button button--readmore" href="https://matthieuscarset.com">Read more</a>
    /// </a>
    /// </div>

    @mixin fullclick($element: 'a', $wrapper: '') {
    position: relative;

    &>a:first-of-type:before {
    & > #{$wrapper} #{$element}:first-of-type:before {
    display: block;
    content: '';
    position: absolute;
    @@ -22,7 +35,6 @@
    }
    }

    // Use this class somewhere else in your stylesheets.
    .fullclick {
    @include fullclick;
    }
    }
  7. MatthieuScarset revised this gist Apr 25, 2022. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions fullclick.scss
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,12 @@
    /// SCSS - Make element fully-clickable.
    /// Make element fully-clickable.
    /// @author Matthieu Scarset
    /// @link https://gist.github.com/MatthieuScarset/397da3b000ce6d9523dd50f525eabaf0
    /// @code
    /// @example
    /// <div class="fullclick node node--view-mode--teaser">
    /// <h2>I am a title</h2>
    /// <p>I am a description and you should read me.</p>
    /// <a href="https://matthieuscarset.com">Click me somewhere on this card</a>
    /// </div>
    /// @endcode
    @mixin fullclick {
    position: relative;

    @@ -23,6 +22,7 @@
    }
    }

    // Use this class somewhere else in your stylesheets.
    .fullclick {
    @include fullclick;
    }
  8. MatthieuScarset revised this gist Apr 25, 2022. 1 changed file with 10 additions and 3 deletions.
    13 changes: 10 additions & 3 deletions fullclick.scss
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,17 @@
    /// Make an element fully clickable.
    /// SCSS - Make element fully-clickable.
    /// @author Matthieu Scarset
    /// @see https://matthieuscarset.com
    /// @link https://gist.github.com/MatthieuScarset/397da3b000ce6d9523dd50f525eabaf0
    /// @code
    /// <div class="fullclick node node--view-mode--teaser">
    /// <h2>I am a title</h2>
    /// <p>I am a description and you should read me.</p>
    /// <a href="https://matthieuscarset.com">Click me somewhere on this card</a>
    /// </div>
    /// @endcode
    @mixin fullclick {
    position: relative;

    & > a:first-of-type:before {
    &>a:first-of-type:before {
    display: block;
    content: '';
    position: absolute;
  9. MatthieuScarset created this gist Apr 25, 2022.
    21 changes: 21 additions & 0 deletions fullclick.scss
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    /// Make an element fully clickable.
    /// @author Matthieu Scarset
    /// @see https://matthieuscarset.com
    @mixin fullclick {
    position: relative;

    & > a:first-of-type:before {
    display: block;
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    margin: auto;
    }
    }

    .fullclick {
    @include fullclick;
    }