Skip to content

Commit e99083c

Browse files
Highlight Icons in NavSidebar (#31)
* Finish Secondary Nav * Add highlight on navSidebar * fix: enable highlight * fix: remove sidebar use in 'organism' component this caused `Error: Invariant failed: You should not use <Link> outside a <Router>` errors in storybook and repeats functionality found in `organisms/DisplayNavAndPage.tsx` Co-authored-by: Safin Singh <safin.singh@gmail.com>
1 parent a5dde6e commit e99083c

File tree

4 files changed

+31
-12
lines changed

4 files changed

+31
-12
lines changed

src/components/organisms/DirectMessages.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import SearchBar from '../atoms/SearchBar'
66
import WordWithLine from '../atoms/WordWithLine'
77
import GroupDmCard from '../molecules/GroupDmCard'
88
import UserDmCard from '../molecules/UserDmCard'
9-
import Sidebar from './NavSidebar'
109

1110
const DirectMessages = () => {
1211
return (
@@ -17,7 +16,6 @@ const DirectMessages = () => {
1716
borderBottomRightRadius="45px"
1817
direction="row"
1918
>
20-
<Sidebar />
2119
<Flex w="100%" justifyContent="center" direction="row">
2220
<Flex w="85%" paddingY="30px" direction="column">
2321
<Text fontSize="25px" color="white">

src/components/organisms/DisplayNavAndPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default function DisplayNavAndPage({
1212
return (
1313
<Stack spacing={4} direction="row" width="calc(100% - 20px)">
1414
<Box marginRight="25px">
15-
<NavSidebar />
15+
<NavSidebar active="dm" />
1616
</Box>
1717
<Stack spacing={8} marginTop="15px" width="100%">
1818
{children}

src/components/organisms/NavSidebar.tsx

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ import { Link } from 'react-router-dom'
1515

1616
import { commonShadow } from '../common'
1717

18-
export default function Sidebar() {
18+
interface navProps {
19+
active: string
20+
}
21+
22+
export default function Sidebar(props: navProps) {
1923
return (
2024
<Flex
2125
direction="column"
@@ -87,37 +91,54 @@ export default function Sidebar() {
8791
>
8892
<Link to="/chat">
8993
<FontAwesomeIcon
90-
color="#979797"
94+
color={props.active === 'dm' ? '#fff' : '#979797'}
9195
size="lg"
9296
cursor="pointer"
9397
icon={faComment}
98+
style={
99+
props.active === 'dm'
100+
? { filter: 'drop-shadow(0px 0px 10px #4F80E2)' }
101+
: {}
102+
}
94103
/>
95104
</Link>
96-
97105
<Link to="/explore">
98106
<FontAwesomeIcon
99-
color="#979797"
107+
color={props.active === 'explore' ? '#fff' : '#979797'}
100108
size="lg"
101109
cursor="pointer"
102110
icon={faCompass}
111+
style={
112+
props.active === 'explore'
113+
? { filter: 'drop-shadow(0px 0px 10px #4F80E2)' }
114+
: {}
115+
}
103116
/>
104117
</Link>
105-
106118
<Link to="/users">
107119
<FontAwesomeIcon
108-
color="#979797"
120+
color={props.active === 'friends' ? '#fff' : '#979797'}
109121
size="lg"
110122
cursor="pointer"
111123
icon={faUsers}
124+
style={
125+
props.active === 'friends'
126+
? { filter: 'drop-shadow(0px 0px 10px #4F80E2)' }
127+
: {}
128+
}
112129
/>
113130
</Link>
114-
115131
<Link to="/community">
116132
<FontAwesomeIcon
117-
color="#979797"
133+
color={props.active === 'communities' ? '#fff' : '#979797'}
118134
size="lg"
119135
cursor="pointer"
120136
icon={faGlobeAmericas}
137+
style={
138+
props.active === 'communities'
139+
? { filter: 'drop-shadow(0px 0px 10px #4F80E2)' }
140+
: {}
141+
}
121142
/>
122143
</Link>
123144
</Flex>

src/pages/Home.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default function Home(): JSX.Element {
1212
return (
1313
<Stack spacing={4} direction="row" width="100%">
1414
<Box marginRight="25px">
15-
<NavSidebar />
15+
<NavSidebar active="dm" />
1616
</Box>
1717
<Stack spacing={8} marginTop="15px" marginRight="15px" width="100%">
1818
<FindInterface />

0 commit comments

Comments
 (0)