Skip to content

Commit

Permalink
use material-ui media query.
Browse files Browse the repository at this point in the history
  • Loading branch information
solring committed Jul 30, 2021
1 parent c45f6f7 commit 3d50193
Show file tree
Hide file tree
Showing 4 changed files with 194 additions and 2 deletions.
189 changes: 189 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^4.12.3",
"@storybook/addon-backgrounds": "^6.3.6",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
Expand Down
4 changes: 3 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useState } from 'react';
import { useMediaQuery } from '@material-ui/core';

import Sidebar from './components/Sidebar';
import AdminScreen from './components/AdminScreen';
Expand All @@ -17,6 +18,7 @@ function App() {
{ title: "Settings", icon: 'settings', link: "/"},
]
const [actives, setActives] = useState(Array(menu.length).fill(false));
const isMidScreen = useMediaQuery(`(max-width: 920px)`)

let itemList = menu.map((e, i) => ({...e, active: actives[i]}));

Expand All @@ -34,7 +36,7 @@ function App() {

<div className="row g-0 vh-100">
<div className="col-2 col-lg-3 h-100">
<Sidebar itemList={itemList} onSelect={onSelect}/>
<Sidebar itemList={itemList} onSelect={onSelect} simple={isMidScreen}/>
</div>

<div className="col-10 col-lg-9 h-100">
Expand Down
2 changes: 1 addition & 1 deletion src/components/Pagenation.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function NumPagenation(props) {

{
nums.map((n) =>
<li key={n} className={`page-item d-none d-md-block ${ n === curr ? "active" : ""}`}>
<li key={n} className={`page-item ${ n === curr ? "active" : ""}`}>
<a className="page-link" onClick={() => onIndex(n)}>{n}</a>
</li>
)
Expand Down

0 comments on commit 3d50193

Please sign in to comment.