Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #68 from 3DStreet/issue#51
Browse files Browse the repository at this point in the history
fix: logic for entity display name on properties panel
  • Loading branch information
kfarr authored Nov 18, 2022
2 parents dc56bb2 + 49d2122 commit 80d4a46
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions src/components/components/Sidebar.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';
import PropTypes from 'prop-types';
import ComponentsContainer from './ComponentsContainer';
import Events from '../../lib/Events';
import PropTypes from 'prop-types';
import React from 'react';
import { capitalize } from 'lodash';
import classnames from 'classnames';

export default class Sidebar extends React.Component {
Expand All @@ -12,8 +13,8 @@ export default class Sidebar extends React.Component {

constructor(props) {
super(props);
this.state = {
open: false ,
this.state = {
open: false,
rightBarHide: false
};
}
Expand All @@ -30,8 +31,8 @@ export default class Sidebar extends React.Component {

// additional toggle for hide/show panel by clicking the button
toggleRightBar = () => {
this.setState({ rightBarHide: !this.state.rightBarHide});
}
this.setState({ rightBarHide: !this.state.rightBarHide });
};

handleToggle = () => {
this.setState({ open: !this.state.open });
Expand All @@ -49,17 +50,17 @@ export default class Sidebar extends React.Component {

if (entity && visible) {
const entityName = entity.getDOMAttribute('data-layer-name');
const entityMixin = entity.getDOMAttribute('mixin');
const formattedMixin = entityMixin
? capitalize(entityMixin.replaceAll('-', ' ').replaceAll('_', ' '))
: null;

return (
<div id="sidebar" className={className}>
<div id="entity-name"
onClick={this.toggleRightBar}
>
<span>{entityName}</span>
<div
id="toggle-rightbar"
>
</div>
</div>
<div id="entity-name" onClick={this.toggleRightBar}>
<span>{entityName || formattedMixin}</span>
<div id="toggle-rightbar" />
</div>
<ComponentsContainer entity={entity} />
</div>
);
Expand Down

0 comments on commit 80d4a46

Please sign in to comment.