Created
January 4, 2020 16:18
-
-
Save mieradi/5a19a985e49b187e6d7ead836e863fc1 to your computer and use it in GitHub Desktop.
Simple and helpful title component
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
| const Title = props => { | |
| switch (true) { | |
| case props.h2: | |
| return <h2>{props.title}</h2>; | |
| case props.h3: | |
| return <h3>{props.title}</h3>; | |
| case props.h4: | |
| return <h4>{props.title}</h4>; | |
| case props.h5: | |
| return <h5>{props.title}</h5>; | |
| case props.h6: | |
| return <h6>{props.title}</h6>; | |
| default: | |
| return <h1>{props.title}</h1>; | |
| } | |
| }; | |
| // For an H2, use like so: | |
| <Title h2 title="my cool title" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment