mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-06-13 11:01:03 +00:00
isAlternative (#308)
This commit is contained in:
@@ -7,7 +7,7 @@ import generate from './polkadotIcon';
|
||||
describe('polkadotIcon', (): void => {
|
||||
it('generates the correct points from known', (): void => {
|
||||
expect(
|
||||
generate('5Dqvi1p4C7EhPPFKCixpF3QiaJEaDwWrR9gfWR5eUsfC39TX')
|
||||
generate('5Dqvi1p4C7EhPPFKCixpF3QiaJEaDwWrR9gfWR5eUsfC39TX', { isSixPoint: false })
|
||||
).toEqual([
|
||||
{ cx: 32, cy: 32, fill: '#eee', r: 32 },
|
||||
{ cx: 32, cy: 8, fill: 'hsl(196, 65%, 53%)', r: 5 },
|
||||
|
||||
@@ -7,13 +7,12 @@
|
||||
//
|
||||
// https://github.com/paritytech/oo7/blob/251ba2b7c45503b68eab4320c270b5afa9bccb60/packages/polkadot-identicon/src/index.jsx
|
||||
|
||||
import { Circle } from './types';
|
||||
|
||||
import { blake2AsU8a, decodeAddress } from '@polkadot/util-crypto';
|
||||
|
||||
export interface Circle {
|
||||
cx: number;
|
||||
cy: number;
|
||||
fill: string;
|
||||
r: number;
|
||||
interface Options {
|
||||
isSixPoint: boolean;
|
||||
}
|
||||
|
||||
interface Scheme {
|
||||
@@ -134,9 +133,9 @@ function getColors (address: string): string[] {
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Generate a array of the circles that make up an indenticon
|
||||
* @description Generate a array of the circles that make up an identicon
|
||||
*/
|
||||
export default function generate (address: string, isSixPoint = false): Circle[] {
|
||||
export default function generate (address: string, { isSixPoint }: Options): Circle[] {
|
||||
const colors = getColors(address);
|
||||
|
||||
return [OUTER_CIRCLE].concat(
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// Copyright 2018 @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 interface Circle {
|
||||
cx: number;
|
||||
cy: number;
|
||||
fill: string;
|
||||
r: number;
|
||||
}
|
||||
Reference in New Issue
Block a user