-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
19 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,31 @@ | ||
import './Files.scss' | ||
|
||
import type { ReactNode } from 'react' | ||
import { useState } from 'react' | ||
|
||
import type { BarItemProps } from '../..' | ||
|
||
const prefix = 'mpa__topbar__files' | ||
|
||
interface Tab { | ||
id: string | ||
icon?: string | ReactNode | ||
title: ReactNode | ||
} | ||
|
||
export const Files: React.ComponentType<BarItemProps> = () => { | ||
const [tabs, setTabs] = useState<Tab[]>([ | ||
{ id: 'index.ts', title: 'index.ts', icon: 'file' }, | ||
{ id: 'index.spec.ts', title: 'index.spec.ts', icon: 'beaker' } | ||
]) | ||
return <div className={prefix}> | ||
<div className={`${prefix}-tab active`}> | ||
<span className='cldr codicon codicon-file' /> | ||
index.ts | ||
<span className='cldr codicon codicon-close' /> | ||
</div> | ||
<div className={`${prefix}-tab`}> | ||
<span className='cldr codicon codicon-file' /> | ||
index.spec.ts | ||
{tabs.map(tab => <div className={`${prefix}-tab`} key={tab.id}> | ||
{tab.icon && typeof tab.icon === 'string' | ||
? <span className={`cldr codicon codicon-${tab.icon}`} /> | ||
: tab.icon} | ||
{tab.title} | ||
<span className='cldr codicon codicon-close' /> | ||
</div> | ||
</div>)} | ||
<div className={`${prefix}-full`} /> | ||
</div> | ||
} |