Skip to content

Commit e06c924

Browse files
committed
Change display Sidebar conditionally, change name of variable, delete unnecessary comment
- Change name isMobile to isSmallScreen, small screen doesn't have to be mobile - Sidebar is rendered conditionally to improve performance
1 parent 92ad80d commit e06c924

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/pages/App.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function UnauthorizedRoutes() {
7474
function AuthorizedRoutes() {
7575
const location = useLocation();
7676
const height = use100vh();
77-
const isMobile = useMediaQuery({
77+
const isSmallScreen = useMediaQuery({
7878
query: "(max-width: 1023px)",
7979
});
8080

@@ -111,16 +111,17 @@ function AuthorizedRoutes() {
111111
},
112112
});
113113

114-
// Testing overflow should be hidden
115114
return (
116115
<div className={classes.AppWrapper} style={{ height, overflow: "hidden" }}>
117-
<Sidebar>
118-
<Navigation />
119-
</Sidebar>
116+
{!isSmallScreen && (
117+
<Sidebar>
118+
<Navigation />
119+
</Sidebar>
120+
)}
120121
{transitions.map(({ item, props, key }) => {
121122
return (
122123
<animated.div key={key} style={props}>
123-
{isMobile ? (
124+
{isSmallScreen ? (
124125
<Switch location={item}>
125126
<Route exact path={HOME} component={Navigation} />
126127
<Route path={NEW_CONVERSATION} component={NewConversation} />

0 commit comments

Comments
 (0)