replace the variant with noIcon and noTitle

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2023-10-23 16:33:37 +02:00
parent 1286ff185a
commit 18bc2d867c
3 changed files with 8 additions and 10 deletions
+2 -1
View File
@@ -196,7 +196,8 @@ export const EntityDisplayName: (props: EntityDisplayNameProps) => JSX.Element;
// @public
export type EntityDisplayNameProps = {
entityRef: Entity | CompoundEntityRef | string;
variant?: 'simple' | string;
noIcon?: boolean;
noTooltip?: boolean;
defaultKind?: string;
defaultNamespace?: string;
};
@@ -49,7 +49,8 @@ const useStyles = makeStyles(
*/
export type EntityDisplayNameProps = {
entityRef: Entity | CompoundEntityRef | string;
variant?: 'simple' | string;
noIcon?: boolean;
noTooltip?: boolean;
defaultKind?: string;
defaultNamespace?: string;
};
@@ -62,7 +63,7 @@ export type EntityDisplayNameProps = {
export const EntityDisplayName = (
props: EntityDisplayNameProps,
): JSX.Element => {
const { entityRef, variant, defaultKind, defaultNamespace } = props;
const { entityRef, noIcon, noTooltip, defaultKind, defaultNamespace } = props;
const classes = useStyles();
const { primaryTitle, secondaryTitle, Icon } = useEntityPresentation(
@@ -77,7 +78,7 @@ export const EntityDisplayName = (
content = (
<Box component="span" className={classes.root}>
{content}
{Icon && variant !== 'simple' ? (
{Icon && !noIcon ? (
<Box component="span" className={classes.icon}>
<Icon fontSize="inherit" />
</Box>
@@ -86,7 +87,7 @@ export const EntityDisplayName = (
);
// Optionally, a tooltip as the outermost layer
if (secondaryTitle) {
if (secondaryTitle && !noTooltip) {
content = (
<Tooltip enterDelay={1500} title={secondaryTitle}>
{content}
@@ -79,11 +79,7 @@ function EntityLayoutTitle(props: {
whiteSpace="nowrap"
overflow="hidden"
>
{entity ? (
<EntityDisplayName entityRef={entity} variant="simple" />
) : (
title
)}
{entity ? <EntityDisplayName entityRef={entity} noIcon /> : title}
</Box>
{entity && <FavoriteEntity entity={entity} />}
</Box>