Allow background-color and border-style to be set on Graph config#429
Allow background-color and border-style to be set on Graph config#429henri-edinb wants to merge 2 commits intodanielcaldas:masterfrom henri-edinb:master
Conversation
| const svgStyle = { | ||
| height: this.state.config.height, | ||
| width: this.state.config.width, | ||
| 'background-color': this.state.config.backgroundColor, |
There was a problem hiding this comment.
We could potentially expose the full object style and simply spread it on the svgStyle. What do you think about this? @LonelyPrincess @antoninklopp @terahn?
My suggestion would be something like a style object at the root config level this.state.config.style, that we could simply feed to the svgStyle.
// I would just keep width/height segregated into their own props for retro-compatibility purposes
const svgStyle = {
height: this.state.config.height,
width: this.state.config.width,
...this.state.config.style,
};There was a problem hiding this comment.
I think that this is definitely something that the configuration could provide
There was a problem hiding this comment.
What do you think, @henri-edinb? Are you up to do the change? This would be a much more meaningful contribution. Clients will be able to pass in any style to apply to the background.
There was a problem hiding this comment.
to be honest Im quite new to react so Im not sure exactly what needs to be done. setting
const svgStyle = { height: this.state.config.height, width: this.state.config.width, ...this.state.config.style, };
would do it? or is there other adjustments needed?
There was a problem hiding this comment.
I'm not able to give the proper guidance at the moment @henri-edinb. If someone can chime in please feel free to help @antoninklopp. What we're looking at here is:
- Add a new config object
config.stylewhich is an optional Object. By default, it should be empty in the default graph config. - After that, we can perform the change that Henri is mentioning, spreading the
styleobject on thesvgStyle. - Adjustments in the
Sandbox.jsmight be required, I might be able to help with that later on
Very specific solution for issue #428. Not really sure if it will work but seems reasonable. Maybe a more general solution would be to have the whole style object in config?