mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Added a common table MUI style object which can be used on any table.
Added a few more styling improvements.
This commit is contained in:
parent
bae8a2bd5d
commit
5c65766ece
@ -13,7 +13,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { useMemo } from 'react';
|
import React, { useMemo } from 'react';
|
||||||
import { createMuiTheme, ThemeProvider } from '@material-ui/core/styles';
|
import { createMuiTheme, ThemeProvider, makeStyles } from '@material-ui/core/styles';
|
||||||
import CustomPropTypes from '../custom_prop_types';
|
import CustomPropTypes from '../custom_prop_types';
|
||||||
|
|
||||||
import getStandardTheme from './standard';
|
import getStandardTheme from './standard';
|
||||||
@ -51,7 +51,7 @@ basicSettings = createMuiTheme(basicSettings, {
|
|||||||
root: {
|
root: {
|
||||||
textTransform: 'none',
|
textTransform: 'none',
|
||||||
minHeight: 0,
|
minHeight: 0,
|
||||||
padding: '5px 10px',
|
padding: '3px 10px',
|
||||||
[basicSettings.breakpoints.up('xs')]: {
|
[basicSettings.breakpoints.up('xs')]: {
|
||||||
minWidth: 0,
|
minWidth: 0,
|
||||||
},
|
},
|
||||||
@ -76,8 +76,15 @@ basicSettings = createMuiTheme(basicSettings, {
|
|||||||
padding: basicSettings.spacing(0.5, 1.5),
|
padding: basicSettings.spacing(0.5, 1.5),
|
||||||
'&.Mui-disabled': {
|
'&.Mui-disabled': {
|
||||||
opacity: 0.65,
|
opacity: 0.65,
|
||||||
|
},
|
||||||
|
'&.MuiButton-outlinedSizeSmall': {
|
||||||
|
height: '28px',
|
||||||
|
fontSize: '0.875rem',
|
||||||
|
'& .MuiSvgIcon-root': {
|
||||||
|
height: '0.8em',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
},
|
||||||
contained: {
|
contained: {
|
||||||
boxShadow: 'none',
|
boxShadow: 'none',
|
||||||
'&:hover': {
|
'&:hover': {
|
||||||
@ -89,7 +96,7 @@ basicSettings = createMuiTheme(basicSettings, {
|
|||||||
},
|
},
|
||||||
startIcon: {
|
startIcon: {
|
||||||
marginRight: basicSettings.spacing(0.5),
|
marginRight: basicSettings.spacing(0.5),
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
MuiOutlinedInput: {
|
MuiOutlinedInput: {
|
||||||
multiline: {
|
multiline: {
|
||||||
@ -168,17 +175,19 @@ basicSettings = createMuiTheme(basicSettings, {
|
|||||||
zIndex: 9999,
|
zIndex: 9999,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
MuiMenu: {
|
||||||
|
list: {
|
||||||
|
padding: '0',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
MuiMenuItem: {
|
||||||
|
root: {
|
||||||
|
fontSize: 14,
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
transitions: {
|
transitions: {
|
||||||
duration: {
|
create: () => 'none',
|
||||||
shortest: 50,
|
|
||||||
shorter: 100,
|
|
||||||
short: 150,
|
|
||||||
standard: 200,
|
|
||||||
complex: 175,
|
|
||||||
enteringScreen: 125,
|
|
||||||
leavingScreen: 95,
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
zIndex: {
|
zIndex: {
|
||||||
modal: 2000,
|
modal: 2000,
|
||||||
@ -205,6 +214,12 @@ basicSettings = createMuiTheme(basicSettings, {
|
|||||||
},
|
},
|
||||||
MuiDialogTitle: {
|
MuiDialogTitle: {
|
||||||
disableTypography: true,
|
disableTypography: true,
|
||||||
|
},
|
||||||
|
MuiCardHeader: {
|
||||||
|
disableTypography: true,
|
||||||
|
},
|
||||||
|
MuiListItem: {
|
||||||
|
disableGutters: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -214,6 +229,9 @@ function getFinalTheme(baseTheme) {
|
|||||||
let mixins = {
|
let mixins = {
|
||||||
panelBorder: {
|
panelBorder: {
|
||||||
border: '1px solid '+baseTheme.otherVars.borderColor,
|
border: '1px solid '+baseTheme.otherVars.borderColor,
|
||||||
|
all: {
|
||||||
|
border: '1px solid '+baseTheme.otherVars.borderColor,
|
||||||
|
},
|
||||||
top: {
|
top: {
|
||||||
borderTop: '1px solid '+baseTheme.otherVars.borderColor,
|
borderTop: '1px solid '+baseTheme.otherVars.borderColor,
|
||||||
},
|
},
|
||||||
@ -227,6 +245,16 @@ function getFinalTheme(baseTheme) {
|
|||||||
nodeIcon: {
|
nodeIcon: {
|
||||||
backgroundPosition: 'center',
|
backgroundPosition: 'center',
|
||||||
padding: baseTheme.spacing(0, 1.5),
|
padding: baseTheme.spacing(0, 1.5),
|
||||||
|
},
|
||||||
|
tabPanel: {
|
||||||
|
height: '100%',
|
||||||
|
padding: baseTheme.spacing(1),
|
||||||
|
overflow: 'auto',
|
||||||
|
backgroundColor: baseTheme.palette.grey[400],
|
||||||
|
position: 'relative',
|
||||||
|
},
|
||||||
|
fontSourceCode: {
|
||||||
|
fontFamily: '"Source Code Pro", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -412,6 +440,43 @@ function getFinalTheme(baseTheme) {
|
|||||||
...mixins.panelBorder.bottom,
|
...mixins.panelBorder.bottom,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
MuiCardHeader: {
|
||||||
|
root: {
|
||||||
|
padding: '4px 8px',
|
||||||
|
...mixins.panelBorder.bottom,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
MuiCardContent: {
|
||||||
|
root: {
|
||||||
|
padding: 0,
|
||||||
|
'&:last-child': {
|
||||||
|
paddingBottom: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
MuiListItem: {
|
||||||
|
root: {
|
||||||
|
padding: 0,
|
||||||
|
color: baseTheme.palette.text.primary,
|
||||||
|
backgroundColor: baseTheme.palette.background.default,
|
||||||
|
flexDirection: 'column',
|
||||||
|
alignItems: 'initial',
|
||||||
|
padding: '0px 4px',
|
||||||
|
paddingTop: '0px',
|
||||||
|
paddingBottom: '0px',
|
||||||
|
...mixins.panelBorder.top,
|
||||||
|
...mixins.panelBorder.bottom,
|
||||||
|
borderTopColor: 'transparent',
|
||||||
|
cursor: 'pointer',
|
||||||
|
'&$selected': {
|
||||||
|
backgroundColor: baseTheme.palette.primary.light,
|
||||||
|
borderColor: baseTheme.palette.primary.main,
|
||||||
|
'&:hover': {
|
||||||
|
backgroundColor: baseTheme.palette.primary.light,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, baseTheme);
|
}, baseTheme);
|
||||||
}
|
}
|
||||||
@ -443,3 +508,77 @@ export default function Theme(props) {
|
|||||||
Theme.propTypes = {
|
Theme.propTypes = {
|
||||||
children: CustomPropTypes.children,
|
children: CustomPropTypes.children,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const commonTableStyles = makeStyles((theme)=>({
|
||||||
|
table: {
|
||||||
|
borderSpacing: 0,
|
||||||
|
width: '100%',
|
||||||
|
overflow: 'auto',
|
||||||
|
backgroundColor: theme.otherVars.tableBg,
|
||||||
|
border: '1px solid '+theme.otherVars.borderColor,
|
||||||
|
'& tbody td, & thead th': {
|
||||||
|
margin: 0,
|
||||||
|
padding: theme.spacing(0.5),
|
||||||
|
border: '1px solid '+theme.otherVars.borderColor,
|
||||||
|
borderBottom: 'none',
|
||||||
|
position: 'relative',
|
||||||
|
overflow: 'hidden',
|
||||||
|
textOverflow: 'ellipsis',
|
||||||
|
whiteSpace: 'nowrap',
|
||||||
|
userSelect: 'text',
|
||||||
|
'&:first-of-type':{
|
||||||
|
borderLeft: 'none',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'& thead tr:first-of-type th': {
|
||||||
|
borderTop: 'none',
|
||||||
|
},
|
||||||
|
'& tbody tr:last-of-type': {
|
||||||
|
'&:hover td': {
|
||||||
|
borderBottomColor: theme.palette.primary.main,
|
||||||
|
},
|
||||||
|
'& td': {
|
||||||
|
borderBottomColor: theme.otherVars.borderColor,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'& th': {
|
||||||
|
fontWeight: theme.typography.fontWeightBold,
|
||||||
|
padding: theme.spacing(1, 0.5),
|
||||||
|
textAlign: 'left',
|
||||||
|
},
|
||||||
|
'& tbody > tr': {
|
||||||
|
'&:hover': {
|
||||||
|
backgroundColor: theme.palette.primary.light,
|
||||||
|
'& td': {
|
||||||
|
borderBottom: '1px solid '+theme.palette.primary.main,
|
||||||
|
borderTop: '1px solid '+theme.palette.primary.main,
|
||||||
|
},
|
||||||
|
'&:last-of-type td': {
|
||||||
|
borderBottomColor: theme.palette.primary.main,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
noBorder: {
|
||||||
|
border: 0,
|
||||||
|
},
|
||||||
|
borderBottom: {
|
||||||
|
'& tbody tr:last-of-type td': {
|
||||||
|
borderBottom: '1px solid '+theme.otherVars.borderColor,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
noHover: {
|
||||||
|
'& tbody > tr': {
|
||||||
|
'&:hover': {
|
||||||
|
backgroundColor: theme.otherVars.tableBg,
|
||||||
|
'& td': {
|
||||||
|
borderBottomColor: theme.otherVars.borderColor,
|
||||||
|
borderTopColor: theme.otherVars.borderColor,
|
||||||
|
},
|
||||||
|
'&:last-of-type td': {
|
||||||
|
borderBottomColor: theme.otherVars.borderColor,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
Loading…
Reference in New Issue
Block a user