1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

fix: assign viewBox property to svg waves (#1247)

This commit is contained in:
Luca Milanese 2022-03-24 13:11:41 +01:00 committed by GitHub
parent 61d60fd173
commit 300b5b9ef3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@ import { randomIntFromInterval } from './numbers'
export interface WaveProperties { export interface WaveProperties {
width?: number width?: number
height?: number height?: number
viewBox?: string
color?: string color?: string
fill?: boolean fill?: boolean
layerCount?: number layerCount?: number
@ -53,6 +54,7 @@ export class SvgWaves {
return { return {
width: 99, width: 99,
height: 99, height: 99,
viewBox: '0 0 99 99',
color: WaveColors.Pink, color: WaveColors.Pink,
fill: true, fill: true,
layerCount: 4, layerCount: 4,
@ -107,8 +109,7 @@ export class SvgWaves {
generateSvg(): Element { generateSvg(): Element {
const svg = document.createElementNS(SvgWaves.xmlns, 'svg') const svg = document.createElementNS(SvgWaves.xmlns, 'svg')
svg.setAttribute('width', this.properties.width.toString()) svg.setAttribute('viewBox', this.properties.viewBox.toString())
svg.setAttribute('height', this.properties.height.toString())
svg.setAttribute('fill', this.properties.fill ? undefined : 'transparent') svg.setAttribute('fill', this.properties.fill ? undefined : 'transparent')
svg.setAttribute('xmlns', SvgWaves.xmlns) svg.setAttribute('xmlns', SvgWaves.xmlns)