Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/node-renderer-default.css
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
}

.rst__rowContents,
.rst__rowIcon,
.rst__rowLabel,
.rst__rowToolbar,
.rst__moveHandle,
Expand All @@ -85,7 +86,7 @@
flex: 1 0 auto;
display: flex;
align-items: center;
justify-content: space-between;
/*justify-content: space-between;*/
background-color: white;
}

Expand All @@ -104,6 +105,13 @@
border-left: solid #bbb 1px;
}

.rst__rowIcon {
padding-right: 8px;
}
.rst__rowIcon img {
vertical-align: middle;
}

.rst__rowLabel {
flex: 0 1 auto;
padding-right: 20px;
Expand Down
10 changes: 10 additions & 0 deletions src/node-renderer-default.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class NodeRendererDefault extends Component {
node,
title,
subtitle,
icon,
draggedNode,
path,
treeIndex,
Expand All @@ -34,6 +35,7 @@ class NodeRendererDefault extends Component {
} = this.props;
const nodeTitle = title || node.title;
const nodeSubtitle = subtitle || node.subtitle;
const nodeIcon = icon || node.icon;
const rowDirectionClass = rowDirection === 'rtl' ? 'rst__rtl' : null;

let handle;
Expand Down Expand Up @@ -132,6 +134,12 @@ class NodeRendererDefault extends Component {
rowDirectionClass
)}
>
{nodeIcon && (
<div className={classnames('rst__rowIcon', rowDirectionClass)}>
<img alt="icon here" src={nodeIcon} />
</div>
)}

<div className={classnames('rst__rowLabel', rowDirectionClass)}>
<span
className={classnames(
Expand Down Expand Up @@ -193,13 +201,15 @@ NodeRendererDefault.defaultProps = {
canDrop: false,
title: null,
subtitle: null,
icon: null,
rowDirection: 'ltr',
};

NodeRendererDefault.propTypes = {
node: PropTypes.shape({}).isRequired,
title: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
subtitle: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
icon: PropTypes.string,
path: PropTypes.arrayOf(
PropTypes.oneOfType([PropTypes.string, PropTypes.number])
).isRequired,
Expand Down
Loading