From 262f659c6f32697bb43769c8fd2bfdaafa85a092 Mon Sep 17 00:00:00 2001 From: Abhas Bhattacharya Date: Mon, 2 Jul 2018 10:41:33 +0530 Subject: [PATCH] Support styles with default style done --- TODO | 2 +- src/grid-area.tsx | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index f483f55..895b700 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -1. Support styles and colors +1. [X] Support styles with default style 2. Support setting both horizontal and vertical gridareas 3. Support events 4. Remove unwanted sample ts files diff --git a/src/grid-area.tsx b/src/grid-area.tsx index 7da5d14..66ef279 100644 --- a/src/grid-area.tsx +++ b/src/grid-area.tsx @@ -63,15 +63,20 @@ class GridArea extends PureComponent { static requiresSVG = true; + static defaultStyle = { + fill: 'rgba(0,0,0,0.25)' + } + render() { const { innerWidth: width, innerHeight: height, marginTop: top, marginLeft: left, - style } = this.props; + const style = {...GridArea.defaultStyle, ...this.props.style}; + const isVertical = (this.props.direction === Direction.VERTICAL); const tickXAttr = isVertical ? 'y' : 'x'; const tickYAttr = isVertical ? 'x' : 'y';