Skip to content

Instantly share code, notes, and snippets.

@lseemann
Last active July 20, 2020 17:29
Show Gist options
  • Save lseemann/7e44e02a8c3afbf7d2de1106c95b135f to your computer and use it in GitHub Desktop.
Save lseemann/7e44e02a8c3afbf7d2de1106c95b135f to your computer and use it in GitHub Desktop.
const Refer = ({
headline, body, link, link_text
}: any) => {
if (!headline) {
return (
<EditorAlert block>
Your refer component is missing a headline, which is required.
</EditorAlert>
);
}
if (!link) {
return (
<EditorAlert block>
Your refer component is missing a link, which is required.
</EditorAlert>
);
}
return (
<aside>
<h1>{headline}</h1>
{body
? <p>{body}</p>
: (
<EditorAlert>
<p>
The style guide suggests some body text here, but it’s not required.
</p>
</EditorAlert>
)}
<a href={link}>{link_text || 'Read more'}</a>
</aside>
);
};
export default Refer;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment