Skip to content

Commit

Permalink
Make the document field toolbar wrap (#4883)
Browse files Browse the repository at this point in the history
* Make the document field toolbar wrap
  • Loading branch information
JedWatson authored Feb 19, 2021
1 parent 00f19da commit d53eb87
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .changeset/twelve-tools-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@keystone-next/fields-document": patch
---

Allowed the document field toolbar to wrap on smaller screens
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @jsx jsx */

import { ButtonHTMLAttributes, HTMLAttributes, createContext, useContext, ReactNode } from 'react';
import { Box, MarginProps, forwardRefWithAs, jsx, useTheme } from '@keystone-ui/core';
import { Inline, MarginProps, forwardRefWithAs, jsx, useTheme } from '@keystone-ui/core';

// Spacers and Separators
// ------------------------------
Expand Down Expand Up @@ -43,20 +43,12 @@ const useToolbarGroupContext = () => useContext(ToolbarGroupContext);
type ToolbarGroupProps = { direction?: DirectionType } & MarginProps &
HTMLAttributes<HTMLDivElement>;
export const ToolbarGroup = forwardRefWithAs<'div', ToolbarGroupProps>(
({ direction = 'row', ...props }, ref) => {
const { spacing } = useTheme();

({ children, direction = 'row', ...props }, ref) => {
return (
<ToolbarGroupContext.Provider value={{ direction }}>
<Box
ref={ref}
css={{
display: 'inline-grid',
gap: spacing.xxsmall,
gridAutoFlow: autoFlowDirection[direction],
}}
{...props}
/>
<Inline ref={ref} {...props}>
{children}
</Inline>
</ToolbarGroupContext.Provider>
);
}
Expand Down

1 comment on commit d53eb87

@vercel
Copy link

@vercel vercel bot commented on d53eb87 Feb 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.