Skip to content

Commit

Permalink
Add Margin to error messages in the Admin UI Item Form (#6508)
Browse files Browse the repository at this point in the history
* Add Margin to error messages in the Admin UI Item Form
  • Loading branch information
JedWatson authored Sep 9, 2021
1 parent 6a589bc commit 3cfc2a3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .changeset/early-snakes-arrive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@keystone-ui/notice": minor
"@keystone-next/keystone": patch
---

Add Margin to error messages in the Admin UI Item Form
8 changes: 4 additions & 4 deletions design-system/packages/notice/src/Notice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/** @jsx jsx */

import { ReactNode, useMemo } from 'react';
import { jsx, makeId, useId, Stack } from '@keystone-ui/core';
import { jsx, makeId, useId, Stack, MarginProps, Box } from '@keystone-ui/core';
import { AlertOctagonIcon } from '@keystone-ui/icons/icons/AlertOctagonIcon';
import { AlertCircleIcon } from '@keystone-ui/icons/icons/AlertCircleIcon';
import { AlertTriangleIcon } from '@keystone-ui/icons/icons/AlertTriangleIcon';
Expand Down Expand Up @@ -36,7 +36,7 @@ type NoticeProps = {
tone?: ToneKey;
title?: string;
className?: string;
} /* TODO: & MarginProps */;
} & MarginProps;

export const Notice = ({
actions,
Expand All @@ -60,7 +60,7 @@ export const Notice = ({

return (
<ButtonProvider {...buttonContext}>
<div
<Box
css={{
display: 'flex',
flex: 1,
Expand Down Expand Up @@ -97,7 +97,7 @@ export const Notice = ({
</Stack>
)}
</div>
</div>
</Box>
</ButtonProvider>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ type GraphQLErrorNoticeProps = {

export function GraphQLErrorNotice({ errors, networkError }: GraphQLErrorNoticeProps) {
if (networkError) {
return <Notice tone="negative">{networkError.message}</Notice>;
return (
<Notice tone="negative" marginBottom="large">
{networkError.message}
</Notice>
);
}
if (errors?.length) {
return (
<Stack gap="small">
<Stack gap="small" marginBottom="large">
{errors.map(err => (
<Notice tone="negative">{err.message}</Notice>
))}
Expand Down

0 comments on commit 3cfc2a3

Please sign in to comment.