Skip to content

Commit

Permalink
refactor(testimonial): adjust to volto design | fix avatar image size
Browse files Browse the repository at this point in the history
  • Loading branch information
tarantilis committed Mar 29, 2022
1 parent 640310a commit 546070e
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 27 deletions.
8 changes: 4 additions & 4 deletions src/ui/Testimonial/Testimonial.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Pullquote from '../Pullquote/Pullquote';
import { Grid } from 'semantic-ui-react';

Testimonial.propTypes = {
title: PropTypes.string,
title: PropTypes.string,
};

function Testimonial({ children, ...rest }) {
Expand All @@ -21,7 +21,7 @@ function Testimonial({ children, ...rest }) {

Testimonial.Avatar = ({ children, ...rest }) => {
return (
<Grid.Column mobile={12} tablet={2} computer={2}>
<Grid.Column mobile={12} tablet={3} computer={2}>
<div className="avatar-wrapper">
<Avatar {...rest} image_url={rest.image_url} avatarsize="small">
<Avatar.Content>
Expand All @@ -36,13 +36,13 @@ Testimonial.Avatar = ({ children, ...rest }) => {

Testimonial.Content = ({ children }) => {
return (
<Grid.Column mobile={12} tablet={10} computer={10}>
<Grid.Column mobile={12} tablet={9} computer={10}>
<div className="content">{children}</div>
</Grid.Column>
);
};

Testimonial.Title = ({ children }) => <p className="title">{children}</p>;
Testimonial.Title = ({ children }) => <h3 className="title">{children}</h3>;
Testimonial.Pullquote = ({ children, ...rest }) => (
<Pullquote quotePosition="none">
<Pullquote.Quote>{children}</Pullquote.Quote>
Expand Down
18 changes: 9 additions & 9 deletions src/ui/Testimonial/Testimonial.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ export default {
type: { summary: 'string' },
},
},
avatarTitle: {
avatartitle: {
description: 'avatar title',
type: { summary: 'string' },
},
avatarInfo: {
avatarinfo: {
description: 'avatar metadata',
type: { summary: 'string' },
},
avatarImage: {
avatarimage: {
description: 'testimonial image',
table: {
defaultValue: { summary: '""' },
Expand All @@ -38,9 +38,9 @@ export default {
const InlineTemplate = (args) => (
<Testimonial {...args}>
<Testimonial.Avatar
image_url={args.avatarImage}
title={args.avatarTitle}
metadata={args.avatarInfo}
image_url={args.avatarimage}
title={args.avatartitle}
metadata={args.avatarinfo}
></Testimonial.Avatar>
<Testimonial.Content>
<Testimonial.Title>{args.title}</Testimonial.Title>
Expand All @@ -51,9 +51,9 @@ const InlineTemplate = (args) => (

export const Inline = InlineTemplate.bind({});
Inline.args = {
avatarTitle: 'Jane Doe',
avatarInfo: 'EEA Analyst',
avatarImage: imgUrl,
avatartitle: 'Jane Doe',
avatarinfo: 'EEA Analyst',
avatarimage: imgUrl,
title: 'Amet - Lorem ipsum dolor sit amet',
quote:
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
Expand Down
4 changes: 2 additions & 2 deletions theme/themes/eea/extras/avatar.variables
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
@avatarBigMetadataFontWeight : @normal;

/* Small */
@avatarSmallImageHeight : 150px;
@avatarSmallImageWidth : 150px;
@avatarSmallImageHeight : 135px;
@avatarSmallImageWidth : 135px;
@avatarSmallTitleColor : @secondaryColor;
@avatarSmallMetadataFontSize : 1rem;
@avatarSmallMetadataFontWeight : 300;
44 changes: 38 additions & 6 deletions theme/themes/eea/extras/testimonial.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,53 @@
--------------------*/

.eea.testimonial {
display: flex;
flex-direction: column;
gap: @testimonialGap;
width: @testimonialWidth;

.eea.pullquote {
padding: 1.25rem 0 0;
}

.avatar-wrapper {
display: flex;
justify-content: center;
flex-direction: column;
height: @testimonialAvatarWrapperHeight;
}

.content .title {
.eea.avatar .wrapper {
flex-direction: row-reverse;
align-items: center;
}
}

.eea.testimonial .content h3.title {
margin: @testimonialContentTitleMarginVertical
@mobileTestimonialContentTitleMarginHorizontal;
font-weight: @testimonialContentTitleFontWeight;
color: @testimonialContentTitleColor;
}

.eea.testimonial .ui.grid div:first-child {
order: 1;
}


@media only screen and (min-width: @tabletBreakpoint) {

.eea.testimonial .eea.avatar .wrapper {
flex-direction: column;
}

.eea.testimonial .content h3.title {
margin: @testimonialContentTitleMarginVertical
@testimonialContentTitleMarginHorizontal;
font-weight: @testimonialContentTitleFontWeight;
font-size: @testimonialContentTitleFontSize;
letter-spacing: @testimonialContentTitleLetterSpacing;
color: @testimonialContentTitleColor;
@tabletTestimonialContentTitleMarginHorizontal;
}

.eea.testimonial .ui.grid div:first-child {
order: 0;
}
}

16 changes: 10 additions & 6 deletions theme/themes/eea/extras/testimonial.variables
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@


@testimonialWidth : 100%;
@testimonialGap : @largeGap;
@testimonialAvatarWrapperHeight : 100%;
@testimonialContentTitleMarginVertical : 0;
@testimonialContentTitleMarginHorizontal : 2rem;
@testimonialContentTitleFontWeight : 500;
@testimonialContentTitleFontSize : 36px;
@testimonialContentTitleLetterSpacing : -0.015em;
@testimonialContentTitleColor : @deepBlue;

/* Pullquote */

/* Title */
@testimonialContentTitleMarginVertical : 0;
@mobileTestimonialContentTitleMarginHorizontal : 0;
@tabletTestimonialContentTitleMarginHorizontal : 3.125rem;
@testimonialContentTitleFontWeight : 500;
@testimonialContentTitleColor : @deepBlue;

0 comments on commit 546070e

Please sign in to comment.