mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Use ReactNode type for Field error prop (#43852)
* Chore: Use ReactNode type for Field error prop * add LoadingPlaceholder
This commit is contained in:
parent
963ae4ef87
commit
7ea951b35d
@ -22,7 +22,7 @@ export interface FieldProps extends HTMLAttributes<HTMLDivElement> {
|
||||
/** Indicates if field is required */
|
||||
required?: boolean;
|
||||
/** Error message to display */
|
||||
error?: string | null;
|
||||
error?: React.ReactNode;
|
||||
/** Indicates horizontal layout of the field */
|
||||
horizontal?: boolean;
|
||||
/** make validation message overflow horizontally. Prevents pushing out adjacent inline components */
|
||||
|
@ -1,9 +1,9 @@
|
||||
import React from 'react';
|
||||
import { Meta, Story } from '@storybook/react';
|
||||
import { FieldValidationMessage, FieldValidationMessageProps } from './FieldValidationMessage';
|
||||
import { FieldValidationMessage } from './FieldValidationMessage';
|
||||
import mdx from './FieldValidationMessage.mdx';
|
||||
|
||||
export default {
|
||||
const story = {
|
||||
title: 'Forms/FieldValidationMessage',
|
||||
component: FieldValidationMessage,
|
||||
parameters: {
|
||||
@ -21,8 +21,12 @@ export default {
|
||||
argTypes: {
|
||||
children: { name: 'message' },
|
||||
},
|
||||
} as Meta;
|
||||
};
|
||||
|
||||
export const Basic: Story<FieldValidationMessageProps> = (args) => {
|
||||
export default story as Meta;
|
||||
|
||||
type Args = typeof story['args'];
|
||||
|
||||
export const Basic: Story<Args> = (args) => {
|
||||
return <FieldValidationMessage horizontal={args.horizontal}>{args.children}</FieldValidationMessage>;
|
||||
};
|
||||
|
@ -5,7 +5,6 @@ import { Icon } from '../Icon/Icon';
|
||||
import { stylesFactory, useTheme2 } from '../../themes';
|
||||
|
||||
export interface FieldValidationMessageProps {
|
||||
children: string;
|
||||
/** Override component style */
|
||||
className?: string;
|
||||
horizontal?: boolean;
|
||||
|
@ -8,7 +8,7 @@ import { useStyles } from '../../themes';
|
||||
* @public
|
||||
*/
|
||||
export interface LoadingPlaceholderProps extends HTMLAttributes<HTMLDivElement> {
|
||||
text: string;
|
||||
text: React.ReactNode;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user