Skip to content

Instantly share code, notes, and snippets.

@mieradi
Created January 4, 2020 16:18
Show Gist options
  • Select an option

  • Save mieradi/5a19a985e49b187e6d7ead836e863fc1 to your computer and use it in GitHub Desktop.

Select an option

Save mieradi/5a19a985e49b187e6d7ead836e863fc1 to your computer and use it in GitHub Desktop.
Simple and helpful title component
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