Removed nested card in Status component (#832)

* Removed nested padding on card component

* updated to use spacing function

* Refactored noPadding implementation

* Removed noPadding by default

* trying to fix merge conflict

* Added back no padding after merge conflict
This commit is contained in:
Adil Alimbetov
2020-05-20 12:19:28 +06:00
committed by GitHub
parent b401221e50
commit 0c2fbe1acc
2 changed files with 20 additions and 6 deletions
@@ -68,7 +68,7 @@ const containerStyle = { width: 600 };
export const Default = () => (
<div style={containerStyle}>
<InfoCard title="Available status types">
<InfoCard title="Available status types" noPadding>
<Table
options={{
search: false,
+19 -5
View File
@@ -24,21 +24,28 @@ import {
withStyles,
makeStyles,
} from '@material-ui/core';
import classNames from 'classnames';
import ErrorBoundary from '../ErrorBoundary';
import BottomLink, { Props as BottomLinkProps } from '../BottomLink';
const useStyles = makeStyles((theme) => ({
const useStyles = makeStyles(theme => ({
header: {
padding: theme.spacing(2, 2, 2, 2.5),
},
noPadding: {
padding: 0,
'&:last-child': {
paddingBottom: 0,
},
},
}));
const BoldHeader = withStyles((theme) => ({
const BoldHeader = withStyles(theme => ({
title: { fontWeight: 700 },
subheader: { paddingTop: theme.spacing(1) },
}))(CardHeader);
const CardActionsTopRight = withStyles((theme) => ({
const CardActionsTopRight = withStyles(theme => ({
root: {
display: 'inline-block',
padding: theme.spacing(8, 8, 0, 0),
@@ -127,6 +134,7 @@ type Props = {
cardClassName?: string;
actionsTopRight?: ReactNode;
className?: string;
noPadding?: boolean;
};
const InfoCard: FC<Props> = ({
@@ -144,6 +152,7 @@ const InfoCard: FC<Props> = ({
cardClassName,
actionsTopRight,
className,
noPadding,
}) => {
const classes = useStyles();
@@ -156,7 +165,7 @@ const InfoCard: FC<Props> = ({
if (variant) {
const variants = variant.split(/[\s]+/g);
variants.forEach((name) => {
variants.forEach(name => {
calculatedStyle = {
...calculatedStyle,
...VARIANT_STYLES.card[name as keyof typeof VARIANT_STYLES['card']],
@@ -189,7 +198,12 @@ const InfoCard: FC<Props> = ({
<CardActionsTopRight>{actionsTopRight}</CardActionsTopRight>
)}
{divider && <Divider />}
<CardContent className={cardClassName} style={calculatedCardStyle}>
<CardContent
className={classNames(cardClassName, {
[classes.noPadding]: noPadding,
})}
style={calculatedCardStyle}
>
{children}
</CardContent>
{actions && (