Merge pull request #7874 from dehamzah/override-icons

Add Props Icon for Sidebar Item SidebarSearchField and Settings
This commit is contained in:
Patrik Oldsberg
2021-11-15 11:55:44 +01:00
committed by GitHub
4 changed files with 20 additions and 10 deletions
+6
View File
@@ -0,0 +1,6 @@
---
'@backstage/core-components': patch
'@backstage/plugin-user-settings': patch
---
Add Props Icon for Sidebar Item SidebarSearchField and Settings
@@ -293,11 +293,13 @@ export const SidebarItem = forwardRef<any, SidebarItemProps>((props, ref) => {
type SidebarSearchFieldProps = {
onSearch: (input: string) => void;
to?: string;
icon?: IconComponent;
};
export function SidebarSearchField(props: SidebarSearchFieldProps) {
const [input, setInput] = useState('');
const classes = useStyles();
const Icon = props.icon ? props.icon : SearchIcon;
const search = () => {
props.onSearch(input);
@@ -329,7 +331,7 @@ export function SidebarSearchField(props: SidebarSearchFieldProps) {
return (
<div className={classes.searchRoot}>
<SidebarItem icon={SearchIcon} to={props.to} onClick={handleItemClick}>
<SidebarItem icon={Icon} to={props.to} onClick={handleItemClick}>
<TextField
placeholder="Search"
value={input}
+2 -1
View File
@@ -37,10 +37,11 @@ export const ProviderSettingsItem: ({
// @public (undocumented)
export const Router: ({ providerSettings }: Props) => JSX.Element;
// Warning: (ae-forgotten-export) The symbol "SettingsProps" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "Settings" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const Settings: () => JSX.Element;
export const Settings: (props: SettingsProps) => JSX.Element;
// Warning: (ae-missing-release-tag) "UserSettingsAppearanceCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
@@ -18,13 +18,14 @@ import React from 'react';
import SettingsIcon from '@material-ui/icons/Settings';
import { settingsRouteRef } from '../plugin';
import { SidebarItem } from '@backstage/core-components';
import { IconComponent } from '@backstage/core-plugin-api';
export const Settings = () => {
return (
<SidebarItem
text="Settings"
to={settingsRouteRef.path}
icon={SettingsIcon}
/>
);
type SettingsProps = {
icon?: IconComponent;
};
export const Settings = (props: SettingsProps) => {
const Icon = props.icon ? props.icon : SettingsIcon;
return <SidebarItem text="Settings" to={settingsRouteRef.path} icon={Icon} />;
};