storybook-eol / react-treebeard

React Tree View Component. Data-Driven, Fast, Efficient and Customisable.
http://storybooks.github.io/react-treebeard
MIT License
1.69k stars 294 forks source link

How to Pass nodes in custom toggle decorater #243

Open 24thdiv opened 4 years ago

24thdiv commented 4 years ago

I have custom Toggle create which has by default style props only. How can I pass nodes in this props?

const TreeToggle = props => {
  const { style } = props;
  console.log("toggle", props);
  const { height, width } = style;
  const midHeight = height * 0.5;
  const points = `0,0 0,${height} ${width},${midHeight}`;

  return (
    <div style={style.base} onClick={props.onClick}>
      <svg {...{ height, width }}>
        <Polygon points={points} style={style.arrow} />
      </svg>
    </div>
  );
};

export default TreeToggle;

Here I need to access node also.