Skip to content

Commit

Permalink
fix: add correct types #1887
Browse files Browse the repository at this point in the history
  • Loading branch information
marek-mihok committed Apr 11, 2023
1 parent 2e5606a commit 95eddff
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions ui/src/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,32 +142,27 @@ const
alignItems: 'center'
}
},
menuStyles: any = { // TODO: fix type
subComponentStyles: {
menuStyles: Fluent.IContextualMenuStyles = {
subComponentStyles: { // TODO: Fix missing 'callout' from Fluent.IContextualMenuSubComponentStyles; Partial<> not working
menuItem: {
icon: { lineHeight: 'initial' },
subMenuIcon: { lineHeight: 'initial', height: 'auto' }
},
}
},
getItemProps = (commands: Command[]) => {
return commands.map(({ name, label, caption, icon, value, data, items }) =>
({
getItemProps: (commands: Command[]) => Fluent.IContextualMenuItem[] = commands => {
return commands.map(({ name, label, caption, icon, value, data, items }) => ({
key: name,
text: label,
title: caption,
iconProps: { iconName: icon },
data: value ?? data, disabled,
onClick: handleOnClick(name, value),
subMenuProps: items
? { items: getItemProps(items) as Fluent.IContextualMenuItem[], styles: menuStyles } as Fluent.IContextualMenuProps
? { items: getItemProps(items), styles: menuStyles }
: undefined
})
) as Fluent.IContextualMenuItem[]
},
menuItems = commands
? getItemProps(commands)
: undefined
}))
}

React.useEffect(() => {
wave.args[name] = false
Expand All @@ -184,11 +179,11 @@ const
onClick,
styles,
iconProps: { iconName: icon },
menuProps: menuItems ? {
items: menuItems,
menuProps: commands ? {
items: getItemProps(commands),
styles: menuStyles
} : undefined,
split: !!menuItems
split: !!commands
}
if (!label && icon) return <Fluent.IconButton {...btnProps} data-test={name} title={caption} />

Expand Down

0 comments on commit 95eddff

Please sign in to comment.