Skip to content

Commit

Permalink
#228 Icons in sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
Polleps authored and joepio committed Oct 10, 2022
1 parent e587567 commit 0c1d9c4
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Details } from '../../Details';
import { FloatingActions, floatingHoverStyles } from './FloatingActions';
import { ErrorLook } from '../../ErrorLook';
import { LoaderInline } from '../../Loader';
import { getIconForClass } from '../../../views/FolderPage/iconMap';

interface ResourceSideBarProps {
subject: string;
Expand Down Expand Up @@ -38,6 +39,9 @@ export function ResourceSideBar({
const [subResources] = useArray(resource, urls.properties.subResources);
const hasSubResources = subResources.length > 0;

const [classType] = useString(resource, urls.properties.isA);
const Icon = getIconForClass(classType!);

const handleDetailsToggle = useCallback((state: boolean) => {
setOpen(state);
}, []);
Expand Down Expand Up @@ -101,7 +105,10 @@ export function ResourceSideBar({
title={description}
ref={spanRef}
>
{title}
<TextWrapper>
<Icon />
{title}
</TextWrapper>
</SideBarItem>
</Title>
<FloatingActions subject={subject} />
Expand Down Expand Up @@ -137,3 +144,14 @@ const Title = styled(AtomicLink)<TitleProps>`
overflow: hidden;
white-space: nowrap;
`;

const TextWrapper = styled.span`
display: inline-flex;
align-items: center;
gap: 0.4rem;
svg {
/* color: ${p => p.theme.colors.text}; */
font-size: 0.8em;
}
`;

0 comments on commit 0c1d9c4

Please sign in to comment.