Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v4] remove createComponentGroup utility in favour Object.assign #3717

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/thick-adults-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphiql/react': minor
---

remove `createComponentGroup` utility in favour `Object.assign`
10 changes: 5 additions & 5 deletions .changeset/weak-dancers-jog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ Remove `toolbar.additionalContent` and `toolbar.additionalComponent` props in fa

## Migration from `toolbar.additionalContent`

#### Before
### Before

```jsx
<GraphiQL toolbar={{ additionalContent: <button>My button</button> }} />
```

#### After
### After

```jsx
<GraphiQL>
Expand All @@ -29,9 +29,9 @@ Remove `toolbar.additionalContent` and `toolbar.additionalComponent` props in fa
</GraphiQL>
```

### Migration from `toolbar.additionalComponent`
## Migration from `toolbar.additionalComponent`

#### Before
### Before

```jsx
<GraphiQL
Expand All @@ -43,7 +43,7 @@ Remove `toolbar.additionalContent` and `toolbar.additionalComponent` props in fa
/>
```

#### After
### After

```jsx
<GraphiQL>
Expand Down
3 changes: 1 addition & 2 deletions packages/graphiql-react/src/toolbar/menu.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ReactNode } from 'react';
import { clsx } from 'clsx';
import { DropdownMenu, Tooltip } from '../ui';
import { createComponentGroup } from '../utility/component-group';

import './menu.css';
import { DropdownMenuProps } from '@radix-ui/react-dropdown-menu';
Expand Down Expand Up @@ -36,6 +35,6 @@ const ToolbarMenuRoot = ({
</DropdownMenu>
);

export const ToolbarMenu = createComponentGroup(ToolbarMenuRoot, {
export const ToolbarMenu = Object.assign(ToolbarMenuRoot, {
Item: DropdownMenu.Item,
});
3 changes: 1 addition & 2 deletions packages/graphiql-react/src/ui/dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { clsx } from 'clsx';
import { forwardRef, ReactElement } from 'react';
import { CloseIcon } from '../icons';
import { createComponentGroup } from '../utility/component-group';
import { UnStyledButton } from './button';
import * as D from '@radix-ui/react-dialog';
import { Root as VisuallyHidden } from '@radix-ui/react-visually-hidden';
Expand Down Expand Up @@ -40,7 +39,7 @@ export function DialogRoot({
);
}

export const Dialog = createComponentGroup(DialogRoot, {
export const Dialog = Object.assign(DialogRoot, {
Close: DialogClose,
Title: D.Title,
Trigger: D.Trigger,
Expand Down
3 changes: 1 addition & 2 deletions packages/graphiql-react/src/ui/dropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ComponentProps, forwardRef, ReactElement } from 'react';
import { clsx } from 'clsx';
import { createComponentGroup } from '../utility/component-group';
import {
Trigger,
Portal,
Expand Down Expand Up @@ -53,7 +52,7 @@ const Item = ({ className, children, ...props }: DropdownMenuItemProps) => (
</RadixItem>
);

export const DropdownMenu = createComponentGroup(Root, {
export const DropdownMenu = Object.assign(Root, {
Button,
Item,
Content,
Expand Down
3 changes: 1 addition & 2 deletions packages/graphiql-react/src/ui/tooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ReactElement, ReactNode } from 'react';
import * as T from '@radix-ui/react-tooltip';
import { createComponentGroup } from '../utility/component-group';
import './tooltip.css';

export function TooltipRoot({
Expand All @@ -27,6 +26,6 @@ export function TooltipRoot({
);
}

export const Tooltip = createComponentGroup(TooltipRoot, {
export const Tooltip = Object.assign(TooltipRoot, {
Provider: T.Provider,
});
13 changes: 0 additions & 13 deletions packages/graphiql-react/src/utility/component-group.ts

This file was deleted.

Loading