-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added header #20
base: master
Are you sure you want to change the base?
added header #20
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React from 'react'; | ||
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'; | ||
import AppBar from '@material-ui/core/AppBar'; | ||
import Toolbar from '@material-ui/core/Toolbar'; | ||
import Typography from '@material-ui/core/Typography'; | ||
import Button from '@material-ui/core/Button'; | ||
import IconButton from '@material-ui/core/IconButton'; | ||
import MenuIcon from '@material-ui/icons/Menu'; | ||
|
||
const useStyles = makeStyles((theme: Theme) => | ||
createStyles({ | ||
root: { | ||
flexGrow: 1, | ||
}, | ||
menuButton: { | ||
marginRight: theme.spacing(2), | ||
}, | ||
title: { | ||
flexGrow: 1, | ||
}, | ||
}), | ||
); | ||
|
||
export default function ButtonAppBar() { | ||
const classes = useStyles(); | ||
|
||
return ( | ||
<div className={classes.root}> | ||
<AppBar position="static"> | ||
<Toolbar> | ||
<IconButton edge="start" className={classes.menuButton} color="inherit" aria-label="menu"> | ||
<MenuIcon /> | ||
</IconButton> | ||
<Typography variant="h6" className={classes.title}> | ||
News | ||
</Typography> | ||
<Button color="inherit">Login</Button> | ||
</Toolbar> | ||
</AppBar> | ||
</div> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,12 @@ | ||||||||||||||||||||||||||||||||||||||||||
export const getRooms = () => { | ||||||||||||||||||||||||||||||||||||||||||
return [ | ||||||||||||||||||||||||||||||||||||||||||
{ id: 1, roomNumber: 'A100' }, | ||||||||||||||||||||||||||||||||||||||||||
{ id: 2, roomNumber: 'A102' }, | ||||||||||||||||||||||||||||||||||||||||||
{ id: 3, roomNumber: 'A103' }, | ||||||||||||||||||||||||||||||||||||||||||
{ id: 4, roomNumber: 'A201' }, | ||||||||||||||||||||||||||||||||||||||||||
{ id: 5, roomNumber: 'A310' }, | ||||||||||||||||||||||||||||||||||||||||||
{ id: 6, roomNumber: 'A202' }, | ||||||||||||||||||||||||||||||||||||||||||
{ id: 7, roomNumber: 'A107' }, | ||||||||||||||||||||||||||||||||||||||||||
]; | ||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+1
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. отформатируй код, убери лишний return и добавь тип возвращаемого значения
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Добавь пустую строку в конце файла |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,32 @@ | ||||||
import * as React from 'react'; | ||||||
import { getRooms } from "./TeacherService" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Опусти на строчку ниже |
||||||
import { DataGrid, GridColDef, GridValueGetterParams } from '@material-ui/data-grid'; | ||||||
|
||||||
const columns: GridColDef[] = [ | ||||||
{ field: 'id', headerName: 'KeyID', width: 150 }, | ||||||
{ field: 'roomNumber', headerName: 'Room Number', width: 150 }, | ||||||
|
||||||
{ | ||||||
field: 'qrCode', | ||||||
headerName: 'QR Code', | ||||||
description: 'This column get string qrCode using Keyid + number.', | ||||||
sortable: false, | ||||||
width: 160, | ||||||
valueGetter: (params: GridValueGetterParams) => | ||||||
`${params.getValue(params.id, 'id') || ''}${ | ||||||
params.getValue(params.id, 'roomNumber') || '' | ||||||
}`, | ||||||
}, | ||||||
|
||||||
]; | ||||||
|
||||||
const rows = getRooms | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. вообще тащите в UseEffects |
||||||
|
||||||
|
||||||
export default function DataGridDemo() { | ||||||
return ( | ||||||
<div style={{ height: 400, width: '100%' }}> | ||||||
<DataGrid rows={getRooms()} columns={columns} pageSize={5} checkboxSelection /> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Можно пожалуйста текстовое пояснение проблемы я не очень понял что не так у меня There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @SoldatovMikhaul у тебя выше на 23-ей строке уже есть переменная rows |
||||||
</div> | ||||||
); | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Твой текущий файл называется
Header.tsx
а компонент внутриButtonAppBar
, имя компонента должно совпадать с именем файла