1
1
mirror of https://github.com/primer/css.git synced 2024-12-26 07:35:04 +03:00
css/packages/primer-avatars
broccolini ac04bdf755 Publish
- primer-alerts@1.1.3-monotest.0
 - primer-avatars@0.4.7-monotest.0
 - primer-base@1.0.1-monotest.0
 - primer-blankslate@0.3.6-monotest.0
 - primer-box@2.1.3-monotest.0
 - primer-breadcrumb@0.1.2-monotest.0
 - primer-buttons@2.0.1-monotest.0
 - primer-cards@0.1.3-monotest.0
 - primer-core@3.0.1-monotest.0
 - primer-css@6.0.1-monotest.0
 - primer-forms@1.0.7-monotest.0
 - primer-labels@1.1.1-monotest.0
 - primer-layout@0.3.3-monotest.0
 - primer-markdown@3.3.8-monotest.0
 - primer-marketing-type@0.2.1-monotest.0
 - primer-marketing-utilities@0.1.5-monotest.0
 - primer-marketing@3.0.1-monotest.0
 - primer-navigation@1.0.1-monotest.0
 - primer-page-headers@0.1.2-monotest.0
 - primer-page-sections@0.1.2-monotest.0
 - primer-product@3.0.1-monotest.0
 - primer-support@4.0.1-monotest.0
 - primer-table-object@1.0.4-monotest.0
 - primer-tables@0.1.3-monotest.0
 - primer-tooltips@0.5.5-monotest.0
 - primer-truncate@0.3.3-monotest.0
 - primer-utilities@4.2.5-monotest.0
2017-06-11 12:06:11 -04:00
..
lib rename modules to packages for lerna setup 2017-05-11 16:12:29 -04:00
.gitignore update git ignore so npm logs don't get committed 2017-06-04 18:13:16 -04:00
.npmignore rename modules to packages for lerna setup 2017-05-11 16:12:29 -04:00
.postcss.json rename modules to packages for lerna setup 2017-05-11 16:12:29 -04:00
.stylelintrc.json rename modules to packages for lerna setup 2017-05-11 16:12:29 -04:00
CHANGELOG.md rename modules to packages for lerna setup 2017-05-11 16:12:29 -04:00
index.scss rename modules to packages for lerna setup 2017-05-11 16:12:29 -04:00
LICENSE rename modules to packages for lerna setup 2017-05-11 16:12:29 -04:00
package.json Publish 2017-06-11 12:06:11 -04:00
README.md rename modules to packages for lerna setup 2017-05-11 16:12:29 -04:00

Primer CSS Avatars

NPM version Build Status

Avatars are images that users can set as their profile picture. On GitHub, theyre always going to be rounded squares. They can be custom photos, uploaded by users, or generated as Identicons as a placeholder.

This repository is a module of the full primer-css repository.

Install

This repository is distributed with npm. After installing npm, you can install primer-avatars with this command.

$ npm install --save primer-avatars

Usage

The source files included are written in Sass (scss) You can simply point your sass include-path at your node_modules directory and import it like this.

@import "primer-avatars/index.scss";

You can also import specific portions of the module by importing those partials from the /lib/ folder. Make sure you import any requirements along with the modules.

Build

For a compiled css version of this module, a npm script is included that will output a css version to build/build.css The built css file is also included in the npm package.

$ npm run build

Documentation

Avatars are images that users can set as their profile picture. On GitHub, they're always going to be rounded squares. They can be custom photos, uploaded by users, or generated as Identicons as a placeholder.

{:toc}

Basic example

Add .avatar to any <img> element to make it an avatar. This resets some key styles for alignment, address a Firefox image placeholder bug, and rounds the corners.

Be sure to set width and height attributes for maximum browser performance.

<img class="avatar" alt="jonrohan" src="/jonrohan.png?v=3&s=144" width="72" height="72">

Small avatars

We occasionally use smaller avatars. Anything less than 48px wide should include the .avatar-small modifier class to reset the border-radius to a more appropriate level.

<img class="avatar avatar-small" alt="jonrohan" src="/jonrohan.png?v=3&s=64" width="32" height="32">

Parent-child avatars

When you need a larger parent avatar, and a smaller child one, overlaid slightly, use the parent-child classes.

<div class="avatar-parent-child float-left">
  <img class="avatar" alt="jonrohan" src="/jonrohan.png?v=3&s=96" width="48" height="48">
  <img class="avatar avatar-child" alt="josh" src="/josh.png?v=3&s=40" width="20" height="20">
</div>

Avatar stack

Stacked avatars can be used to show who is participating in thread when there is limited space available. When you hover over the stack, the avatars will reveal themselves. Optimally, you should put no more than 3 avatars in the stack.

<span class="avatar-stack tooltipped tooltipped-s" aria-label="jonrohan, aaronshekey, and josh">
  <img alt="@jonrohan" class="avatar" height="39" alt="jonrohan" src="/jonrohan.png" width="39">
  <img alt="@aaronshekey" class="avatar" height="39" alt="aaronshekey" src="/aaronshekey.png" width="39">
  <img alt="@josh" class="avatar" height="39" alt="josh" src="/josh.png" width="39">
</span>

Circle Badge

.CircleBadge allows for the display of badge-like icons or logos. They are used mostly with Octicons or partner integration icons.

.CircleBadge should have an aria-label, title (for a link), or an alt (for child img elements) attribute specified if there is no text-based alternative to describe it. If there is a text-based alternative or the icon has no semantic value, aria-hidden="true" or an empty alt attribute may be used.

Small

<a class="CircleBadge CircleBadge--small float-left mr-2" href="#small" title="Travis CI">
  <img src="<%= image_path "modules/site/travis-logo.png" %>"  class="CircleBadge-icon" alt="">
</a>
<a class="CircleBadge CircleBadge--small bg-yellow" title="Zap this!" href="#small">
  <%= octicon "zap",  :class => "CircleBadge-icon text-white" %>
</a>

Medium

<div class="CircleBadge CircleBadge--medium bg-gray-dark">
    <img src="<%= image_path "modules/site/travis-logo.png" %>"  alt="Travis CI" class="CircleBadge-icon">
</div>

Large

<div class="CircleBadge CircleBadge--large">
  <img src="<%= image_path "modules/site/travis-logo.png" %>"  alt="Travis CI" class="CircleBadge-icon">
</div>

Dashed connection

For specific cases where two badges or more need to be shown as related or connected (such as integrations or specific product workflows), a DashedConnection class was created. Use utility classes to ensure badges are spaced correctly.

<div class="DashedConnection">
  <ul class="d-flex list-style-none flex-justify-between" aria-label="A sample GitHub workflow">
    <li class="CircleBadge CircleBadge--small" aria-label="GitHub">
      <%= octicon "mark-github", :class => "width-full height-full" %>
    </li>

    <li class="CircleBadge CircleBadge--small" aria-label="Slack">
        <img src="<%= image_path "modules/site/logos/slack-logo.png" %>"  alt="" class="CircleBadge-icon">
    </li>

    <li class="CircleBadge CircleBadge--small" aria-label="Travis CI">
        <img src="<%= image_path "modules/site/travis-logo.png" %>"  alt="" class="CircleBadge-icon">
    </li>
  </ul>
</div>

License

MIT © GitHub