Skip to content

Commit

Permalink
Refactor ToolbarMenuList component to remove deprecated showName prop…
Browse files Browse the repository at this point in the history
…erty and update title handling
  • Loading branch information
valentinpalkovic committed Mar 31, 2023
1 parent 9f68b5d commit 23e9b51
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 3 additions & 3 deletions code/addons/toolbars/src/components/ToolbarMenuList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const ToolbarMenuList: FC<ToolbarMenuListProps> = withKeyboardCycle(
id,
name,
description,
toolbar: { icon: _icon, items, title: _title, showName, preventDynamicIcon, dynamicTitle },
toolbar: { icon: _icon, items, title: _title, preventDynamicIcon, dynamicTitle },
}) => {
const [globals, updateGlobals] = useGlobals();
const [isTooltipVisible, setIsTooltipVisible] = useState(false);
Expand All @@ -32,12 +32,12 @@ export const ToolbarMenuList: FC<ToolbarMenuListProps> = withKeyboardCycle(
}

// Deprecation support for old "name of global arg used as title"
if (showName && !title) {
if (!title) {
title = name;
deprecate(
'`showName` is deprecated as `name` will stop having dual purposes in the future. Please specify a `title` in `globalTypes` instead.'
);
} else if (!showName && !icon && !title) {
} else if (!icon && !title) {
title = name;
deprecate(
`Using the \`name\` "${name}" as toolbar title for backward compatibility. \`name\` will stop having dual purposes in the future. Please specify either a \`title\` or an \`icon\` in \`globalTypes\` instead.`
Expand Down
2 changes: 0 additions & 2 deletions code/addons/toolbars/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ export interface NormalizedToolbarConfig {
preventDynamicIcon?: boolean;
items: ToolbarItem[];
shortcuts?: ToolbarShortcuts;
/** @deprecated "name" no longer dual purposes as title - use "title" if a title is wanted */
showName?: boolean;
/** Change title based on selected value */
dynamicTitle?: boolean;
}
Expand Down

0 comments on commit 23e9b51

Please sign in to comment.