Skip to content

Commit 618e019

Browse files
updated sidebar link component
1 parent aed1dbf commit 618e019

File tree

3 files changed

+43
-4
lines changed

3 files changed

+43
-4
lines changed

src/components/Sidebar/Sidebar.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ const structure = [
5757
},
5858
{ id: 5, type: "divider" },
5959
{ id: 6, type: "title", label: "HELP" },
60-
{ id: 7, label: "Library", link: "", icon: <LibraryIcon /> },
61-
{ id: 8, label: "Support", link: "", icon: <SupportIcon /> },
62-
{ id: 9, label: "FAQ", link: "", icon: <FAQIcon /> },
60+
{ id: 7, label: "Library", link: "https://flatlogic.com/templates", icon: <LibraryIcon /> },
61+
{ id: 8, label: "Support", link: "https://flatlogic.com/forum", icon: <SupportIcon /> },
62+
{ id: 9, label: "FAQ", link: "https://flatlogic.com/forum", icon: <FAQIcon /> },
6363
{ id: 10, type: "divider" },
6464
{ id: 11, type: "title", label: "PROJECTS" },
6565
{

src/components/Sidebar/components/SidebarLink/SidebarLink.js

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,40 @@ export default function SidebarLink({
4848
);
4949

5050
if (type === "divider") return <Divider className={classes.divider} />;
51-
51+
if (link && link.includes('http')) {
52+
return (
53+
<ListItem
54+
button
55+
className={classes.link}
56+
classes={{
57+
root: classnames(classes.linkRoot, {
58+
[classes.linkActive]: isLinkActive && !nested,
59+
[classes.linkNested]: nested,
60+
}),
61+
}}
62+
disableRipple
63+
>
64+
<a className={classes.externalLink} href={link}>
65+
<ListItemIcon
66+
className={classnames(classes.linkIcon, {
67+
[classes.linkIconActive]: isLinkActive,
68+
})}
69+
>
70+
{nested ? <Dot color={isLinkActive && "primary"} /> : icon}
71+
</ListItemIcon>
72+
<ListItemText
73+
classes={{
74+
primary: classnames(classes.linkText, {
75+
[classes.linkTextActive]: isLinkActive,
76+
[classes.linkTextHidden]: !isSidebarOpened,
77+
}),
78+
}}
79+
primary={label}
80+
/>
81+
</a>
82+
</ListItem>
83+
)
84+
}
5285
if (!children)
5386
return (
5487
<ListItem

src/components/Sidebar/components/SidebarLink/styles.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ export default makeStyles(theme => ({
77
backgroundColor: theme.palette.background.light,
88
},
99
},
10+
externalLink: {
11+
display: 'flex',
12+
justifyContent: 'center',
13+
alignItems: 'center',
14+
textDecoration: 'none'
15+
},
1016
linkActive: {
1117
backgroundColor: theme.palette.background.light,
1218
},

0 commit comments

Comments
 (0)