react-treebeard
react-treebeard copied to clipboard
parent background color
How to I control the background color of the top parent only?
Some one anyone?
I think you need to add a decorator.
Something like this (semi pseudo code):
in custom-decorators.js
import { decorators } from 'react-treebeard';
function HeaderDecorator(props) {
const { style, node, ...restProps } = props;
let newStyle = style;
if (node.isTopParrent) { // <-- your condition to recognize the parent node
newStyle = {
...style,
// override the relevant props
};
}
return <decorators.Header style={newStyle} node={node} {...restProps} />;
}
export default {
...decorators,
Header: HeaderDecorator,
};
in your component.js
import customDecorators from './sustom_decorators';
//
render() {
return (
<Treebeard
// data and other things
decorators={customDecorators}
/>
);
}
//