Skip to content

Commit

Permalink
move tab components to @graphiql/react (#2591)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasheyenbrock committed Aug 9, 2022
1 parent 3b7fdff commit 766818d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .changeset/five-pillows-fail.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
---

Add new components:
- UI components (`Button`, `Dropdown`, `Spinner`, `UnStyledButton` and lots of icon components)
- UI components (`Button`, `Dropdown`, `Spinner`, `Tab`, `TabAddButton`, `Tabs`, `UnStyledButton` and lots of icon components)
- Editor components (`QueryEditor`, `VariableEditor`, `HeaderEditor` and `ResponseEditor`)
- Toolbar components (`ExecuteButton` and `ToolbarButton`)
- Docs components (`Argument`, `DefaultValue`, `DeprecationReason`, `Directive`, `DocExplorer`, `ExplorerSection`, `FieldDocumentation`, `FieldLink`, `SchemaDocumentation`, `Search`, `TypeDocumentation` and `TypeLink`)
Expand Down
1 change: 1 addition & 0 deletions packages/graphiql-react/src/ui/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export * from './button';
export * from './dropdown';
export * from './markdown';
export * from './spinner';
export * from './tabs';
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import React from 'react';

/**
* TODO: extract with other components to @graphiql/react
*/

function TabCloseButton(props: { onClick: () => void }) {
return (
<div
Expand All @@ -20,7 +14,7 @@ function TabCloseButton(props: { onClick: () => void }) {
);
}

export type TabProps = {
type TabProps = {
isActive: boolean;
title: string;
isCloseable: boolean;
Expand Down Expand Up @@ -59,7 +53,7 @@ export function TabAddButton(props: { onClick: () => void }) {
);
}

export type TabsProps = {
type TabsProps = {
children: Array<React.ReactNode>;
tabsProps?: React.HTMLAttributes<{}>;
};
Expand Down
3 changes: 3 additions & 0 deletions packages/graphiql/__mocks__/@graphiql/react.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ export {
StopIcon,
StorageContext,
StorageContextProvider,
Tab,
TabAddButton,
Tabs,
ToolbarButton,
TypeDocumentation,
TypeIcon,
Expand Down
5 changes: 3 additions & 2 deletions packages/graphiql/src/components/GraphiQL.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ import {
SettingsIcon,
Spinner,
StorageContextProvider,
Tab,
TabAddButton,
Tabs,
ToolbarButton,
UnStyledButton,
useAutoCompleteLeafs,
Expand Down Expand Up @@ -78,8 +81,6 @@ import find from '../utility/find';
import { formatError, formatResult } from '@graphiql/toolkit';
import type { Fetcher, GetDefaultFieldNamesFn } from '@graphiql/toolkit';

import { Tab, TabAddButton, Tabs } from './Tabs';

const majorVersion = parseInt(React.version.slice(0, 2), 10);

if (majorVersion < 16) {
Expand Down

0 comments on commit 766818d

Please sign in to comment.