Skip to content

Commit 0c1d9c4

Browse files
Pollepsjoepio
authored andcommitted
#228 Icons in sidebar
1 parent e587567 commit 0c1d9c4

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

data-browser/src/components/SideBar/ResourceSideBar/ResourceSideBar.tsx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { Details } from '../../Details';
88
import { FloatingActions, floatingHoverStyles } from './FloatingActions';
99
import { ErrorLook } from '../../ErrorLook';
1010
import { LoaderInline } from '../../Loader';
11+
import { getIconForClass } from '../../../views/FolderPage/iconMap';
1112

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

42+
const [classType] = useString(resource, urls.properties.isA);
43+
const Icon = getIconForClass(classType!);
44+
4145
const handleDetailsToggle = useCallback((state: boolean) => {
4246
setOpen(state);
4347
}, []);
@@ -101,7 +105,10 @@ export function ResourceSideBar({
101105
title={description}
102106
ref={spanRef}
103107
>
104-
{title}
108+
<TextWrapper>
109+
<Icon />
110+
{title}
111+
</TextWrapper>
105112
</SideBarItem>
106113
</Title>
107114
<FloatingActions subject={subject} />
@@ -137,3 +144,14 @@ const Title = styled(AtomicLink)<TitleProps>`
137144
overflow: hidden;
138145
white-space: nowrap;
139146
`;
147+
148+
const TextWrapper = styled.span`
149+
display: inline-flex;
150+
align-items: center;
151+
gap: 0.4rem;
152+
153+
svg {
154+
/* color: ${p => p.theme.colors.text}; */
155+
font-size: 0.8em;
156+
}
157+
`;

0 commit comments

Comments
 (0)