Commit 2299e6bf by Peter Holmberg Committed by GitHub

TextArea: Combine style and classname (#23367)

parent b1039273
...@@ -12,16 +12,18 @@ export interface Props extends Omit<HTMLProps<HTMLTextAreaElement>, 'size'> { ...@@ -12,16 +12,18 @@ export interface Props extends Omit<HTMLProps<HTMLTextAreaElement>, 'size'> {
size?: FormInputSize; size?: FormInputSize;
} }
export const TextArea = React.forwardRef<HTMLTextAreaElement, Props>(({ invalid, size = 'auto', ...props }, ref) => { export const TextArea = React.forwardRef<HTMLTextAreaElement, Props>(
const theme = useTheme(); ({ invalid, size = 'auto', className, ...props }, ref) => {
const styles = getTextAreaStyle(theme, invalid); const theme = useTheme();
const styles = getTextAreaStyle(theme, invalid);
return ( return (
<div className={inputSizes()[size]}> <div className={inputSizes()[size]}>
<textarea className={styles.textarea} {...props} ref={ref} /> <textarea {...props} className={cx(styles.textarea, className)} ref={ref} />
</div> </div>
); );
}); }
);
const getTextAreaStyle = stylesFactory((theme: GrafanaTheme, invalid = false) => { const getTextAreaStyle = stylesFactory((theme: GrafanaTheme, invalid = false) => {
return { return {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment