Skip to content

Instantly share code, notes, and snippets.

@sloyer
Created April 23, 2021 18:33
Show Gist options
  • Save sloyer/58d46a1aa983f49199e5cd192332de9c to your computer and use it in GitHub Desktop.
Save sloyer/58d46a1aa983f49199e5cd192332de9c to your computer and use it in GitHub Desktop.
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