Skip to content

Commit

Permalink
core: Extracted similar code used in other projects
Browse files Browse the repository at this point in the history
  • Loading branch information
rbatistadev committed Oct 3, 2023
1 parent 05d6c0c commit d7ecc2d
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 1 deletion.
2 changes: 1 addition & 1 deletion library/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@irontec/ivoz-ui",
"version": "1.1.16",
"version": "1.1.17",
"description": "UI library used in ivozprovider",
"license": "GPL-3.0",
"main": "index.js",
Expand Down
19 changes: 19 additions & 0 deletions library/src/components/Dialog/DialogContentBody.styles.tsx
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;
});
15 changes: 15 additions & 0 deletions library/src/components/Dialog/DialogContentBody.tsx
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;
21 changes: 21 additions & 0 deletions library/src/components/ErrorMessageComponent.tsx
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;

0 comments on commit d7ecc2d

Please sign in to comment.