Created
February 11, 2019 16:25
-
-
Save ratbeard/a3c57d76d491a4f4f257208c5f71e2df to your computer and use it in GitHub Desktop.
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
export function Logo({ src }: { | |
src: string, | |
}) { | |
return ifPresent(src, ( | |
<div className='web-activity-header-logo'> | |
<img src={src} className='web-activity-header-img' /> | |
</div> | |
)); | |
} | |
import React from 'react' | |
/** | |
* Renders the given markup if the given value is truthy. | |
* Else renders an empty fragment. | |
* | |
* @param value value to check, typically a string that could be undefined or * "". | |
* @param markup jsx markup to render if value is truthy. | |
*/ | |
export function ifPresent(value: any, markup: JSX.Element) { | |
return value ? markup : <></> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment