Skip to content

Commit

Permalink
move tab components to @graphiql/react
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasheyenbrock committed Jul 27, 2022
1 parent 83d23dd commit 44cccd4
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 @@ -58,7 +52,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 @@ -68,6 +68,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 @@ -45,6 +45,9 @@ import {
SettingsIcon,
Spinner,
StorageContextProvider,
Tab,
TabAddButton,
Tabs,
ToolbarButton,
UnStyledButton,
useAutoCompleteLeafs,
Expand Down Expand Up @@ -77,8 +80,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 44cccd4

Please sign in to comment.