<button class="icon-button icon-button--blue" id="icon-button-309f" type="button">
<svg class="icon icon--user" id="icon-1416" viewBox="0 0 200 200" role="img" aria-labelledby="title-icon-1416">
  <title id="title-icon-1416">Ein Icon mit Text</title>
  <use xlink:href="#icon-user"></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": "user",
  "color": "blue",
  "title": "Ein Icon mit Text"
}
  • 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.