Skip to content

Commit

Permalink
minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
rjct committed Oct 23, 2023
1 parent 9858803 commit 6484a96
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions src/components/editor/EditorModeSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,24 @@ export const EditorModeSelector = React.memo(function EditorModeSelector() {
return (
<div className={"ui-tabs"}>
<div className={"ui-tabs-nav"}>
{Object.entries(EditorModes)
.filter(([_key, mode]) => mode.tab)
.map(([key, value]) => {
const isActive = editorMode === key;

return (
<Tab
key={key}
id={`editor-mode-${key}`}
value={key}
active={isActive}
disabled={isActive}
title={value.text}
onSelect={handleEditorModeChange}
>
<FontAwesomeIcon icon={value.icon} />
</Tab>
);
})}
{Object.entries(EditorModes).map(([key, mode]) => {
if (!mode.tab) return null;
const isActive = editorMode === key;

return (
<Tab
key={key}
id={`editor-mode-${key}`}
value={key}
active={isActive}
disabled={isActive}
title={mode.text}
onSelect={handleEditorModeChange}
>
<FontAwesomeIcon icon={mode.icon} />
</Tab>
);
})}
</div>

{uiState.editorMode === "terrain" ? (
Expand Down

0 comments on commit 6484a96

Please sign in to comment.