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
1 changed files with 3 additions and 2 deletions

View File

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