Skip to content

Commit 63f3e74

Browse files
committed
Add icon resizing on hover in sidebar container
1 parent 54ace52 commit 63f3e74

7 files changed

Lines changed: 90 additions & 35 deletions

File tree

app/components/About.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'React';
22

33
const About: React.FC = () => {
4-
return <div>Hello this is the About</div>;
4+
return <div className="home">Hello this is the About</div>;
55
};
66

77
export default About;

app/components/Contact.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'React';
22

33
const Contact: React.FC = () => {
4-
return <div>Hello this is the Contact</div>;
4+
return <div className="home">Hello this is the Contact</div>;
55
};
66

77
export default Contact;

app/components/Home.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ const Home = () => (
77
<div className="home">
88
<img src={'../assets/pangolin.png'} alt="Chronos logo" />
99
<h1 id="welcome">Welcome to Chronos!</h1>
10-
<Link className="get-started-btn" to="/applications">Get Started</Link>
10+
<Link className="get-started-btn" to="/applications">
11+
Get Started
12+
</Link>
1113
</div>
1214
);
1315

app/components/Settings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'React';
22

33
const Settings: React.FC = () => {
4-
return <div>Hello this is the Settings</div>;
4+
return <div className="home">Hello this is the Settings</div>;
55
};
66

77
export default Settings;

app/containers/DashboardContainer.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import HealthContextProvider from '../context/HealthContext';
66
import CommsContextProvider from '../context/CommsContext';
77
import ApplicationContextProvider from '../context/ApplicationContext';
88
import DashboardContextProvider from '../context/DashboardContext';
9-
import DockerContextProvider from '../context/DockerContext'
9+
import DockerContextProvider from '../context/DockerContext';
1010

1111
const DashboardContainer = () => (
1212
<Router>
@@ -15,10 +15,10 @@ const DashboardContainer = () => (
1515
<DashboardContextProvider>
1616
<CommsContextProvider>
1717
<DockerContextProvider>
18-
<HealthContextProvider>
19-
<SidebarContainer />
20-
<MainContainer />
21-
</HealthContextProvider>
18+
<HealthContextProvider>
19+
<SidebarContainer />
20+
<MainContainer />
21+
</HealthContextProvider>
2222
</DockerContextProvider>
2323
</CommsContextProvider>
2424
</DashboardContextProvider>
@@ -30,7 +30,7 @@ const DashboardContainer = () => (
3030
// Style
3131
const dashboardStyle = {
3232
display: 'flex',
33-
backgroundColor: '#F7F8FC'
34-
}
33+
backgroundColor: '#F7F8FC',
34+
};
3535

3636
export default DashboardContainer;

app/containers/SidebarContainer.tsx

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

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-
}
21-
};
10+
// Toggle logic if JS needed in the future
2211

12+
let mini = true;
13+
// const toggleSidebar = () => {
14+
// if (mini) {
15+
// console.log('Opening sidebar');
16+
// document.getElementById('mySidebar').style.width = '250px';
17+
// mini = false;
18+
// } else {
19+
// console.log('Closing sidebar');
20+
// mini = true;
21+
// }
22+
// };
2323
const SidebarContainer: React.FC = (): JSX.Element => (
24-
<div className="sidebar-container">
25-
<div className="sidebar" id="mySidebar" onMouseOver={toggleSidebar} onMouseOut={toggleSidebar}>
24+
<div
25+
className="sidebar-container"
26+
id="mySidebar"
27+
/*onMouseOver={toggleSidebar}
28+
onMouseOut={toggleSidebar}*/
29+
>
30+
<div className="sidebar">
2631
<img alt="Chronos Logo" id="serviceDashLogo" src={'../assets/icon2Cropped.png'} />
27-
<Link className="sidebar-link" to="/">
32+
<img alt="Chronos Logo Mini" id="miniLogo" src={'../assets/pangolin.png'} />
33+
<br />
34+
<br />
35+
<br />
36+
<Link className="sidebar-link" to="/" id="home">
2837
<HomeSharpIcon style={{ boxShadow: 'none', width: '40px', height: '40px' }} />
2938
&emsp;Home
3039
</Link>
31-
<Link className="sidebar-link" to="/about">
40+
<Link className="sidebar-link" to="/about" id="about">
3241
<InfoIcon style={{ boxShadow: 'none', width: '40px', height: '40px' }} />
3342
&emsp;About
3443
</Link>
35-
<Link className="sidebar-link" to="/contact">
44+
<Link className="sidebar-link" to="/contact" id="contact">
3645
<ContactSupportIcon style={{ boxShadow: 'none', width: '40px', height: '40px' }} />
3746
&emsp;Contact
3847
</Link>
39-
<Link className="sidebar-link" to="/settings">
48+
<Link className="sidebar-link" to="/settings" id="settings">
4049
<SettingsIcon style={{ boxShadow: 'none', width: '40px', height: '40px' }} />
4150
&emsp;Settings
4251
</Link>

app/stylesheets/SidebarContainer.css

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
.sidebar-container {
22
color: white;
33
background-color: #24262f;
4-
min-width: 100px;
5-
transition: 300ms;
4+
width: 100px;
5+
transition: 900ms;
66
overflow: hidden;
7-
z-index: 10;
7+
z-index: 1;
88
white-space: nowrap;
99
}
10+
/* .sidebar-container:hover .home { */
11+
/* .home {
12+
background-color: black !important;
13+
} */
1014
/* .material-icons,
1115
.icon-text {
1216
vertical-align: middle;
@@ -16,17 +20,58 @@
1620
margin-right: 30px;
1721
} */
1822
.sidebar-container:hover {
19-
min-width: 200px;
23+
width: 200px;
24+
}
25+
.sidebar-container:hover .sidebar-link {
26+
width: 150px;
27+
}
28+
.sidebar-container:hover .sidebar {
29+
width: 200px;
30+
}
31+
.sidebar-container:hover #serviceDashLogo {
32+
opacity: 1;
33+
}
34+
.sidebar-container:hover #miniLogo {
35+
opacity: 0;
36+
}
37+
38+
#home {
39+
transition: 600ms;
40+
}
41+
#about {
42+
transition: 700ms;
43+
}
44+
#contact {
45+
transition: 800ms;
46+
}
47+
#settings {
48+
transition: 900ms;
49+
}
50+
51+
#serviceDashLogo {
52+
opacity: 0;
53+
transition: 900ms;
54+
}
55+
#miniLogo {
56+
position: absolute;
57+
animation: twirl 20s infinite linear;
58+
left: 7px;
59+
top: 35px;
60+
height: 75px;
61+
width: 75px;
62+
opacity: 1;
63+
transition: 400ms;
2064
}
2165
.sidebar {
2266
padding-left: 20px;
23-
width: 250px;
67+
width: 100px;
2468
position: fixed;
2569
display: flex;
2670
flex-direction: column;
2771
align-items: left;
2872
justify-items: center;
2973
align-content: center;
74+
transition: 900ms;
3075
}
3176

3277
.container img {
@@ -56,5 +101,4 @@
56101
.sidebar-link:hover {
57102
background-color: #494fee;
58103
color: azure;
59-
width: 150px;
60104
}

0 commit comments

Comments
 (0)