Commit b4153411 authored by Andy Lamb's avatar Andy Lamb
Browse files

composer not working. Maybe using default name composer is an issue?

parent 32f07a98
Pipeline #40638 passed with stage
in 2 minutes and 54 seconds
......@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import AndyTestContentStyled from '../components.styled/AndyTestContent.styled';
import ContentComposer from '~/features/composer/components/Composer';
import ContentComposerAndy from '~/features/composer/components/ComposerAndy';
const AndyTestContent = ({ className, entry }) => {
if (!entry) return null;
......@@ -17,7 +17,9 @@ const AndyTestContent = ({ className, entry }) => {
<div className="eventContent">
<h1 className="pageTitle">{entry.entryTitle}</h1>
{entry.content && <ContentComposer composer={entry.postContent} />}
{entry.content && (
<ContentComposerAndy composer={entry.composer} /> //was postContent
)}
</div>
</div>
</AndyTestContentStyled>
......
import styled, { css } from 'styled-components';
//import validateProps from '~/utils/validateProps';
//import getIn from '~/utils/getIn';
const ContentComposerAndyStyled = styled.div`
${() => {
return css`
.compField {
margin-bottom: 40px;
}
.contentImage {
margin: 0;
padding: 0;
width: 100%;
}
`;
}}
`;
export default ContentComposerAndyStyled;
import React from 'react';
import PropTypes from 'prop-types';
import ContentComposerAndyStyled from '../components.styled/ComposerAndy.styled';
// import ContactDetails from '~/features/contactDetails/ContactDetails';
const ContentComposerAndy = ({ className, composer }) => {
if (!composer) return null;
return (
<ContentComposerAndyStyled className={className}>
{composer.map((field, idx) => {
switch (field.type) {
case 'image':
return (
<figure className="compField contentImage" key={idx}>
<img
src={field.value.asset.sys.uri}
alt={field.value.altText}
/>
{field.value.caption && (
<figcaption>{field.value.caption}</figcaption>
)}
</figure>
);
case 'markup':
return (
<div className="compField markup" key={idx}>
{field.value.markup}
</div>
);
case 'markupHtml':
return (
<div className="compField markup" key={idx}>
{field.value.markupHtml}
</div>
);
default:
break;
}
})}
</ContentComposerAndyStyled>
);
};
ContentComposerAndy.propTypes = {
className: PropTypes.string,
composer: PropTypes.array,
};
export default ContentComposerAndy;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment