Skip to content

Commit

Permalink
use new icons on right panel
Browse files Browse the repository at this point in the history
  • Loading branch information
kfarr committed Jan 17, 2025
1 parent 4b099b2 commit c8660e6
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 19 deletions.
50 changes: 31 additions & 19 deletions src/editor/components/components/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ import {
ManagedStreetIcon,
AutoIcon,
ManualIcon,
ArrowLeftHookIcon
ArrowLeftHookIcon,
VideoCameraIcon,
GeospatialIcon,
LayersIcon,
SunIcon
} from '../../icons';
import GeoSidebar from './GeoSidebar';
import EnviroSidebar from './EnviroSidebar';
Expand All @@ -39,6 +43,28 @@ export default class Sidebar extends React.Component {
};
}

getEntityIcon = (entity) => {
if (entity.getAttribute('managed-street')) {
return <ManagedStreetIcon />;
}
if (entity.getAttribute('street-segment')) {
return <SegmentIcon />;
}

switch (entity.id) {
case 'environment':
return <SunIcon />;
case 'reference-layers':
return <GeospatialIcon />;
case 'street-container':
return <LayersIcon />;
case 'cameraRig':
return <VideoCameraIcon />;
default:
return <Object24Icon />;
}
};

getParentComponentName = (entity) => {
const componentName = entity.getAttribute('data-parent-component');
const parentEntity = entity.parentElement;
Expand Down Expand Up @@ -119,17 +145,9 @@ export default class Sidebar extends React.Component {
{this.state.showSideBar ? (
<>
<div id="layers-title" onClick={this.toggleRightBar}>
<div className={'layersBlock'}>
<div style={{ width: '32px', height: '32px' }}>
{entity.getAttribute('managed-street') ? (
<ManagedStreetIcon
style={{ width: '100%', height: '100%' }}
/>
) : entity.getAttribute('street-segment') ? (
<SegmentIcon style={{ width: '100%', height: '100%' }} />
) : (
<Object24Icon style={{ width: '100%', height: '100%' }} />
)}
<div className="layersBlock">
<div className="icon-container">
{this.getEntityIcon(entity)}
</div>
<span>{entityName || formattedMixin}</span>
</div>
Expand Down Expand Up @@ -252,13 +270,7 @@ export default class Sidebar extends React.Component {
{entityName || formattedMixin}
</span>
<div className="relative z-10">
{entity.getAttribute('managed-street') ? (
<ManagedStreetIcon />
) : entity.getAttribute('street-segment') ? (
<SegmentIcon />
) : (
<Object24Icon />
)}
{this.getEntityIcon(entity)}
</div>
</div>
</div>
Expand Down
13 changes: 13 additions & 0 deletions src/editor/style/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,19 @@ body.aframe-inspector-opened {
background-color: variables.$purple-200;
}

.icon-container {
min-width: 24px;
min-height: 24px;
display: flex; // This helps with centering
align-items: center;
justify-content: center;

svg {
min-width: 24px;
min-height: 24px;
}
}

.layersBlock {
padding-left: 20px;
display: flex;
Expand Down

0 comments on commit c8660e6

Please sign in to comment.