Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

[Question] Remove onToggle from file nodes? #260

Closed
ivanQuantox opened this issue Sep 8, 2022 · 1 comment
Closed

[Question] Remove onToggle from file nodes? #260

ivanQuantox opened this issue Sep 8, 2022 · 1 comment
Labels

Comments

@ivanQuantox
Copy link

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 ivanQuantox added the bug label Sep 8, 2022
@ivanQuantox
Copy link
Author

Fixed, for those who is wondering how to:

Files can not have children property if you want to disable arrow toggle.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

1 participant