mirror of
https://github.com/urbit/shrub.git
synced 2024-12-24 03:14:30 +03:00
50d120e3c1
- move App#initSessions definition outside function component closure - enhance useAddSessions performance
27 lines
620 B
TypeScript
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>
|
|
);
|
|
};
|