From 975db4096d950f01532f8055ec77aa2dc20d8740 Mon Sep 17 00:00:00 2001 From: Armagan Ersoz Date: Tue, 16 May 2023 17:43:20 +1000 Subject: [PATCH 1/3] forwardref styl octiocns --- src/Octicon/Octicon.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Octicon/Octicon.tsx b/src/Octicon/Octicon.tsx index 8eaa7d37a39..07a84468fec 100644 --- a/src/Octicon/Octicon.tsx +++ b/src/Octicon/Octicon.tsx @@ -6,9 +6,14 @@ import {ComponentProps} from '../utils/types' type StyledOcticonProps = {icon: React.ElementType; color?: string} & IconProps -function Icon({icon: IconComponent, ...rest}: StyledOcticonProps) { - return -} +// function Icon({icon: IconComponent, ...rest}: StyledOcticonProps) { +// return +// } + +const Icon = React.forwardRef((props: StyledOcticonProps, ref: React.Ref) => { + const {icon: IconComponent, ...rest} = props + return +}) const Octicon = styled(Icon)` ${({color, sx: sxProp}) => sx({sx: {color, ...sxProp}})} From 0ec38a6e3afaeabdde1e942a4a94e26e0a77fb08 Mon Sep 17 00:00:00 2001 From: Armagan Ersoz Date: Wed, 17 May 2023 09:56:20 +1000 Subject: [PATCH 2/3] remove the comment --- src/Octicon/Octicon.tsx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Octicon/Octicon.tsx b/src/Octicon/Octicon.tsx index 07a84468fec..5e331e9a2a9 100644 --- a/src/Octicon/Octicon.tsx +++ b/src/Octicon/Octicon.tsx @@ -6,10 +6,6 @@ import {ComponentProps} from '../utils/types' type StyledOcticonProps = {icon: React.ElementType; color?: string} & IconProps -// function Icon({icon: IconComponent, ...rest}: StyledOcticonProps) { -// return -// } - const Icon = React.forwardRef((props: StyledOcticonProps, ref: React.Ref) => { const {icon: IconComponent, ...rest} = props return From f712f666189545bfa63b1784186c057de7fcad06 Mon Sep 17 00:00:00 2001 From: Armagan Ersoz Date: Wed, 17 May 2023 11:06:52 +1000 Subject: [PATCH 3/3] add changeset --- .changeset/spicy-shoes-press.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/spicy-shoes-press.md diff --git a/.changeset/spicy-shoes-press.md b/.changeset/spicy-shoes-press.md new file mode 100644 index 00000000000..cc1af0c28fe --- /dev/null +++ b/.changeset/spicy-shoes-press.md @@ -0,0 +1,5 @@ +--- +'@primer/react': patch +--- + +Octicons (previously known StyledOcticons) to use React.forwardRef()