Files
pezkuwi-ui/packages/ui-shared/src/beachballIcon/container.ts
T
Jaco Greeff 85a8a3a0ee Add vue-identicon (#178)
* Add vue-identicon

* Remove generated file

* Add links to reactnative & vue identicons

* Update package.json

* Update Jdenticon.vue

* Update Polkadot.vue

* Move deps around

* Empty on error

* Build to build

* ... typo

* Fix vue-identicon doc generation

* Ok, I give up... vuepress and vue packages, no luck

* Swap to TypeScript components (aligning with polkadot-js)

* Expand template with build

* Adjust vue examples

* debump gh-pages dep

* Expand doc. desc.

* Fix vuepress docs generation

* Address CC complexity

* eslint fix (babel config)

* Add Bechball
2019-08-06 13:15:10 +02:00

28 lines
902 B
TypeScript

// Copyright 2016 Dan Finlay
// Copyright 2017-2019 @polkadot/ui-shared authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
export default function container (diameter: number, background: string = 'white', className: string = '', _style: { [index: string]: string } = {}): HTMLElement {
const element = document.createElement('div');
const style = Object.assign({
background,
borderRadius: `${diameter / 2}px`,
display: 'inline-block',
height: `${diameter}px`,
margin: '0px',
overflow: 'hidden',
padding: '0px',
width: `${diameter}px`
}, _style);
element.className = className;
element.style.background = background;
Object.keys(style).forEach((key: unknown): void => {
element.style[key as number] = style[key as number];
});
return element;
}