shrub/pkg/interface/webterm/Tabs.tsx
tomholford 50d120e3c1 devex: address PR feedback
- move App#initSessions definition outside function component closure
- enhance useAddSessions performance
2022-04-11 12:05:25 -07:00

27 lines
620 B
TypeScript

import React from 'react';
import useTermState from './state';
import { Tab } from './Tab';
import { useAddSession } from './lib/useAddSession';
import { Icon } from '@tlon/indigo-react';
export const Tabs = () => {
const { sessions, names } = useTermState();
const addSession = useAddSession();
return (
<div className="tabs">
{names.map((n, i) => {
return (
<Tab session={sessions[n]} name={n} key={i} />
);
})}
<button className="tab" onClick={addSession}>
<Icon
icon="Plus"
size="18px"
/>
</button>
</div>
);
};