-
Notifications
You must be signed in to change notification settings - Fork 16
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
AppBar: Add support for custom branding #792
Changes from 7 commits
1c41c72
2bf94a4
5ba93a2
af59dc5
4b572b0
d5dc13f
0b15419
ea18959
f28a643
a2dc022
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import React from 'react'; | ||
import { Divider, Hidden, IconButton } from '@mui/material'; | ||
import { styled } from '@mui/material/styles'; | ||
import { alpha, styled } from '@mui/material/styles'; | ||
import { MenuOutlined } from '@mui/icons-material'; | ||
|
||
import { APPBAR_SIZE } from '../../../theme/themeConstants'; | ||
|
@@ -12,22 +12,32 @@ const Menu = styled('div')(({ theme }) => ({ | |
marginRight: theme.spacing(1.5) | ||
})); | ||
|
||
const MenuButton = styled(IconButton)(({ theme }) => ({ | ||
const MenuButton = styled(IconButton, { | ||
shouldForwardProp: (prop) => prop !== 'iconColor' | ||
})(({ iconColor, theme }) => ({ | ||
marginRight: theme.spacing(1), | ||
|
||
'&.MuiButtonBase-root svg path': { | ||
fill: theme.palette.background.paper | ||
fill: iconColor || theme.palette.background.paper | ||
} | ||
})); | ||
|
||
export default function BurguerMenu({ onClickMenu }) { | ||
const MenuDivider = styled(Divider, { | ||
shouldForwardProp: (prop) => prop !== 'color' | ||
})(({ color, theme }) => ({ | ||
...(color && { | ||
borderColor: alpha(color, 0.12) | ||
}) | ||
})); | ||
|
||
export default function BurguerMenu({ onClickMenu, iconColor }) { | ||
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. minor, shouldn't it be burger instead of burguer ? 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. Nice catch, fixed, thanks! 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. it looks yummy in any case |
||
return ( | ||
<Hidden mdUp> | ||
<Menu> | ||
<MenuButton onClick={onClickMenu}> | ||
<MenuButton onClick={onClickMenu} iconColor={iconColor}> | ||
<MenuOutlined /> | ||
</MenuButton> | ||
<Divider orientation='vertical' flexItem light /> | ||
<MenuDivider orientation='vertical' flexItem light color={iconColor} /> | ||
</Menu> | ||
</Hidden> | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import React from 'react'; | ||
import React, { useState } from 'react'; | ||
import { | ||
Box, | ||
Chip, | ||
|
@@ -11,7 +11,9 @@ import { | |
TableBody, | ||
Table, | ||
IconButton, | ||
MenuItem | ||
MenuItem, | ||
TableFooter, | ||
TablePagination | ||
} from '@mui/material'; | ||
import SelectField from '../../../src/components/atoms/SelectField'; | ||
import { MoreVertOutlined } from '@mui/icons-material'; | ||
|
@@ -52,7 +54,15 @@ const rows = [ | |
const options = { | ||
title: 'Molecules/Table', | ||
component: Table, | ||
argTypes: {}, | ||
argTypes: { | ||
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. Offtopic... story improved as a design request |
||
size: { | ||
defaultValue: 'medium', | ||
control: { | ||
type: 'select', | ||
options: ['medium', 'small'] | ||
} | ||
} | ||
}, | ||
parameters: { | ||
design: { | ||
type: 'figma', | ||
|
@@ -69,7 +79,7 @@ export default options; | |
const PlaygroundTemplate = (args) => { | ||
return ( | ||
<TableContainer> | ||
<Table aria-label='simple table'> | ||
<Table {...args} aria-label='simple table'> | ||
<TableHead> | ||
<TableRow> | ||
<TableCell>#</TableCell> | ||
|
@@ -145,7 +155,7 @@ const PlaygroundTemplate = (args) => { | |
const ScrollTemplate = (args) => ( | ||
<Box sx={{ width: '100%', overflow: 'hidden' }}> | ||
<TableContainer sx={{ maxWidth: 440, maxHeight: 300 }}> | ||
<Table aria-label='simple table'> | ||
<Table {...args} aria-label='simple table'> | ||
<TableHead> | ||
<TableRow> | ||
<TableCell>#</TableCell> | ||
|
@@ -218,8 +228,110 @@ const ScrollTemplate = (args) => ( | |
</Box> | ||
); | ||
|
||
const PaginationTemplate = (args) => { | ||
const [page, setPage] = useState(0); | ||
const [rowsPerPage, setRowsPerPage] = useState(10); | ||
|
||
const handleChangePage = (event, newPage) => { | ||
setPage(newPage); | ||
}; | ||
|
||
const handleChangeRowsPerPage = (event) => { | ||
setRowsPerPage(parseInt(event.target.value, 10)); | ||
setPage(0); | ||
}; | ||
|
||
return ( | ||
<TableContainer> | ||
<Table {...args} aria-label='simple table'> | ||
<TableHead> | ||
<TableRow> | ||
<TableCell>#</TableCell> | ||
<TableCell>Name</TableCell> | ||
<TableCell>Type</TableCell> | ||
<TableCell>Mode</TableCell> | ||
<TableCell>Description</TableCell> | ||
<TableCell>Actions</TableCell> | ||
</TableRow> | ||
</TableHead> | ||
<TableBody> | ||
{rows.map((row, index) => ( | ||
<TableRow hover key={index}> | ||
<TableCell component='th' scope='row'> | ||
{index + 1} | ||
</TableCell> | ||
<TableCell sx={{ maxWidth: 160 }}> | ||
{index === 1 ? ( | ||
<Tooltip title={row.name}> | ||
<Typography variant='inherit' noWrap> | ||
{row.name} | ||
</Typography> | ||
</Tooltip> | ||
) : ( | ||
row.name | ||
)} | ||
</TableCell> | ||
<TableCell> | ||
<Chip size='small' color='default' label={row.type} /> | ||
</TableCell> | ||
<TableCell> | ||
<SelectField | ||
size='small' | ||
placeholder='Placeholder' | ||
onChange={() => void 0} | ||
value={[]} | ||
> | ||
{[...Array(3)].map((item, index) => { | ||
const itemText = `${index + 1}`; | ||
|
||
return ( | ||
<MenuItem key={index} value={itemText}> | ||
{itemText} | ||
</MenuItem> | ||
); | ||
})} | ||
</SelectField> | ||
</TableCell> | ||
<TableCell sx={{ maxWidth: 160 }}> | ||
{index === 3 ? ( | ||
<Tooltip title={row.description}> | ||
<Typography variant='inherit' noWrap> | ||
{row.description} | ||
</Typography> | ||
</Tooltip> | ||
) : ( | ||
row.description | ||
)} | ||
</TableCell> | ||
<TableCell padding='checkbox'> | ||
<IconButton size='small'> | ||
<MoreVertOutlined /> | ||
</IconButton> | ||
</TableCell> | ||
</TableRow> | ||
))} | ||
</TableBody> | ||
<TableFooter> | ||
<TableRow> | ||
<TablePagination | ||
count={100} | ||
page={page} | ||
onPageChange={handleChangePage} | ||
rowsPerPage={rowsPerPage} | ||
onRowsPerPageChange={handleChangeRowsPerPage} | ||
/> | ||
</TableRow> | ||
</TableFooter> | ||
</Table> | ||
</TableContainer> | ||
); | ||
}; | ||
|
||
export const Playground = PlaygroundTemplate.bind({}); | ||
Playground.args = {}; | ||
|
||
export const Scroll = ScrollTemplate.bind({}); | ||
ScrollTemplate.args = {}; | ||
|
||
export const WithPagination = PaginationTemplate.bind({}); | ||
PaginationTemplate.args = {}; |
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.
Oks, I see the gap, 👍🏻