Skip to content

Commit 09e7004

Browse files
authored
[v4] remove disableTabs option (#3687)
* remove `disableTabs` option * format
1 parent 61fc27a commit 09e7004

File tree

2 files changed

+49
-50
lines changed

2 files changed

+49
-50
lines changed

.changeset/green-pugs-worry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'graphiql': major
3+
---
4+
5+
remove `disableTabs` option

packages/graphiql/src/components/GraphiQL.tsx

Lines changed: 44 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ export function GraphiQL({
169169
>
170170
<GraphiQLInterface
171171
showPersistHeadersSettings={shouldPersistHeaders !== false}
172-
disableTabs={props.disableTabs ?? false}
173172
forcedTheme={props.forcedTheme}
174173
{...props}
175174
/>
@@ -218,7 +217,6 @@ export type GraphiQLInterfaceProps = WriteableEditorProps &
218217
* settings modal.
219218
*/
220219
showPersistHeadersSettings?: boolean;
221-
disableTabs?: boolean;
222220
/**
223221
* forcedTheme allows enforcement of a specific theme for GraphiQL.
224222
* This is useful when you want to make sure that GraphiQL is always
@@ -541,55 +539,51 @@ export function GraphiQLInterface(props: GraphiQLInterfaceProps) {
541539
)}
542540
<div ref={pluginResize.secondRef} className="graphiql-sessions">
543541
<div className="graphiql-session-header">
544-
{!props.disableTabs && (
545-
<>
546-
{hasMultipleTabs && (
547-
<Tabs
548-
values={editorContext.tabs}
549-
onReorder={handleReorder}
550-
aria-label="Select active operation"
551-
>
552-
{editorContext.tabs.map((tab, index) => (
553-
<Tooltip key={tab.id} label={tab.title}>
554-
<Tab
555-
value={tab}
556-
isActive={index === editorContext.activeTabIndex}
557-
>
558-
<Tab.Button
559-
aria-controls="graphiql-session"
560-
id={`graphiql-session-tab-${index}`}
561-
onClick={() => {
562-
executionContext.stop();
563-
editorContext.changeTab(index);
564-
}}
565-
>
566-
{tab.title}
567-
</Tab.Button>
568-
<Tab.Close
569-
onClick={() => {
570-
if (editorContext.activeTabIndex === index) {
571-
executionContext.stop();
572-
}
573-
editorContext.closeTab(index);
574-
}}
575-
/>
576-
</Tab>
577-
</Tooltip>
578-
))}
579-
</Tabs>
580-
)}
581-
<Tooltip label="New tab">
582-
<UnStyledButton
583-
type="button"
584-
className="graphiql-tab-add"
585-
onClick={handleAddTab}
586-
aria-label="New tab"
587-
>
588-
<PlusIcon aria-hidden="true" />
589-
</UnStyledButton>
590-
</Tooltip>
591-
</>
542+
{hasMultipleTabs && (
543+
<Tabs
544+
values={editorContext.tabs}
545+
onReorder={handleReorder}
546+
aria-label="Select active operation"
547+
>
548+
{editorContext.tabs.map((tab, index) => (
549+
<Tooltip key={tab.id} label={tab.title}>
550+
<Tab
551+
value={tab}
552+
isActive={index === editorContext.activeTabIndex}
553+
>
554+
<Tab.Button
555+
aria-controls="graphiql-session"
556+
id={`graphiql-session-tab-${index}`}
557+
onClick={() => {
558+
executionContext.stop();
559+
editorContext.changeTab(index);
560+
}}
561+
>
562+
{tab.title}
563+
</Tab.Button>
564+
<Tab.Close
565+
onClick={() => {
566+
if (editorContext.activeTabIndex === index) {
567+
executionContext.stop();
568+
}
569+
editorContext.closeTab(index);
570+
}}
571+
/>
572+
</Tab>
573+
</Tooltip>
574+
))}
575+
</Tabs>
592576
)}
577+
<Tooltip label="New tab">
578+
<UnStyledButton
579+
type="button"
580+
className="graphiql-tab-add"
581+
onClick={handleAddTab}
582+
aria-label="New tab"
583+
>
584+
<PlusIcon aria-hidden="true" />
585+
</UnStyledButton>
586+
</Tooltip>
593587
{logo}
594588
</div>
595589
<div

0 commit comments

Comments
 (0)