Skip to content

Commit

Permalink
Add Notification multiLine prop
Browse files Browse the repository at this point in the history
  • Loading branch information
asvarcas committed Apr 19, 2021
1 parent 8ef6045 commit 0be4bb4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/ra-ui-materialui/src/layout/Notification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {

interface Props {
type?: string;
multiLine?: boolean;
}

const useStyles = makeStyles(
Expand All @@ -37,6 +38,9 @@ const useStyles = makeStyles(
undo: {
color: theme.palette.primary.light,
},
multiLine: {
whiteSpace: 'pre-wrap',
},
}),
{ name: 'RaNotification' }
);
Expand All @@ -49,6 +53,7 @@ const Notification: React.FunctionComponent<
type,
className,
autoHideDuration,
multiLine,
...rest
} = props;
const [open, setOpen] = useState(false);
Expand Down Expand Up @@ -96,6 +101,7 @@ const Notification: React.FunctionComponent<
ContentProps={{
className: classnames(
styles[(notification && notification.type) || type],
{ [styles['multiLine']]: multiLine },
className
),
}}
Expand All @@ -118,11 +124,13 @@ const Notification: React.FunctionComponent<

Notification.propTypes = {
type: PropTypes.string,
multiLine: PropTypes.bool,
};

Notification.defaultProps = {
type: 'info',
autoHideDuration: 4000,
multiLine: false,
};

export default Notification;

0 comments on commit 0be4bb4

Please sign in to comment.