(props: TabsProps)
| 12 | } |
| 13 | |
| 14 | export const Tabs = (props: TabsProps) => { |
| 15 | const styles = createStyles() |
| 16 | const { state, setState } = createDevtoolsState() |
| 17 | const pipWindow = createPiPWindow() |
| 18 | const handleDetachment = () => { |
| 19 | pipWindow().requestPipWindow( |
| 20 | `width=${window.innerWidth},height=${state().height},top=${window.screen.height},left=${window.screenLeft}}`, |
| 21 | ) |
| 22 | } |
| 23 | const { hoverUtils } = createDrawContext() |
| 24 | |
| 25 | return ( |
| 26 | <div class={styles().tabContainer}> |
| 27 | <For each={tabs}> |
| 28 | {(tab) => ( |
| 29 | <button |
| 30 | type="button" |
| 31 | data-testid={`tsd-tab-${tab.id}`} |
| 32 | onClick={() => setState({ activeTab: tab.id })} |
| 33 | class={clsx(styles().tab, { active: state().activeTab === tab.id })} |
| 34 | onMouseEnter={() => { |
| 35 | if (tab.id === 'plugins') hoverUtils.enter() |
| 36 | }} |
| 37 | onMouseLeave={() => { |
| 38 | if (tab.id === 'plugins') hoverUtils.leave() |
| 39 | }} |
| 40 | > |
| 41 | {tab.icon()} |
| 42 | </button> |
| 43 | )} |
| 44 | </For> |
| 45 | {pipWindow().pipWindow !== null ? null : ( |
| 46 | <div |
| 47 | style={{ |
| 48 | 'margin-top': 'auto', |
| 49 | width: '100%', |
| 50 | }} |
| 51 | > |
| 52 | <button |
| 53 | type="button" |
| 54 | data-testid="tsd-pip-button" |
| 55 | class={clsx(styles().tab, 'detach')} |
| 56 | onClick={handleDetachment} |
| 57 | > |
| 58 | <PiP /> |
| 59 | </button> |
| 60 | <button |
| 61 | type="button" |
| 62 | data-testid="tsd-close-button" |
| 63 | class={clsx(styles().tab, 'close')} |
| 64 | onClick={() => props.toggleOpen()} |
| 65 | > |
| 66 | <X /> |
| 67 | </button> |
| 68 | </div> |
| 69 | )} |
| 70 | </div> |
| 71 | ) |
nothing calls this directly
no test coverage detected