feat: move the icon to the left

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2023-11-08 21:54:53 -06:00
parent cca74eaf27
commit eb575b8fee
5 changed files with 14 additions and 5 deletions
@@ -34,7 +34,7 @@ const useStyles = makeStyles(
alignItems: 'center',
},
icon: {
marginLeft: theme.spacing(0.5),
marginRight: theme.spacing(0.5),
color: theme.palette.text.secondary,
lineHeight: 0,
},
@@ -77,12 +77,12 @@ export const EntityDisplayName = (
// Optionally an icon, and wrapper around them both
content = (
<Box component="span" className={classes.root}>
{content}
{Icon && !noIcon ? (
<Box component="span" className={classes.icon}>
<Icon fontSize="inherit" />
</Box>
) : null}
{content}
</Box>
);
@@ -38,6 +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;
} & Omit<LinkProps, 'to'>;
/**
@@ -53,6 +54,7 @@ export const EntityRefLink = forwardRef<any, EntityRefLinkProps>(
defaultNamespace,
title,
children,
noIcon,
...linkProps
} = props;
const entityRoute = useEntityRoute(props.entityRef);
@@ -62,6 +64,7 @@ export const EntityRefLink = forwardRef<any, EntityRefLinkProps>(
entityRef={entityRef}
defaultKind={defaultKind}
defaultNamespace={defaultNamespace}
noIcon={noIcon}
/>
);
@@ -32,6 +32,7 @@ export type EntityRefLinksProps<
> = {
defaultKind?: string;
entityRefs: TRef[];
noIcons?: 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 */
@@ -46,7 +47,7 @@ export type EntityRefLinksProps<
export function EntityRefLinks<
TRef extends string | CompoundEntityRef | Entity,
>(props: EntityRefLinksProps<TRef>) {
const { entityRefs, ...linkProps } = props;
const { entityRefs, noIcons, ...linkProps } = props;
return (
<>
@@ -56,7 +57,7 @@ export function EntityRefLinks<
return (
<React.Fragment key={`${i}.${entityRefString}`}>
{i > 0 && ', '}
<EntityRefLink {...linkProps} entityRef={r} />
<EntityRefLink {...linkProps} entityRef={r} noIcon={noIcons} />
</React.Fragment>
);
})}
@@ -174,6 +174,7 @@ export const TemplateCard = (props: TemplateCardProps) => {
style={{ marginLeft: '8px' }}
entityRefs={ownedByRelations}
defaultKind="Group"
noIcons
/>
</>
)}
@@ -243,7 +243,11 @@ export const TemplateCard = ({ template, deprecated }: TemplateCardProps) => {
<Typography variant="body2" className={classes.label}>
Owner
</Typography>
<EntityRefLinks entityRefs={ownedByRelations} defaultKind="Group" />
<EntityRefLinks
entityRefs={ownedByRelations}
defaultKind="Group"
noIcons
/>
</Box>
<Box>
<Typography