Skip to content

Commit

Permalink
refactor: change FunctionComponent for FC to type components
Browse files Browse the repository at this point in the history
  • Loading branch information
bdriguesdev committed Jun 26, 2023
1 parent 645c7cd commit f562120
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions code/ui/manager/src/components/sidebar/TreeNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { styled } from '@storybook/theming';
import type { Color, Theme } from '@storybook/theming';
import { Icons } from '@storybook/components';
import { transparentize } from 'polished';
import type { FunctionComponent, ComponentProps } from 'react';
import type { FC, ComponentProps } from 'react';
import React from 'react';

export const CollapseIcon = styled.span<{ isExpanded: boolean }>(({ theme, isExpanded }) => ({
Expand Down Expand Up @@ -153,7 +153,7 @@ const InvisibleText = styled.p({
});

// Make the content have a min-height equal to one line of text
export const IconsWrapper: FunctionComponent<{ children?: React.ReactNode }> = ({ children }) => {
export const IconsWrapper: FC<{ children?: React.ReactNode }> = ({ children }) => {
return (
<Wrapper>
<InvisibleText>&nbsp;</InvisibleText>
Expand All @@ -162,7 +162,7 @@ export const IconsWrapper: FunctionComponent<{ children?: React.ReactNode }> = (
);
};

export const GroupNode: FunctionComponent<
export const GroupNode: FC<
ComponentProps<typeof BranchNode> & { isExpanded?: boolean; isExpandable?: boolean }
> = React.memo(function GroupNode({
children,
Expand All @@ -181,7 +181,7 @@ export const GroupNode: FunctionComponent<
);
});

export const ComponentNode: FunctionComponent<ComponentProps<typeof BranchNode>> = React.memo(
export const ComponentNode: FC<ComponentProps<typeof BranchNode>> = React.memo(
function ComponentNode({ theme, children, isExpanded, isExpandable, isSelected, ...props }) {
return (
<BranchNode isExpandable={isExpandable} tabIndex={-1} {...props}>
Expand All @@ -195,7 +195,7 @@ export const ComponentNode: FunctionComponent<ComponentProps<typeof BranchNode>>
}
);

export const DocumentNode: FunctionComponent<
export const DocumentNode: FC<
ComponentProps<typeof LeafNode> & { docsMode: boolean }
> = React.memo(function DocumentNode({ theme, children, docsMode, ...props }) {
return (
Expand All @@ -208,7 +208,7 @@ export const DocumentNode: FunctionComponent<
);
});

export const StoryNode: FunctionComponent<ComponentProps<typeof LeafNode>> = React.memo(
export const StoryNode: FC<ComponentProps<typeof LeafNode>> = React.memo(
function StoryNode({ theme, children, ...props }) {
return (
<LeafNode tabIndex={-1} {...props}>
Expand Down

0 comments on commit f562120

Please sign in to comment.