Skip to content

Commit

Permalink
move HEXAGON_CLIP_PATH to AddressInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
nibhar committed Feb 27, 2019
1 parent 167acc0 commit 486f89f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
17 changes: 14 additions & 3 deletions src/components/AddressInfo.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
/* global Constants */
/* global Identicon */

class AddressInfo { // eslint-disable-line no-unused-vars
class AddressInfo {
/**
* @param {{ userFriendlyAddress: string, label: string?, imageUrl: URL?, accountLabel: string?}} addressInfo
*/
constructor(addressInfo) {
if (addressInfo.imageUrl && !document.getElementById('nimiq-rounded-hexagon')) {
document.body.insertAdjacentHTML('beforeend', Constants.HEXAGON_CLIP_PATH);
document.body.insertAdjacentHTML('beforeend', AddressInfo.HEXAGON_CLIP_PATH);
}
this._addressInfo = addressInfo;
}
Expand Down Expand Up @@ -69,3 +68,15 @@ class AddressInfo { // eslint-disable-line no-unused-vars
}
}
}

/* eslint-disable max-len */
AddressInfo.HEXAGON_CLIP_PATH = `
<svg width="0" height="0" viewBox="0 0 146 146">
<defs>
<clipPath id="nimiq-rounded-hexagon" clipPathUnits="objectBoundingBox">
<path d="M.302.055A.106.106 0 0 0 .21.108l-.196.34a.106.106 0 0 0 0 .105l.196.34a.106.106 0 0 0 .092.052h.392c.038 0 .073-.02.092-.053l.196-.34a.106.106 0 0 0 0-.105L.786.107A.106.106 0 0 0 .694.056z">
</path>
</clipPath>
</defs>
</svg>`;
/* eslint-enable max-len */
11 changes: 0 additions & 11 deletions src/lib/Constants.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
const Constants = { // eslint-disable-line no-unused-vars
MIN_WIDTH_FOR_AUTOFOCUS: 600,
/* eslint-disable max-len */
HEXAGON_CLIP_PATH: `
<svg width="0" height="0" viewBox="0 0 146 146">
<defs>
<clipPath id="nimiq-rounded-hexagon" clipPathUnits="objectBoundingBox">
<path d="M.302.055A.106.106 0 0 0 .21.108l-.196.34a.106.106 0 0 0 0 .105l.196.34a.106.106 0 0 0 .092.052h.392c.038 0 .073-.02.092-.053l.196-.34a.106.106 0 0 0 0-.105L.786.107A.106.106 0 0 0 .694.056z">
</path>
</clipPath>
</defs>
</svg>`,
/* eslint-enable max-len */
NETWORK: {
TEST: 'test',
MAIN: 'main',
Expand Down

0 comments on commit 486f89f

Please sign in to comment.