Skip to content

Commit

Permalink
Merge pull request #26 from eea/develop
Browse files Browse the repository at this point in the history
Remove quote block customization
  • Loading branch information
avoinea authored May 19, 2022
2 parents ac56f6b + 41a1dfb commit 276afec
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 28 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,19 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [0.6.0](https://github.com/eea/volto-eea-website-theme/compare/0.5.4...0.6.0)

- Cleanup [`415014b`](https://github.com/eea/volto-eea-website-theme/commit/415014b8399de5ffb5afaa9d6440b4ea5fe2bf2a)
- Release 0.6.0 [`1253ebb`](https://github.com/eea/volto-eea-website-theme/commit/1253ebba2f1c88dbc6b77a135580f3a5d7752729)
- fix(comments): Replace moment with formatRelativeDate helper from Volto core [`9b7974a`](https://github.com/eea/volto-eea-website-theme/commit/9b7974adb3d01065b80f61d7c3c1c09a93199ee6)
- fix(seo): SSR Title block [`887edc2`](https://github.com/eea/volto-eea-website-theme/commit/887edc25e45c44bfe99b909ae87c7fb7a90278a6)
- Remove quote block customization [`4d459f5`](https://github.com/eea/volto-eea-website-theme/commit/4d459f57265c5b0b1e6ff8472e4f0350a888ca04)

#### [0.5.4](https://github.com/eea/volto-eea-website-theme/compare/0.5.3...0.5.4)

> 17 May 2022
- Release [`#25`](https://github.com/eea/volto-eea-website-theme/pull/25)
- Add customization to volto-quote-block icons [`#23`](https://github.com/eea/volto-eea-website-theme/pull/23)
- change (theme): added quote and callout components [`b691da2`](https://github.com/eea/volto-eea-website-theme/commit/b691da29236440a1096fcbf38d9d9e6cc6e69445)
- change(banner): added icon class to banner buttons [`7b641cf`](https://github.com/eea/volto-eea-website-theme/commit/7b641cfdc433fd638ff8ba2c3f4b9131a9f8142a)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-eea-website-theme",
"version": "0.5.4",
"version": "0.6.0",
"description": "@eeacms/volto-eea-website-theme: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
2 changes: 1 addition & 1 deletion src/components/manage/Blocks/Title/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import BannerView from '@eeacms/volto-eea-website-theme/components/theme/Banner/
* @extends Component
*/
const View = (props) => {
if (__SERVER__) return '';
if (__SERVER__) return <BannerView {...props} />;
return (
<Portal node={document.getElementById('page-header')}>
<BannerView {...props} />
Expand Down
20 changes: 13 additions & 7 deletions src/components/theme/Banner/Banner.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { compose } from 'redux';
import { connect } from 'react-redux';
import moment from 'moment';
import { Icon, Button, Grid } from 'semantic-ui-react';
import { formatDate } from '@plone/volto/helpers/Utils/Date';
import config from '@plone/volto/registry';

const socialPlatforms = {
Expand Down Expand Up @@ -72,15 +72,21 @@ Banner.Title = ({ children }) => (
);
Banner.Metadata = ({ children }) => <p className="metadata">{children}</p>;
Banner.MetadataField = ({ hidden, type = 'text', label, value, title }) => {
moment.locale(config.settings.dateLocale || 'en-gb');
const locale = config.settings.dateLocale || 'en-gb';
if (hidden || !value) return '';
if (type === 'date' && value)
return (
<span
className={`field ${type}`}
title={title.replace('{}', value.format('lll'))}
>
{label} {value.format('ll')}
<span className={`field ${type}`} title={title.replace('{}', value)}>
{label}{' '}
{formatDate({
date: value,
format: {
year: 'numeric',
month: 'short',
day: '2-digit',
},
locale: locale,
})}
</span>
);
return <span className={`field ${type}`}>{value}</span>;
Expand Down
11 changes: 5 additions & 6 deletions src/components/theme/Banner/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { startCase } from 'lodash';
import qs from 'querystring';
import { Container, Popup } from 'semantic-ui-react';
import { flattenToAppURL } from '@plone/volto/helpers';
import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
import Banner from './Banner';
import { getImageSource, sharePage } from './Banner';

Expand Down Expand Up @@ -74,7 +73,7 @@ const Title = ({ config = {}, properties }) => {
};

const View = (props) => {
const { banner = {}, moment, fluid, intl, location, types = [] } = props;
const { banner = {}, fluid, intl, location, types = [] } = props;
const metadata = props.metadata || props.properties;
const {
info = [],
Expand All @@ -94,9 +93,9 @@ const View = (props) => {
// Set dates
const getDate = useCallback(
(hidden, key) => {
return !hidden && metadata[key] ? moment.default(metadata[key]) : null;
return !hidden && metadata[key] ? metadata[key] : null;
},
[moment, metadata],
[metadata],
);
const creationDate = useMemo(() => getDate(hideCreationDate, 'created'), [
getDate,
Expand Down Expand Up @@ -241,10 +240,10 @@ const View = (props) => {

export default compose(
injectIntl,
injectLazyLibs(['moment']),
withRouter,
connect((state) => {
return {
types: state.types.types,
};
}),
)(withRouter(View));
)(View);
13 changes: 7 additions & 6 deletions src/customizations/volto/components/theme/Comments/Comments.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import { Portal } from 'react-portal';
import { connect } from 'react-redux';
import { compose } from 'redux';
import { Button, Comment, Container, Icon } from 'semantic-ui-react';
import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
// import { Button, Grid, Segment, Container } from 'semantic-ui-react';
import { formatRelativeDate } from '@plone/volto/helpers/Utils/Date';
import config from '@plone/volto/registry';

const messages = defineMessages({
comment: {
Expand Down Expand Up @@ -297,7 +297,6 @@ class Comments extends Component {
*/
render() {
const { items } = this.props;
const moment = this.props.moment.default;
const { collapsedComments } = this.state;
// object with comment ids, to easily verify if any comment has children
const allCommentsWithCildren = this.addRepliesAsChildrenToComments(items);
Expand All @@ -318,8 +317,11 @@ class Comments extends Component {
<Comment.Metadata>
<span>
{' '}
<span title={moment(comment.creation_date).format('LLLL')}>
{moment(comment.creation_date).fromNow()}
<span title={comment.creation_date}>
{formatRelativeDate({
date: comment.creation_date,
locale: config.settings.dateLocale || 'en-gb',
})}
</span>
</span>
</Comment.Metadata>
Expand Down Expand Up @@ -472,7 +474,6 @@ class Comments extends Component {

export default compose(
injectIntl,
injectLazyLibs(['moment']),
connect(
(state) => ({
items: state.comments.items,
Expand Down
8 changes: 1 addition & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,7 @@ const applyConfig = (config) => {
if (config.blocks.blocksConfig.accordion) {
config.blocks.blocksConfig.accordion.semanticIcon = 'ri-arrow-down-s-line';
}
// Apply quote block customization
if (config.blocks.blocksConfig.quote) {
config.blocks.blocksConfig.quote.templates.default.icons = {
openQuote: 'ri-double-quotes-l',
closeQuote: 'ri-double-quotes-r',
};
}

// apply inPage navigation
config.settings.appExtras = [
...(config.settings.appExtras || []),
Expand Down

0 comments on commit 276afec

Please sign in to comment.