joyent-portal/ui/src/components/avatar
Sérgio Ramos 5e21ff1e64 add icons to ui (#347)
fixes #282
fixes #297
fixes #333

Not only adds icons (as svgs) but also removes the assets folder which adds some
side effects:
 - move fonts to it's own component (currently only exposing libre-franlin)
 - Base.global requires fonts and injects them
 - update webpack and babelrc to ignore/include that new folder

Having to deal with those side effects, I took the opportunity to add some
improvements:
 - rename "regular" to "normal" which conforms to the font-weight rule options
 - apply family and weight to buttons (which default to system-ui)
 - replace all font-weight to use the typography composer
 - only use "Libra Franklin" as the family name, using weight to vary between
 files
2017-03-03 15:29:03 +00:00
..
index.js add icons to ui (#347) 2017-03-03 15:29:03 +00:00
readme.md changing props name to be more consistant 2016-10-28 12:47:58 +01:00
story.js convert commonjs to es2015 modules (fixes #234) 2017-02-23 15:09:27 +00:00

<Avatar>

demo

const React = require('react');
const ReactDOM = require('react-dom/server');
const Base = require('../base');
const Container = require('../container');
const Row = require('../row');
const Column = require('../column');
const Avatar = require('./index.js');
const styles = require('./style.css');

nmodule.exports = ReactDOM.renderToString(
  <Base>
    <Row>
      <Column>
        <Avatar color='#35a8c0' name='Alex' />
      </Column>
      <Column>
        <Avatar color='#ef6176' name='Alex' src='https://openclipart.org/image/2400px/svg_to_png/177482/ProfilePlaceholderSuit.png' />
      </Column>
    </Row>
  </Base>
);

usage

const React = require('react');
const Avatar = require('ui/avatar');

module.exports = () => {
  return (
    <Avatar color='#35a8c0' name='Alex' />
    <Avatar color='#ef6176' name='Alex' src='path/to/image.png' />
  );
}