chore: updating the api for hiding icons
Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
@@ -49,7 +49,7 @@ const useStyles = makeStyles(
|
||||
*/
|
||||
export type EntityDisplayNameProps = {
|
||||
entityRef: Entity | CompoundEntityRef | string;
|
||||
noIcon?: boolean;
|
||||
hideIcon?: boolean;
|
||||
noTooltip?: boolean;
|
||||
defaultKind?: string;
|
||||
defaultNamespace?: string;
|
||||
@@ -63,7 +63,8 @@ export type EntityDisplayNameProps = {
|
||||
export const EntityDisplayName = (
|
||||
props: EntityDisplayNameProps,
|
||||
): JSX.Element => {
|
||||
const { entityRef, noIcon, noTooltip, defaultKind, defaultNamespace } = props;
|
||||
const { entityRef, hideIcon, noTooltip, defaultKind, defaultNamespace } =
|
||||
props;
|
||||
|
||||
const classes = useStyles();
|
||||
const { primaryTitle, secondaryTitle, Icon } = useEntityPresentation(
|
||||
@@ -77,7 +78,7 @@ export const EntityDisplayName = (
|
||||
// Optionally an icon, and wrapper around them both
|
||||
content = (
|
||||
<Box component="span" className={classes.root}>
|
||||
{Icon && !noIcon ? (
|
||||
{Icon && !hideIcon ? (
|
||||
<Box component="span" className={classes.icon}>
|
||||
<Icon fontSize="inherit" />
|
||||
</Box>
|
||||
|
||||
@@ -38,7 +38,7 @@ export type EntityRefLinkProps = {
|
||||
/** @deprecated This option should no longer be used; presentation is requested through the {@link entityPresentationApiRef} instead */
|
||||
title?: string;
|
||||
children?: React.ReactNode;
|
||||
noIcon?: boolean;
|
||||
hideIcon?: boolean;
|
||||
} & Omit<LinkProps, 'to'>;
|
||||
|
||||
/**
|
||||
@@ -54,7 +54,7 @@ export const EntityRefLink = forwardRef<any, EntityRefLinkProps>(
|
||||
defaultNamespace,
|
||||
title,
|
||||
children,
|
||||
noIcon,
|
||||
hideIcon,
|
||||
...linkProps
|
||||
} = props;
|
||||
const entityRoute = useEntityRoute(props.entityRef);
|
||||
@@ -64,7 +64,7 @@ export const EntityRefLink = forwardRef<any, EntityRefLinkProps>(
|
||||
entityRef={entityRef}
|
||||
defaultKind={defaultKind}
|
||||
defaultNamespace={defaultNamespace}
|
||||
noIcon={noIcon}
|
||||
hideIcon={hideIcon}
|
||||
/>
|
||||
);
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ export type EntityRefLinksProps<
|
||||
> = {
|
||||
defaultKind?: string;
|
||||
entityRefs: TRef[];
|
||||
noIcons?: boolean;
|
||||
hideIcons?: boolean;
|
||||
/** @deprecated This option is no longer used; presentation is handled by entityPresentationApiRef instead */
|
||||
fetchEntities?: boolean;
|
||||
/** @deprecated This option is no longer used; presentation is handled by entityPresentationApiRef instead */
|
||||
@@ -47,7 +47,7 @@ export type EntityRefLinksProps<
|
||||
export function EntityRefLinks<
|
||||
TRef extends string | CompoundEntityRef | Entity,
|
||||
>(props: EntityRefLinksProps<TRef>) {
|
||||
const { entityRefs, noIcons, ...linkProps } = props;
|
||||
const { entityRefs, hideIcons, ...linkProps } = props;
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -57,7 +57,7 @@ export function EntityRefLinks<
|
||||
return (
|
||||
<React.Fragment key={`${i}.${entityRefString}`}>
|
||||
{i > 0 && ', '}
|
||||
<EntityRefLink {...linkProps} entityRef={r} noIcon={noIcons} />
|
||||
<EntityRefLink {...linkProps} entityRef={r} hideIcon={hideIcons} />
|
||||
</React.Fragment>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -79,7 +79,7 @@ function EntityLayoutTitle(props: {
|
||||
whiteSpace="nowrap"
|
||||
overflow="hidden"
|
||||
>
|
||||
{entity ? <EntityDisplayName entityRef={entity} noIcon /> : title}
|
||||
{entity ? <EntityDisplayName entityRef={entity} hideIcon /> : title}
|
||||
</Box>
|
||||
{entity && <FavoriteEntity entity={entity} />}
|
||||
</Box>
|
||||
|
||||
@@ -174,7 +174,7 @@ export const TemplateCard = (props: TemplateCardProps) => {
|
||||
style={{ marginLeft: '8px' }}
|
||||
entityRefs={ownedByRelations}
|
||||
defaultKind="Group"
|
||||
noIcons
|
||||
hideIcons
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -246,7 +246,7 @@ export const TemplateCard = ({ template, deprecated }: TemplateCardProps) => {
|
||||
<EntityRefLinks
|
||||
entityRefs={ownedByRelations}
|
||||
defaultKind="Group"
|
||||
noIcons
|
||||
hideIcons
|
||||
/>
|
||||
</Box>
|
||||
<Box>
|
||||
|
||||
Reference in New Issue
Block a user