Skip to content

Commit

Permalink
fix(Command): The problem is not repaired Secondary display when only…
Browse files Browse the repository at this point in the history
… one child
  • Loading branch information
xinyao27 committed Sep 29, 2019
1 parent d861584 commit ce3d74c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/fluent-ui/src/Command/Command.tsx
Expand Up @@ -42,7 +42,7 @@ const Command: React.FC<CommandProps> = React.forwardRef<HTMLDivElement, Command
const container: CommandContainer = {
content: [],
standard: [],
secondary: []
secondary: null
}
React.Children.forEach(children, (child: CommandChild): void => {
if (child.type.displayName! === 'FCommandContent') {
Expand Down Expand Up @@ -72,6 +72,7 @@ const Command: React.FC<CommandProps> = React.forwardRef<HTMLDivElement, Command
setSecondaryVisible((visible: boolean): boolean => !visible)
})
const otherProps = omit(rest, ['display', 'backgroundColor', 'color'])

return (
<Box
ref={ref}
Expand All @@ -90,7 +91,7 @@ const Command: React.FC<CommandProps> = React.forwardRef<HTMLDivElement, Command
)
: container.standard}
</div>
{!!container.secondary.length &&
{container.secondary !== null &&
(_reveal ? (
<RevealWrapper>
<Item
Expand Down
2 changes: 1 addition & 1 deletion packages/fluent-ui/src/Command/Command.type.ts
Expand Up @@ -17,7 +17,7 @@ export type CommandChild =
export interface CommandContainer {
standard: React.ReactComponentElement<typeof Item>[]
content: React.ReactComponentElement<typeof Content>[]
secondary: React.ReactComponentElement<typeof Secondary>[]
secondary: React.ReactComponentElement<typeof Secondary>[] | null
}

export interface CommandProps extends BoxProps {
Expand Down

0 comments on commit ce3d74c

Please sign in to comment.