mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-05-30 22:11:03 +00:00
Bump dev (incl. eslint fixes) (#302)
* Bump dev (incl. eslint fixes) * Ordering fixes
This commit is contained in:
@@ -16,6 +16,16 @@ interface Data {
|
||||
* @description Demo component
|
||||
*/
|
||||
const Demo = Vue.extend({
|
||||
components: {
|
||||
Identicon
|
||||
},
|
||||
data: function (): Data {
|
||||
return {
|
||||
address: '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY',
|
||||
size: 128
|
||||
};
|
||||
},
|
||||
name: 'Demo',
|
||||
template: `
|
||||
<div id="demo">
|
||||
<Identicon :size="size" :theme="'polkadot'" :value="address" />
|
||||
@@ -23,17 +33,7 @@ const Demo = Vue.extend({
|
||||
<Identicon :size="size" :theme="'beachball'" :value="address" />
|
||||
<Identicon :size="size" :theme="'empty'" />
|
||||
</div>
|
||||
`,
|
||||
name: 'Demo',
|
||||
data: function (): Data {
|
||||
return {
|
||||
address: '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY',
|
||||
size: 128
|
||||
};
|
||||
},
|
||||
components: {
|
||||
Identicon
|
||||
}
|
||||
`
|
||||
});
|
||||
|
||||
new Vue({
|
||||
|
||||
@@ -46,6 +46,38 @@ function encodeAccount (value: string | Uint8Array, prefix?: Prefix): Account {
|
||||
* ```
|
||||
*/
|
||||
export const Identicon = Vue.extend({
|
||||
components: {
|
||||
Beachball,
|
||||
Empty,
|
||||
Jdenticon,
|
||||
Polkadot
|
||||
},
|
||||
created: function (): void {
|
||||
this.createData();
|
||||
},
|
||||
data: function (): Data {
|
||||
return {
|
||||
address: '',
|
||||
iconSize: DEFAULT_SIZE,
|
||||
publicKey: '0x',
|
||||
type: 'empty'
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
createData: function (): void {
|
||||
this.iconSize = this.size || DEFAULT_SIZE;
|
||||
this.type = this.theme;
|
||||
|
||||
this.recodeAddress();
|
||||
},
|
||||
recodeAddress: function (): void {
|
||||
const { address, publicKey } = encodeAccount(this.value);
|
||||
|
||||
this.address = address;
|
||||
this.publicKey = publicKey;
|
||||
}
|
||||
},
|
||||
props: ['prefix', 'size', 'theme', 'value'],
|
||||
// FIXME These nested divs are not correct, would like a different way
|
||||
// here so we don't create a div wrapped for the div wrapper of the icon
|
||||
template: `
|
||||
@@ -62,38 +94,6 @@ export const Identicon = Vue.extend({
|
||||
<Jdenticon :key="address" :publicKey="publicKey" :size="iconSize" />
|
||||
</div>
|
||||
`,
|
||||
props: ['prefix', 'size', 'theme', 'value'],
|
||||
components: {
|
||||
Beachball,
|
||||
Empty,
|
||||
Jdenticon,
|
||||
Polkadot
|
||||
},
|
||||
data: function (): Data {
|
||||
return {
|
||||
address: '',
|
||||
iconSize: DEFAULT_SIZE,
|
||||
publicKey: '0x',
|
||||
type: 'empty'
|
||||
};
|
||||
},
|
||||
created: function (): void {
|
||||
this.createData();
|
||||
},
|
||||
methods: {
|
||||
createData: function (): void {
|
||||
this.iconSize = this.size || DEFAULT_SIZE;
|
||||
this.type = this.theme;
|
||||
|
||||
this.recodeAddress();
|
||||
},
|
||||
recodeAddress: function (): void {
|
||||
const { address, publicKey } = encodeAccount(this.value);
|
||||
|
||||
this.address = address;
|
||||
this.publicKey = publicKey;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value: function (): void {
|
||||
this.recodeAddress();
|
||||
|
||||
@@ -14,21 +14,21 @@ interface Data {
|
||||
* @description The Beachball identicon
|
||||
*/
|
||||
export const Beachball = Vue.extend({
|
||||
// eslint-disable-next-line quotes
|
||||
template: `<div v-html="html" />`,
|
||||
props: ['address', 'size'],
|
||||
created: function (): void {
|
||||
this.createHtml();
|
||||
},
|
||||
data: function (): Data {
|
||||
return {
|
||||
// eslint-disable-next-line quotes
|
||||
html: `<div />`
|
||||
};
|
||||
},
|
||||
created: function (): void {
|
||||
this.createHtml();
|
||||
},
|
||||
methods: {
|
||||
createHtml: function (): void {
|
||||
this.html = generate(this.address, this.size).outerHTML;
|
||||
}
|
||||
}
|
||||
},
|
||||
props: ['address', 'size'],
|
||||
// eslint-disable-next-line quotes
|
||||
template: `<div v-html="html" />`
|
||||
});
|
||||
|
||||
@@ -9,10 +9,10 @@ import Vue from 'vue';
|
||||
* @description An empty identicon
|
||||
*/
|
||||
export const Empty = Vue.extend({
|
||||
props: ['size'],
|
||||
template: `
|
||||
<svg :height="size" :width="size" viewBox="0 0 64 64">
|
||||
<circle cx="50%" cy="50%" fill="#eee" r="50%" />
|
||||
</svg>
|
||||
`,
|
||||
props: ['size']
|
||||
`
|
||||
});
|
||||
|
||||
@@ -14,21 +14,21 @@ interface Data {
|
||||
* @description The substrate default via Jdenticon
|
||||
*/
|
||||
export const Jdenticon = Vue.extend({
|
||||
// eslint-disable-next-line quotes
|
||||
template: `<div v-html="svgHtml" />`,
|
||||
props: ['publicKey', 'size'],
|
||||
created: function (): void {
|
||||
this.createSvgHtml();
|
||||
},
|
||||
data: function (): Data {
|
||||
return {
|
||||
// eslint-disable-next-line quotes
|
||||
svgHtml: `<svg viewBox="0 0 64 64" />`
|
||||
};
|
||||
},
|
||||
created: function (): void {
|
||||
this.createSvgHtml();
|
||||
},
|
||||
methods: {
|
||||
createSvgHtml: function (): void {
|
||||
this.svgHtml = jdenticon.toSvg(this.publicKey.substr(2), this.size);
|
||||
}
|
||||
}
|
||||
},
|
||||
props: ['publicKey', 'size'],
|
||||
// eslint-disable-next-line quotes
|
||||
template: `<div v-html="svgHtml" />`
|
||||
});
|
||||
|
||||
@@ -14,18 +14,15 @@ interface Data {
|
||||
* @description The Polkadot default identicon
|
||||
*/
|
||||
export const Polkadot = Vue.extend({
|
||||
// eslint-disable-next-line quotes
|
||||
template: `<div v-html="svgHtml" />`,
|
||||
props: ['address', 'size'],
|
||||
created: function (): void {
|
||||
this.createSvgHtml();
|
||||
},
|
||||
data: function (): Data {
|
||||
return {
|
||||
// eslint-disable-next-line quotes
|
||||
svgHtml: `<svg viewBox="0 0 64 64" />`
|
||||
};
|
||||
},
|
||||
created: function (): void {
|
||||
this.createSvgHtml();
|
||||
},
|
||||
methods: {
|
||||
createSvgHtml: function (): void {
|
||||
const circles = generateIcon(this.address).map(({ cx, cy, fill, r }): string =>
|
||||
@@ -34,5 +31,8 @@ export const Polkadot = Vue.extend({
|
||||
|
||||
this.svgHtml = `<svg height=${this.size} viewBox='0 0 64 64' width=${this.size}>${circles}</svg>`;
|
||||
}
|
||||
}
|
||||
},
|
||||
props: ['address', 'size'],
|
||||
// eslint-disable-next-line quotes
|
||||
template: `<div v-html="svgHtml" />`
|
||||
});
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
@@ -14,32 +13,32 @@ module.exports = {
|
||||
devtool: isProd ? 'source-map' : 'cheap-eval-source-map',
|
||||
entry: './src/Demo.ts',
|
||||
mode: ENV,
|
||||
output: {
|
||||
path: path.join(__dirname, 'build'),
|
||||
filename: './demo.js'
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@polkadot/ui-shared': path.resolve(__dirname, '../ui-shared/build')
|
||||
},
|
||||
extensions: ['.js', '.ts']
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(js|ts)$/,
|
||||
exclude: /(node_modules)/,
|
||||
test: /\.(js|ts)$/,
|
||||
use: [
|
||||
'babel-loader'
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.vue$/,
|
||||
loader: 'vue-loader'
|
||||
loader: 'vue-loader',
|
||||
test: /\.vue$/
|
||||
}
|
||||
]
|
||||
},
|
||||
output: {
|
||||
filename: './demo.js',
|
||||
path: path.join(__dirname, 'build')
|
||||
},
|
||||
plugins: [
|
||||
new VueLoaderPlugin()
|
||||
]
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@polkadot/ui-shared': path.resolve(__dirname, '../ui-shared/build')
|
||||
},
|
||||
extensions: ['.js', '.ts']
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user