feat: design my apps along with app layout

This commit is contained in:
Ali BARIN
2021-12-14 00:43:35 +01:00
committed by Ömer Faruk Aydın
parent 3785c705ff
commit 6da8557219
13 changed files with 156 additions and 113 deletions

View File

@@ -0,0 +1,30 @@
import * as React from 'react';
import { useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
import Button from '@mui/material/Button';
import { IconButton } from './style';
export default function ConditionalIconButton(props: any) {
const { Icon, ...buttonProps } = props;
const theme = useTheme();
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md'), { noSsr: true });
if (matchSmallScreens) {
return (
<IconButton
color={buttonProps.color}
type={buttonProps.type}
size={buttonProps.size}
component={buttonProps.component}
to={buttonProps.to}
>
<Icon />
</IconButton>
)
}
return (
<Button {...buttonProps} />
);
}

View File

@@ -0,0 +1,13 @@
import { styled } from '@mui/material/styles';
import MuiIconButton, { iconButtonClasses } from '@mui/material/IconButton';
export const IconButton = styled(MuiIconButton)`
&.${iconButtonClasses.colorPrimary} {
background: ${({ theme }) => theme.palette.primary.main};
color: ${({ theme }) => theme.palette.primary.contrastText};
&:hover {
background: ${({ theme }) => theme.palette.primary.dark};
}
}
` as typeof MuiIconButton;