Skip to content

Commit 7b07df3

Browse files
authored
fix: icon exports were breaking storybook (#716)
1 parent 2d9ebcf commit 7b07df3

File tree

4 files changed

+29
-26
lines changed

4 files changed

+29
-26
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ Checklist for creating a new component:
3030

3131
- Does it have proper type definitions?
3232
- Does it have prop types?
33-
- Can it pass a ref with forwardRef?
3433
- Does it have a story in the Storybook?
3534

3635
## Contributing

src/components/icons/AWSIcon.tsx

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { forwardRef, ReactElement } from 'react'
1+
import { ComponentPropsWithRef, ReactElement } from 'react'
22
import { useTheme } from 'styled-components'
33

44
enum AWSIconName {
@@ -470,28 +470,29 @@ interface AWSIconProps {
470470
size?: number
471471
}
472472

473-
const AWSIcon = forwardRef<HTMLImageElement, AWSIconProps>(
474-
({ name, size = 24, ...props }, ref) => {
475-
const theme = useTheme()
476-
const icon = AWSIcons[name]?.(size) ?? null
473+
function AWSIcon({
474+
name,
475+
size = 24,
476+
...props
477+
}: AWSIconProps & ComponentPropsWithRef<'div'>) {
478+
const theme = useTheme()
479+
const icon = AWSIcons[name]?.(size) ?? null
477480

478-
return icon ? (
479-
<div
480-
ref={ref}
481-
style={{
482-
display: 'block',
483-
borderRadius: theme.borderRadiuses.medium,
484-
overflow: 'hidden',
485-
width: size,
486-
height: size,
487-
}}
488-
{...props}
489-
>
490-
{icon}
491-
</div>
492-
) : null
493-
}
494-
)
481+
return icon ? (
482+
<div
483+
style={{
484+
display: 'block',
485+
borderRadius: theme.borderRadiuses.medium,
486+
overflow: 'hidden',
487+
width: size,
488+
height: size,
489+
}}
490+
{...props}
491+
>
492+
{icon}
493+
</div>
494+
) : null
495+
}
495496

496497
export default AWSIcon
497498

src/icons.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,4 +242,3 @@ export { default as WebhooksIcon } from './components/icons/WebhooksIcon'
242242
export { default as WindowsLogoIcon } from './components/icons/WindowsLogoIcon'
243243
export { default as WorkspaceIcon } from './components/icons/WorkspaceIcon'
244244
export { default as YouTubeIcon } from './components/icons/YouTubeIcon'
245-
export { default as AWSIcon, AWSIconName } from './components/icons/AWSIcon'

src/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ export * from './icons'
88
export * from './plural-logos'
99

1010
// Components
11-
export { default as Accordion, AccordionItem } from './components/Accordion'
12-
export type { AccordionProps } from './components/Accordion'
11+
export {
12+
default as Accordion,
13+
AccordionItem,
14+
type AccordionProps,
15+
} from './components/Accordion'
16+
export { default as AWSIcon, AWSIconName } from './components/icons/AWSIcon'
1317
export { AnimatedDiv } from './components/AnimatedDiv'
1418
export { default as AppIcon } from './components/AppIcon'
1519
export { default as ArrowScroll } from './components/ArrowScroll'

0 commit comments

Comments
 (0)