From 5ce3345f02d0ae1ba1e6bb9a14324aa2195bceef Mon Sep 17 00:00:00 2001 From: siddharthkp Date: Fri, 10 Sep 2021 16:26:34 +0200 Subject: [PATCH 1/7] fix docgen for TextInput with workaround --- src/TextInput.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TextInput.tsx b/src/TextInput.tsx index 45cc2460a77..38bfe60e208 100644 --- a/src/TextInput.tsx +++ b/src/TextInput.tsx @@ -1,5 +1,5 @@ import classnames from 'classnames' -import React from 'react' +import React, {forwardRef} from 'react' import styled, {css} from 'styled-components' import {maxWidth, MaxWidthProps, minWidth, MinWidthProps, variant, width, WidthProps} from 'styled-system' import {get} from './constants' @@ -132,7 +132,7 @@ type TextInputInternalProps = NonPassthroughProps & Omit, keyof NonPassthroughProps> // using forwardRef is important so that other components (ex. SelectMenu) can autofocus the input -const TextInput = React.forwardRef( +const TextInput = forwardRef( ( { icon: IconComponent, From 3440860a07a2edb355945d25f31e0118572f9b9f Mon Sep 17 00:00:00 2001 From: siddharthkp Date: Wed, 15 Sep 2021 10:42:32 +0200 Subject: [PATCH 2/7] add example with FC and docgen --- debug/Button.tsx | 25 +++++++++++++++++++++++++ debug/docgen.ts | 22 ++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 debug/Button.tsx create mode 100644 debug/docgen.ts diff --git a/debug/Button.tsx b/debug/Button.tsx new file mode 100644 index 00000000000..7afa11b71fe --- /dev/null +++ b/debug/Button.tsx @@ -0,0 +1,25 @@ +import React, {FC, forwardRef} from 'react' + +type ButtonProps = { + variant?: 'small' | 'medium' | 'large' +} + +// doesn't work +export const SimpleButtonWithFC: React.FC = props => { + return