forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Typography] Improve custom component types support (mui#18868)
- Loading branch information
1 parent
c77c2e8
commit b6ff4f5
Showing
2 changed files
with
67 additions
and
20 deletions.
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
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,39 @@ | ||
import React, { FC } from 'react'; | ||
import { Typography } from '@material-ui/core'; | ||
|
||
const TypographyTest = () => { | ||
const CustomComponent: React.FC<{ prop1: string; prop2: number }> = () => <div />; | ||
return ( | ||
<div> | ||
<Typography /> | ||
<Typography align="inherit" color="inherit" display="block" /> | ||
<Typography align="left" color="initial" display="inline" /> | ||
<Typography align="right" color="primary" display="initial" /> | ||
<Typography align="justify" color="secondary" display="initial" /> | ||
<Typography align="inherit" color="textPrimary" /> | ||
<Typography align="inherit" color="textSecondary" /> | ||
<Typography align="inherit" color="error" /> | ||
// $ExpectError | ||
<Typography display="incorrectValue" /> | ||
<Typography component="a" href="url" display="block" /> | ||
<Typography component="label" htmlFor="html" display="block" /> | ||
// $ExpectError | ||
<Typography component="a" href="url" display="incorrectValue" /> | ||
// $ExpectError | ||
<Typography component="a" incorrectAttribute="url" /> | ||
// $ExpectError | ||
<Typography component="incorrectComponent" href="url" /> | ||
// $ExpectError | ||
<Typography component="div" href="url" /> | ||
// $ExpectError | ||
<Typography href="url" /> | ||
<Typography component={CustomComponent} prop1="1" prop2={12} /> | ||
// $ExpectError | ||
<Typography component={CustomComponent} prop1="1" prop2={12} id="1" /> | ||
// $ExpectError | ||
<Typography component={CustomComponent} prop1="1" /> | ||
// $ExpectError | ||
<Typography component={CustomComponent} prop1="1" prop2="12" /> | ||
</div> | ||
); | ||
}; |