unpack props inside component bodies

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2023-02-27 15:31:15 +01:00
parent babbaa9391
commit 65454876fb
51 changed files with 253 additions and 297 deletions
+7 -13
View File
@@ -12,9 +12,9 @@ import { RouteRef } from '@backstage/core-plugin-api';
import { SearchBarBaseProps } from '@backstage/plugin-search-react';
// @public (undocumented)
export const HomePageSearchBar: ({
...props
}: Partial<Omit<SearchBarBaseProps, 'onChange' | 'onSubmit'>>) => JSX.Element;
export const HomePageSearchBar: (
props: Partial<Omit<SearchBarBaseProps, 'onChange' | 'onSubmit'>>,
) => JSX.Element;
// @public
export type HomePageSearchBarProps = Partial<
@@ -25,12 +25,7 @@ export type HomePageSearchBarProps = Partial<
export const Router: () => JSX.Element;
// @public (undocumented)
export const SearchModal: ({
open,
hidden,
toggleModal,
children,
}: SearchModalProps) => JSX.Element;
export const SearchModal: (props: SearchModalProps) => JSX.Element;
// @public (undocumented)
export interface SearchModalChildrenProps {
@@ -46,10 +41,9 @@ export interface SearchModalProps {
}
// @public
export const SearchModalProvider: ({
children,
showInitially,
}: SearchModalProviderProps) => JSX.Element;
export const SearchModalProvider: (
props: SearchModalProviderProps,
) => JSX.Element;
// @public
export type SearchModalProviderProps = {
@@ -42,7 +42,7 @@ export type HomePageSearchBarProps = Partial<
/**
* The search bar created specifically for the composable home page.
*/
export const HomePageSearchBar = ({ ...props }: HomePageSearchBarProps) => {
export const HomePageSearchBar = (props: HomePageSearchBarProps) => {
const classes = useStyles(props);
const [query, setQuery] = useState('');
const handleSearch = useNavigateToQuery();
@@ -168,12 +168,9 @@ export const Modal = ({ toggleModal }: SearchModalProps) => {
/**
* @public
*/
export const SearchModal = ({
open = true,
hidden,
toggleModal,
children,
}: SearchModalProps) => {
export const SearchModal = (props: SearchModalProps) => {
const { open = true, hidden, toggleModal, children } = props;
const classes = useStyles();
return (
@@ -84,15 +84,12 @@ export type SearchModalProviderProps = {
*
* @public
*/
export const SearchModalProvider = ({
children,
showInitially,
}: SearchModalProviderProps) => {
const value = useSearchModal(showInitially);
export const SearchModalProvider = (props: SearchModalProviderProps) => {
const value = useSearchModal(props.showInitially);
const versionedValue = createVersionedValueMap({ 1: value });
return (
<SearchModalContext.Provider value={versionedValue}>
{children}
{props.children}
</SearchModalContext.Provider>
);
};