Skip to content

Commit

Permalink
feat(plugins/mpa): switch active tab by ux
Browse files Browse the repository at this point in the history
  • Loading branch information
NWYLZW committed Nov 14, 2023
1 parent a0abcd7 commit 8a8e7b9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/src/plugins/mpa/topbar/Files.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useTabs } from '../atoms'
const prefix = 'mpa__topbar__files'

export const Files: React.ComponentType<BarItemProps> = () => {
const { tabs, addTab, removeTabs } = useTabs()
const { tabs, addTab, setActiveTab, removeTabs } = useTabs()
const addOnlyOnce = useRef(false)
useEffect(() => {
if (addOnlyOnce.current) return
Expand All @@ -25,6 +25,7 @@ export const Files: React.ComponentType<BarItemProps> = () => {
{tabs.map(tab => <div
key={tab.id}
className={classnames(`${prefix}-tab`, { active: tab.id === activeTabId })}
onClick={() => setActiveTab(tab.id)}
>
{tab.icon && <span className={`cldr codicon codicon-${tab.icon}`} />}
{tab.title}
Expand Down

0 comments on commit 8a8e7b9

Please sign in to comment.