This file contains hidden or 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
<Title as="h3">I'm an h3</Title> | |
// ⬇ ⬇ ⬇ ⬇ | |
<h3 className="title">I'm an h3</h3> |
This file contains hidden or 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
<h1 className="title">{children}</h1> |
This file contains hidden or 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
import React from 'react'; | |
function Title(props) { | |
const { as: Component, children } = props; | |
return <Component className="title">{children}</Component> | |
} | |
Title.defaultProps = { | |
as: 'h1', | |
}; |
This file contains hidden or 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
<Title as="h2">I am a title rendered as an h2</Title> | |
<Title as="h3">I am a title rendered as an h3</Title> |
This file contains hidden or 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
<body> | |
<div id="main"> | |
<section> | |
<h1 class="title">Demo</h1> | |
</section> | |
</div> | |
</body> |
This file contains hidden or 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
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import Title from './Title'; | |
function Demo() { | |
return( | |
<section> | |
<Title>Demo</Title> | |
</section> | |
); |
This file contains hidden or 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
import React from 'react'; | |
function Title(props) { | |
return <h1 className="title">{props.children}</h1> | |
} | |
export default Title; |
This file contains hidden or 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
.small { | |
font-size: 0.875rem; /* 14px / 16px */ | |
line-height: 1.4285714286; /* 20px / 14px */ | |
} |
NewerOlder