Sha256: 6e35c5ca3718b312c3c81ab17a8b406972cc5cf4743004de0694fb0a19949afe

Contents?: true

Size: 972 Bytes

Versions: 7

Compression:

Stored size: 972 Bytes

Contents

.truncator {
  // content is clamped to 3 lines unless expanded
  .content {
    overflow: hidden;
    display: -webkit-box;
    text-overflow: ellipsis;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  &.expanded .content {
    display: initial;
  }

  // safari truncation fix
  .content > * {
    margin: 0;
  }

  // expand/collapse toggle is only shown if content is truncated
  button {
    display: none;
  }

  &.truncated button {
    display: inline-block;
  }

  // "view more"/"view less" text swaps when content is expanded
  .view-more {
    color: shade-color($link-color, 20%);
    display: inline;
  }

  .view-less {
    color: shade-color($link-color, 20%);
    display: none;
  }

  &.expanded {
    .view-more {
      display: none;
    }

    .view-less {
      display: inline;
    }
  }

  // icon rotates when content is expanded
  .icon::before {
    content: "▶";
  }

  &.expanded .icon::before {
    content: "▼";
  }
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
arclight-1.4.0 app/assets/stylesheets/arclight/modules/truncator.scss
arclight-1.3.0 app/assets/stylesheets/arclight/modules/truncator.scss
arclight-1.2.0 app/assets/stylesheets/arclight/modules/truncator.scss
arclight-1.1.3 app/assets/stylesheets/arclight/modules/truncator.scss
arclight-1.1.2 app/assets/stylesheets/arclight/modules/truncator.scss
arclight-1.1.1 app/assets/stylesheets/arclight/modules/truncator.scss
arclight-1.1.0 app/assets/stylesheets/arclight/modules/truncator.scss