Created
April 23, 2021 18:33
-
-
Save sloyer/58d46a1aa983f49199e5cd192332de9c to your computer and use it in GitHub Desktop.
This file contains 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 AcfMediaText from '@/components/organisms/AcfMediaText' | |
import getImg from '@/functions/getImg' | |
import PropTypes from 'prop-types' | |
/** | |
* Handle the AcfBlockMediaText block. | |
* | |
* @author WebDevStudios | |
* @param {object} props The props. | |
* @param {object} props.attributes The attributes object. | |
* @return {Element} The component. | |
*/ | |
export default function AcfBlockMediaText({attributes}) { | |
// TODO: Query the DB for the image ID and replace the attributes.data with the correct information. | |
let attrData = { | |
...attributes.data | |
} | |
getImg(attributes.data.file).then((img) => { | |
attrData.image = img | |
}) | |
return ( | |
<> | |
{attrData ? ( | |
<AcfMediaText {...attrData} /> | |
) : ( | |
'There was a problem with attributes in AcfBlockMediaText.js.' | |
)} | |
</> | |
) | |
} | |
AcfBlockMediaText.propTypes = { | |
attributes: PropTypes.object | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment