improve EntitySplunkOnCallCard props

* export the props
* rename the props to match component,
* unpack the props inside the function
* mark both with `/** public */`

...per code review feedback here:
https://github.com/backstage/backstage/pull/9635#discussion_r813155577

Signed-off-by: Mike Ball <mikedball@gmail.com>
This commit is contained in:
Mike Ball
2022-02-23 15:46:29 -05:00
parent 2a7b83c8aa
commit 43c779a38b
2 changed files with 10 additions and 9 deletions
+4 -5
View File
@@ -12,14 +12,13 @@ import { DiscoveryApi } from '@backstage/core-plugin-api';
import { Entity } from '@backstage/catalog-model';
import { RouteRef } from '@backstage/core-plugin-api';
// Warning: (ae-forgotten-export) The symbol "EntitySplunkOnCallCardProps" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "EntitySplunkOnCallCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const EntitySplunkOnCallCard: ({
readOnly,
}: {
readOnly?: boolean | undefined;
}) => JSX.Element;
export const EntitySplunkOnCallCard: (
props: EntitySplunkOnCallCardProps,
) => JSX.Element;
// Warning: (ae-missing-release-tag) "isSplunkOnCallAvailable" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
@@ -109,12 +109,14 @@ const useStyles = makeStyles({
},
});
type Props = {
/** @public */
export type EntitySplunkOnCallCardProps = {
readOnly?: boolean;
};
export const EntitySplunkOnCallCard = ({ readOnly }: Props) => {
const readOnlyMode = readOnly || false;
/** @public */
export const EntitySplunkOnCallCard = (props: EntitySplunkOnCallCardProps) => {
const { readOnly } = props;
const classes = useStyles();
const config = useApi(configApiRef);
const api = useApi(splunkOnCallApiRef);
@@ -224,7 +226,7 @@ export const EntitySplunkOnCallCard = ({ readOnly }: Props) => {
return (
<>
<Incidents
readOnly={readOnlyMode}
readOnly={readOnly || false}
team={teamName}
refreshIncidents={refreshIncidents}
/>