[Question] Remove onToggle from file nodes?
ivanQuantox opened this issue · 1 comments
ivanQuantox commented
Describe the question
Is there a way to remove Toggle arrow from nodes which are files, ive spend a day trying to to so but no success.
This is what i got so far:
decorators.Header = (props) => {
console.log(props)
const style = props.style;
const iconType = props.node.state.disabled ? 'folder' : 'file-text';
const iconClass = `fa fa-${iconType}`;
const iconStyle = { marginRight: '5px' };
return (
<div style={style.base}>
<div style={style.title}>
<i className={iconClass} style={iconStyle}/>
{props.node.name}
</div>
</div>
);
};
decorators.Toggle = ({style}) => {
return (
<div style={style.base}>
<div style={style.wrapper}>
<i className="fa fa-plus align-top"></i>
</div>
</div>
);
};
return (
<Treebeard
data={this.state.data}
onToggle={this.onToggle}
decorators={decorators}
style={{
tree: {
base: { backgroundColor: "white" },
node: {
activeLink: { color: "brown", background: "white" }
}
}
}}
/>
);
}
ivanQuantox commented
Fixed, for those who is wondering how to:
Files can not have children
property if you want to disable arrow toggle.