-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes to AlertContent and provides functionality for text or container
- Loading branch information
1 parent
1d3d053
commit 1b50dd1
Showing
15 changed files
with
97 additions
and
77 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
docs/pages/api/alert-description.js → docs/pages/api/alert-content.js
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
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
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
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
13 changes: 13 additions & 0 deletions
13
packages/material-ui-lab/src/AlertContent/AlertContent.d.ts
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,13 @@ | ||
import * as React from 'react'; | ||
import { StandardProps } from '@material-ui/core'; | ||
|
||
export interface AlertContentProps | ||
extends StandardProps<React.HTMLAttributes<HTMLDivElement>, AlertContentClassKey> { | ||
variant?: 'text' | 'container'; | ||
} | ||
|
||
export type AlertContentClassKey = 'root'; | ||
|
||
declare const AlertContent: React.ComponentType<AlertContentProps>; | ||
|
||
export default AlertContent; |
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,58 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { withStyles } from '@material-ui/core/styles'; | ||
import { Typography } from '@material-ui/core'; | ||
import clsx from 'clsx'; | ||
|
||
export const styles = () => ({ | ||
root: {}, | ||
}); | ||
|
||
const AlertContent = React.forwardRef(function AlertContent(props, ref) { | ||
const { | ||
classes, | ||
children, | ||
className, | ||
variant = 'text', | ||
} = props; | ||
|
||
const content = variant === 'text' ? ( | ||
<Typography> | ||
{children} | ||
</Typography> | ||
) : children; | ||
|
||
return ( | ||
<div className={clsx(classes.root, className)} ref={ref}> | ||
{content} | ||
</div> | ||
); | ||
}); | ||
|
||
AlertContent.propTypes = { | ||
/** | ||
* @ignore | ||
*/ | ||
children: PropTypes.node.isRequired, | ||
|
||
/** | ||
* Override or extend the styles applied to the component. | ||
* See [CSS API](#css) below for more details. | ||
*/ | ||
classes: PropTypes.object.isRequired, | ||
|
||
/** | ||
* @ignore | ||
*/ | ||
className: PropTypes.string, | ||
|
||
/** | ||
* The variant to use. | ||
* Use `text` to conditionally wrap the description with a "Typography". | ||
* Use `container` to leave the children unchanged. | ||
* @default text | ||
*/ | ||
variant: PropTypes.oneOf(['text', 'container']), | ||
}; | ||
|
||
export default withStyles(styles, { name: 'MuiAlertContent' })(AlertContent); |
8 changes: 4 additions & 4 deletions
8
...AlertDescription/AlertDescription.test.js → ...lab/src/AlertContent/AlertContent.test.js
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
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,2 @@ | ||
export { default } from './AlertContent'; | ||
export * from './AlertContent'; |
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 @@ | ||
export { default } from './AlertContent'; |
11 changes: 0 additions & 11 deletions
11
packages/material-ui-lab/src/AlertDescription/AlertDescription.d.ts
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
packages/material-ui-lab/src/AlertDescription/AlertDescription.js
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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