Skip to content

Commit 941a34d

Browse files
committed
Incorporate hover effects for sidebar
1 parent 198ad5a commit 941a34d

2 files changed

Lines changed: 29 additions & 17 deletions

File tree

app/containers/SidebarContainer.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,22 @@ import ContactSupportIcon from '@material-ui/icons/ContactSupport';
77
import SettingsIcon from '@material-ui/icons/Settings';
88
import '../stylesheets/SidebarContainer.css';
99

10-
const testIn = () => {
11-
console.log('Hovering in sidebar');
12-
};
13-
const testOut = () => {
14-
console.log('Hovering outside sidebar');
10+
// const [mini, setMini] = useState(false);
11+
let mini = true;
12+
const toggleSidebar = () => {
13+
if (mini) {
14+
console.log('Opening sidebar');
15+
// document.getElementById('mySidebar').style.width = '250px';
16+
mini = false;
17+
} else {
18+
console.log('Closing sidebar');
19+
mini = true;
20+
}
1521
};
1622

1723
const SidebarContainer: React.FC = (): JSX.Element => (
18-
<div className="sidebar-container" onMouseOver={testIn} onMouseOut={testOut}>
19-
<div className="sidebar">
24+
<div className="sidebar-container">
25+
<div className="sidebar" id="mySidebar" onMouseOver={toggleSidebar} onMouseOut={toggleSidebar}>
2026
<img alt="Chronos Logo" id="serviceDashLogo" src={'../assets/icon2Cropped.png'} />
2127
<Link className="sidebar-link" to="/">
2228
<HomeSharpIcon style={{ boxShadow: 'none', width: '40px', height: '40px' }} />
Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
.sidebar-container {
22
color: white;
33
background-color: #24262f;
4-
min-width: 200px;
5-
transition: 0.3s;
4+
min-width: 100px;
5+
transition: 300ms;
6+
overflow: hidden;
7+
z-index: 10;
8+
white-space: nowrap;
69
}
710
/* .material-icons,
811
.icon-text {
@@ -12,14 +15,16 @@
1215
padding-bottom: 3px;
1316
margin-right: 30px;
1417
} */
15-
/* .sidebar-container:hover {
16-
min-width: 400px;
17-
} */
18+
.sidebar-container:hover {
19+
min-width: 200px;
20+
}
1821
.sidebar {
22+
padding-left: 20px;
23+
width: 250px;
1924
position: fixed;
2025
display: flex;
2126
flex-direction: column;
22-
align-items: center;
27+
align-items: left;
2328
justify-items: center;
2429
align-content: center;
2530
}
@@ -29,26 +34,27 @@
2934
}
3035

3136
.sidebar-link {
37+
overflow: hidden;
38+
z-index: 1;
3239
margin: 5px 0;
3340
padding: 1px 5px;
3441
display: flex;
3542
align-items: center;
3643
justify-content: left;
3744
background-color: #24262f;
3845
height: 40px;
39-
width: 150px;
40-
/* width: 42px; */
46+
width: 50px;
4147
border: thin solid rgb(79, 79, 85);
4248
border-radius: 3px;
4349
font-size: 125%;
4450
color: whitesmoke;
4551
text-decoration: none;
46-
transition: 0.2s;
52+
transition: 300ms;
4753
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
4854
}
4955

5056
.sidebar-link:hover {
5157
background-color: #494fee;
5258
color: azure;
53-
/* width: 150px; */
59+
width: 150px;
5460
}

0 commit comments

Comments
 (0)