const assert = require('assert')
const html = require('bel')

// create a circular avatar
// (obj?) -> obj
module.exports = function (opts) {
  opts = opts || {}

  const src = opts.src || ''
  const cls = opts.class || ''
  const size = opts.size || 3

  assert.equal(typeof opts, 'object', 'base-elements/avatar: opts should be an object')
  assert.equal(typeof src, 'string', 'base-elements/avatar: src should be a string')
  assert.equal(typeof cls, 'string', 'base-elements/avatar: cls should be a string')
  assert.equal(typeof size, 'number', 'base-elements/avatar: size should be a number')
  assert.ok(size >= 1 && size <= 5, 'base-elements/avatar: size should be >= 1 && <= 5')

  const clx = 'br-100 w' + size + ' ' + cls

  return html`<img src=${src} class=${clx}></img>`
}

@@ -245,16 +245,52 @@
 ize %7C%7C 3
+%0A  const radius = opts.radius %7C%7C 100
 %0A%0A  asse
@@ -716,16 +716,109 @@
 & %3C= 5')
+%0A  assert.ok(radius %3E= 0 && size %3C= 4, 'base-elements/avatar: radius should be %3E= 0 && %3C= 4')
 %0A%0A  cons
@@ -830,15 +830,8 @@
  = '
-br-100 
 w' +
@@ -843,16 +843,37 @@
  + ' ' +
+ 'br' + radius + '' +
  cls%0A%0A  

add border radius option