<button class="icon-button icon-button--twitter" id="icon-button-a31e" type="button">
<svg class="icon icon--twitter" id="icon-47ef" viewBox="0 0 200 200" role="img" aria-labelledby="title-icon-47ef">
  <title id="title-icon-47ef">Twitter</title>
  <use xlink:href="#icon-twitter"></use>
</svg>
</button>
-
  //- Prepare attr object
  attr = attr || {};
  attr.class = classList(attr.class);
  attr.id = id || attr.id || `icon-button-${randomString()}`;

  //- Tag
  tag = link ? 'a' : 'button';

  //- Process options
  if (modifier) attr.class.push(`icon-button--${modifier}`);
  if (color) attr.class.push(`icon-button--${color}`);

  if (link) {
    attr.href = link;
  } else {
    attr.type = submit ? 'submit' : 'button';
  }

//- Render atom
#{tag}.icon-button&attributes(attr)
  != include('@icon', {icon, title: title})
{
  "icon": "twitter",
  "color": "twitter",
  "title": "Twitter"
}
  • Content:
    // Icon button settings
    $default-icon-button-size: 4.5rem;
    
    // Default icon button
    .icon-button {
      background-color: $color-steelgrey-dark;
      border-radius: 50%;
      color: #fff;
      cursor: pointer;
      display: inline-block;
      font-size: 2rem;
      height: $default-icon-button-size;
      line-height: $default-icon-button-size;
      padding: 0;
      text-align: center;
      text-decoration: none;
      transition-duration: $default-transition-duration;
      transition-property: background-color;
      user-select: none;
      width: $default-icon-button-size;
    
      // If buttons are grouped, add some spacing between them
      & + & {
        margin-left: $spacer;
      }
    
      // Default focus, hover
      &:hover,
      &:focus {
        background-color: $color-steelgrey-xdark;
      }
    }
    
    // Functional
    .icon-button--functional {
      border-radius: 0;
    }
    
    // Colors
    $default-icon-button-colors: (
      red: ($color-red, $color-red-dark),
      blue: $color-blue,
      facebook: #3b5998,
      twitter: #1da1f2,
      youtube: #cd201f,
      xing: #026466,
      google-plus: #dd4b39,
      instagram: #405de6,
      linkedin: #2867b2,
    );
    
    @each $name, $color in $default-icon-button-colors {
      .icon-button--#{$name} {
        @if type-of($color) == list {
          background-color: nth($color, 1);
        } @else {
          background-color: $color;
        }
    
        &:hover,
        &:focus {
          @if type-of($color) == list {
            background-color: nth($color, 2);
          } @else {
            background-color: darken($color, 5%);
          }
        }
      }
    }
    
  • URL: /components/raw/icon-button/icon-button.scss
  • Filesystem Path: src/components/molecules/icon-button/icon-button.scss
  • Size: 1.4 KB

There are no notes for this item.