-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: Extracted similar code used in other projects
- Loading branch information
1 parent
05d6c0c
commit d7ecc2d
Showing
4 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
library/src/components/Dialog/DialogContentBody.styles.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Box, SxProps, Theme } from '@mui/material'; | ||
import { styled } from '@mui/styles'; | ||
|
||
type StyledDialogContentBodyProps = { | ||
sx?: SxProps<Theme>; | ||
}; | ||
|
||
export const StyledDialogContentBody = styled( | ||
Box | ||
)<StyledDialogContentBodyProps>(({ sx }) => { | ||
const resolvedStyles = { | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
...sx, | ||
}; | ||
|
||
return resolvedStyles as any; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { SxProps, Theme } from '@mui/material'; | ||
import { StyledDialogContentBody } from './DialogContentBody.styles'; | ||
|
||
interface DialogContentProps { | ||
child: JSX.Element; | ||
sx?: SxProps<Theme>; | ||
} | ||
const DialogContentBody = (props: DialogContentProps) => { | ||
const { child, sx } = props; | ||
return ( | ||
<StyledDialogContentBody sx={{ ...sx }}>{child}</StyledDialogContentBody> | ||
); | ||
}; | ||
|
||
export default DialogContentBody; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import ErrorIcon from '@mui/icons-material/Error'; | ||
|
||
interface ErrorMessage { | ||
message?: string; | ||
} | ||
|
||
const ErrorMessageComponent = (props: ErrorMessage) => { | ||
const { message } = props; | ||
return ( | ||
<span> | ||
<ErrorIcon | ||
sx={{ | ||
verticalAlign: 'bottom', | ||
}} | ||
/> | ||
{message ?? 'There was a problem'} | ||
</span> | ||
); | ||
}; | ||
|
||
export default ErrorMessageComponent; |