@kitconcept/volto-light-theme 1.0.0-rc.8 → 1.0.0-rc.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ on: [push]
4
4
  env:
5
5
  ADDON_NAME: "@kitconcept/volto-light-theme"
6
6
  ADDON_PATH: "volto-light-theme"
7
- VOLTO_VERSION: "17.0.0-alpha.17"
7
+ VOLTO_VERSION: "17.0.0-alpha.20"
8
8
 
9
9
  jobs:
10
10
 
@@ -11,7 +11,7 @@ on:
11
11
  env:
12
12
  ENVIRONMENT: "light-theme.kitconcept.io"
13
13
  IMAGE_NAME: "ghcr.io/kitconcept/voltolighttheme-frontend"
14
- VOLTO_VERSION: "17.0.0-alpha.17"
14
+ VOLTO_VERSION: "17.0.0-alpha.20"
15
15
 
16
16
  jobs:
17
17
  meta:
package/CHANGELOG.md CHANGED
@@ -8,6 +8,26 @@
8
8
 
9
9
  <!-- towncrier release notes start -->
10
10
 
11
+ ## 1.0.0-rc.9 (2023-07-19)
12
+
13
+ ### Breaking
14
+
15
+ - Refactor existing customizations, removing the ones no longer needed (because they are present in Volto already) and using the new pattern in the others. Volto 17a20 is required in order to retain consistency. @sneridagh [#166](https://github.com/kitconcept/volto-light-theme/pull/166)
16
+
17
+ ### Bugfix
18
+
19
+ - Fix NewsItemView as wella sd Link View @iFlameing [#127](https://github.com/kitconcept/volto-light-theme/pull/127)
20
+ - Fix Image View in edit mode @iFlameing. [#154](https://github.com/kitconcept/volto-light-theme/pull/154)
21
+ - Update volto-image-block @sneridagh [#159](https://github.com/kitconcept/volto-light-theme/pull/159)
22
+ - Fix File View implementation @iFlameing [#162](https://github.com/kitconcept/volto-light-theme/pull/162)
23
+
24
+ ### Internal
25
+
26
+ - Upgrade volto-image-block to fix the image upload @sneridagh [#149](https://github.com/kitconcept/volto-light-theme/pull/149)
27
+ - Upgrade to Volto 17a20 @sneridagh [#163](https://github.com/kitconcept/volto-light-theme/pull/163)
28
+ - Remove the `apiExpanders` existing locally in the package since it's already in Volto 17a20 @sneridagh [#164](https://github.com/kitconcept/volto-light-theme/pull/164)
29
+
30
+
11
31
  ## 1.0.0-rc.8 (2023-07-14)
12
32
 
13
33
  ### Bugfix
package/Makefile CHANGED
@@ -22,7 +22,7 @@ RESET=`tput sgr0`
22
22
  YELLOW=`tput setaf 3`
23
23
 
24
24
  PLONE_VERSION=6
25
- VOLTO_VERSION=17.0.0-alpha.17
25
+ VOLTO_VERSION=17.0.0-alpha.20
26
26
 
27
27
  ADDON_NAME='@kitconcept/volto-light-theme'
28
28
  ADDON_PATH='volto-light-theme'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitconcept/volto-light-theme",
3
- "version": "1.0.0-rc.8",
3
+ "version": "1.0.0-rc.9",
4
4
  "description": "Volto Light Theme by kitconcept",
5
5
  "main": "src/index.js",
6
6
  "repository": {
@@ -25,7 +25,6 @@
25
25
  "access": "public"
26
26
  },
27
27
  "scripts": {
28
- "i18n": "rm -rf build/messages && NODE_ENV=production i18n --addon",
29
28
  "dry-release": "release-it --dry-run",
30
29
  "release": "release-it",
31
30
  "release-major-alpha": "release-it major --preRelease=alpha",
@@ -67,10 +66,10 @@
67
66
  "@kitconcept/volto-button-block": "^2.1.0",
68
67
  "@kitconcept/volto-dsgvo-banner": "^1.3.0",
69
68
  "@kitconcept/volto-heading-block": "^2.2.0",
70
- "@kitconcept/volto-image-block": "^1.0.1",
69
+ "@kitconcept/volto-image-block": "^1.0.3",
71
70
  "@kitconcept/volto-introduction-block": "^1.0.0",
72
71
  "@kitconcept/volto-separator-block": "^3.2.2",
73
72
  "@kitconcept/volto-slider-block": "^4.2.0",
74
- "@plone/volto": "^17.0.0-alpha.17"
73
+ "@plone/volto": "^17.0.0-alpha.20"
75
74
  }
76
75
  }
@@ -0,0 +1,47 @@
1
+ // See Customization for more info
2
+ import React from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import { ConditionalLink, UniversalLink } from '@plone/volto/components';
5
+ import { flattenToAppURL } from '@plone/volto/helpers';
6
+
7
+ import { isInternalURL } from '@plone/volto/helpers/Url/Url';
8
+
9
+ const DefaultTemplate = ({ items, linkTitle, linkHref, isEditMode }) => {
10
+ let link = null;
11
+ let href = linkHref?.[0]?.['@id'] || '';
12
+
13
+ if (isInternalURL(href)) {
14
+ link = (
15
+ <ConditionalLink to={flattenToAppURL(href)} condition={!isEditMode}>
16
+ {linkTitle || href}
17
+ </ConditionalLink>
18
+ );
19
+ } else if (href) {
20
+ link = <UniversalLink href={href}>{linkTitle || href}</UniversalLink>;
21
+ }
22
+
23
+ return (
24
+ <>
25
+ <div className="items">
26
+ {items.map((item) => (
27
+ <div className="listing-item" key={item['@id']}>
28
+ <ConditionalLink item={item} condition={!isEditMode}>
29
+ <div className="listing-body">
30
+ <h2>{item.title ? item.title : item.id}</h2>
31
+ <p>{item.description}</p>
32
+ </div>
33
+ </ConditionalLink>
34
+ </div>
35
+ ))}
36
+ </div>
37
+
38
+ {link && <div className="footer">{link}</div>}
39
+ </>
40
+ );
41
+ };
42
+ DefaultTemplate.propTypes = {
43
+ items: PropTypes.arrayOf(PropTypes.any).isRequired,
44
+ linkMore: PropTypes.any,
45
+ isEditMode: PropTypes.bool,
46
+ };
47
+ export default DefaultTemplate;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * OVERRIDE SearchDetails.jsx
3
+ * REASON: Special template for displaying this component, use h2 instead of h4
4
+ */
5
+ import React from 'react';
6
+ import { defineMessages, useIntl } from 'react-intl';
7
+
8
+ const messages = defineMessages({
9
+ searchResults: {
10
+ id: 'Search results',
11
+ defaultMessage: 'Search results',
12
+ },
13
+ searchedFor: {
14
+ id: 'Searched for',
15
+ defaultMessage: 'Searched for',
16
+ },
17
+ });
18
+
19
+ const SearchDetails = ({ total, text }) => {
20
+ const intl = useIntl();
21
+ return (
22
+ <h2 className="search-details">
23
+ <nobr>
24
+ <span className="number">{total}</span>{' '}
25
+ <span className="label">
26
+ {intl.formatMessage(messages.searchResults)}
27
+ </span>
28
+ </nobr>
29
+ </h2>
30
+ );
31
+ };
32
+
33
+ export default SearchDetails;
@@ -0,0 +1,56 @@
1
+ /**
2
+ * OVERRIDE SearchDetails.jsx
3
+ * REASON: Special template for displaying this component
4
+ */
5
+ import React from 'react';
6
+ import { Button, Input } from 'semantic-ui-react';
7
+ import { defineMessages, useIntl } from 'react-intl';
8
+ import { Icon } from '@plone/volto/components';
9
+ import loupeSVG from '@plone/volto/icons/zoom.svg';
10
+
11
+ const messages = defineMessages({
12
+ search: {
13
+ id: 'Search',
14
+ defaultMessage: 'Search',
15
+ },
16
+ });
17
+
18
+ const SearchInput = (props) => {
19
+ const { data, searchText, setSearchText, isLive, onTriggerSearch } = props;
20
+ const intl = useIntl();
21
+
22
+ return (
23
+ <div className="search-input">
24
+ <Input
25
+ id={`${props.id}-searchtext`}
26
+ value={searchText}
27
+ placeholder={
28
+ data.searchInputPrompt || intl.formatMessage(messages.search)
29
+ }
30
+ fluid
31
+ onKeyPress={(event) => {
32
+ if (isLive || event.key === 'Enter') onTriggerSearch(searchText);
33
+ }}
34
+ onChange={(event, { value }) => {
35
+ setSearchText(value);
36
+ if (isLive) {
37
+ onTriggerSearch(value);
38
+ }
39
+ }}
40
+ aria-label="Search"
41
+ />
42
+ {isLive && (
43
+ <Button
44
+ basic
45
+ icon
46
+ className="search-input-live-icon-button"
47
+ aria-label="Search"
48
+ >
49
+ <Icon name={loupeSVG} />
50
+ </Button>
51
+ )}
52
+ </div>
53
+ );
54
+ };
55
+
56
+ export default SearchInput;
@@ -0,0 +1,65 @@
1
+ /**
2
+ * File view component.
3
+ * @module components/theme/View/FileView
4
+ */
5
+
6
+ import React from 'react';
7
+ import PropTypes from 'prop-types';
8
+ import { Container as SemanticContainer } from 'semantic-ui-react';
9
+ import { flattenToAppURL } from '@plone/volto/helpers';
10
+ import config from '@plone/volto/registry';
11
+ import FileType from '../../helpers/Filetype';
12
+
13
+ /**
14
+ * File view component class.
15
+ * @function FileView
16
+ * @params {object} content Content object.
17
+ * @returns {string} Markup of the component.
18
+ */
19
+ const FileView = ({ content }) => {
20
+ const Container =
21
+ config.getComponent({ name: 'Container' }).component || SemanticContainer;
22
+ return (
23
+ <Container id="page-document" className="view-wrapper fileitem-view">
24
+ <h1 className="documentFirstHeading">
25
+ {content.title}
26
+ {content.subtitle && ` - ${content.subtitle}`}
27
+ </h1>
28
+ {content.description && (
29
+ <p className="documentDescription">{content.description}</p>
30
+ )}
31
+ {content.file?.download && (
32
+ <p>
33
+ <a href={flattenToAppURL(content.file.download)}>
34
+ {content.file.filename}
35
+ </a>{' '}
36
+ <span>
37
+ ({FileType(content?.file['content-type'])}/{' '}
38
+ {content.file?.size < 1000000
39
+ ? Math.round(content.file.size / 1000)
40
+ : Math.round(content.file.size / 1000000)}
41
+ {content.file?.size < 1000000 ? 'KB' : 'MB'})
42
+ </span>
43
+ </p>
44
+ )}
45
+ </Container>
46
+ );
47
+ };
48
+
49
+ /**
50
+ * Property types.
51
+ * @property {Object} propTypes Property types.
52
+ * @static
53
+ */
54
+ FileView.propTypes = {
55
+ content: PropTypes.shape({
56
+ title: PropTypes.string,
57
+ description: PropTypes.string,
58
+ file: PropTypes.shape({
59
+ download: PropTypes.string,
60
+ filename: PropTypes.string,
61
+ }),
62
+ }).isRequired,
63
+ };
64
+
65
+ export default FileView;
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Image view component.
3
+ * @module components/theme/View/ImageView
4
+ */
5
+
6
+ import React from 'react';
7
+ import PropTypes from 'prop-types';
8
+ import { Container as SemanticContainer } from 'semantic-ui-react';
9
+
10
+ import { flattenToAppURL } from '@plone/volto/helpers';
11
+
12
+ // BEGIN CUSTOMIZATION
13
+ import config from '@plone/volto/registry';
14
+ import Caption from '@kitconcept/volto-image-block/components/Caption/Caption';
15
+
16
+ // END CUSTOMIZATION
17
+
18
+ /**
19
+ * Image view component class.
20
+ * @function ImageView
21
+ * @params {object} content Content object.
22
+ * @returns {string} Markup of the component.
23
+ */
24
+ const ImageView = ({ content }) => {
25
+ const Image = config.getComponent('Image').component;
26
+ const Container =
27
+ config.getComponent({ name: 'Container' }).component || SemanticContainer;
28
+ return (
29
+ <Container id="page-document" className="view-wrapper image-view">
30
+ {/* BEGIN CUSTOMIZATION */}
31
+ <h1 className="documentFirstHeading">{content.title}</h1>
32
+ {content?.image?.download && (
33
+ <figure>
34
+ <Image
35
+ width={content.image?.width}
36
+ height={content.image?.height}
37
+ alt={content.alt_tag || ''}
38
+ src={content.image}
39
+ blurhash={content.blurhash}
40
+ blurhashOptions={{
41
+ // override default width 100%
42
+ style: {},
43
+ }}
44
+ style={{ maxWidth: '100%', height: 'auto' }}
45
+ />
46
+ <Caption
47
+ title={content.title}
48
+ description={content.description}
49
+ credit={content.credit?.data}
50
+ downloadFilename={content.title}
51
+ downloadHref={
52
+ content.allow_image_download &&
53
+ flattenToAppURL(
54
+ content.image.scales.fullscreen?.download ||
55
+ content.image.download,
56
+ )
57
+ }
58
+ />
59
+ </figure>
60
+ )}
61
+ {/* END CUSTOMIZATION */}
62
+ </Container>
63
+ );
64
+ };
65
+
66
+ /**
67
+ * Property types.
68
+ * @property {Object} propTypes Property types.
69
+ * @static
70
+ */
71
+ ImageView.propTypes = {
72
+ content: PropTypes.shape({
73
+ title: PropTypes.string,
74
+ description: PropTypes.string,
75
+ image: PropTypes.shape({
76
+ scales: PropTypes.shape({
77
+ preview: PropTypes.shape({
78
+ download: PropTypes.string,
79
+ }),
80
+ }),
81
+ }),
82
+ // BEGIN CUSTOMIZATION
83
+ allow_image_download: PropTypes.bool,
84
+ credit: PropTypes.shape({
85
+ data: PropTypes.string,
86
+ }),
87
+ alt_tag: PropTypes.string,
88
+ // END CUSTOMIZATION
89
+ }).isRequired,
90
+ };
91
+
92
+ export default ImageView;
@@ -0,0 +1,56 @@
1
+ /**
2
+ * NewsItemView view component.
3
+ * @module components/theme/View/NewsItemView
4
+ */
5
+
6
+ import React from 'react';
7
+ import PropTypes from 'prop-types';
8
+ import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
9
+ import { FormattedDate } from '@plone/volto/components';
10
+ import config from '@plone/volto/registry';
11
+ import { Container as SemanticContainer } from 'semantic-ui-react';
12
+
13
+ /**
14
+ * NewsItemView view component class.
15
+ * @function NewsItemView
16
+ * @params {object} content Content object.
17
+ * @returns {string} Markup of the component.
18
+ */
19
+ const NewsItemView = ({ content }) => {
20
+ const Container =
21
+ config.getComponent({ name: 'Container' }).component || SemanticContainer;
22
+ return (
23
+ <Container id="page-document" className="view-wrapper newsitem-view">
24
+ <div className="dates">
25
+ {content?.effective ? (
26
+ <span className="day">
27
+ <FormattedDate date={content?.effective} />{' '}
28
+ </span>
29
+ ) : (
30
+ <span className="day">No date</span>
31
+ )}{' '}
32
+ {content?.head_title && (
33
+ <span className="headtitle">| {content?.head_title}</span>
34
+ )}
35
+ </div>
36
+ <RenderBlocks content={content} />
37
+ </Container>
38
+ );
39
+ };
40
+
41
+ /**
42
+ * Property types.
43
+ * @property {Object} propTypes Property types.
44
+ * @static
45
+ */
46
+ NewsItemView.propTypes = {
47
+ content: PropTypes.shape({
48
+ title: PropTypes.string,
49
+ description: PropTypes.string,
50
+ text: PropTypes.shape({
51
+ data: PropTypes.string,
52
+ }),
53
+ }).isRequired,
54
+ };
55
+
56
+ export default NewsItemView;
@@ -1,47 +1,16 @@
1
- // Remove when https://github.com/plone/volto/pull/4848 is merged
2
- import React from 'react';
3
- import PropTypes from 'prop-types';
4
- import { ConditionalLink, UniversalLink } from '@plone/volto/components';
5
- import { flattenToAppURL } from '@plone/volto/helpers';
1
+ /**
2
+ * OVERRIDE DefaultTemplate.jsx
3
+ * REASON: This was going to be removed when
4
+ * https://github.com/plone/volto/pull/4848 was merged.
5
+ * However, as per decission of the Volto Team, the team
6
+ * will explore changing the headings inside a listing to a
7
+ * better semantically structure, using no headings at all.
8
+ * So, decission by Víctor (19/07/2023) to freeze this for now in the theme
9
+ * still using h2 and change it (if appropiate) when the change is made.
10
+ * To override it, override the @kitconcept/volto-light-theme one instead of
11
+ * this one.
12
+ */
6
13
 
7
- import { isInternalURL } from '@plone/volto/helpers/Url/Url';
14
+ import DefaultTemplate from '../../../../../../components/Blocks/Listing/DefaultTemplate';
8
15
 
9
- const DefaultTemplate = ({ items, linkTitle, linkHref, isEditMode }) => {
10
- let link = null;
11
- let href = linkHref?.[0]?.['@id'] || '';
12
-
13
- if (isInternalURL(href)) {
14
- link = (
15
- <ConditionalLink to={flattenToAppURL(href)} condition={!isEditMode}>
16
- {linkTitle || href}
17
- </ConditionalLink>
18
- );
19
- } else if (href) {
20
- link = <UniversalLink href={href}>{linkTitle || href}</UniversalLink>;
21
- }
22
-
23
- return (
24
- <>
25
- <div className="items">
26
- {items.map((item) => (
27
- <div className="listing-item" key={item['@id']}>
28
- <ConditionalLink item={item} condition={!isEditMode}>
29
- <div className="listing-body">
30
- <h2>{item.title ? item.title : item.id}</h2>
31
- <p>{item.description}</p>
32
- </div>
33
- </ConditionalLink>
34
- </div>
35
- ))}
36
- </div>
37
-
38
- {link && <div className="footer">{link}</div>}
39
- </>
40
- );
41
- };
42
- DefaultTemplate.propTypes = {
43
- items: PropTypes.arrayOf(PropTypes.any).isRequired,
44
- linkMore: PropTypes.any,
45
- isEditMode: PropTypes.bool,
46
- };
47
16
  export default DefaultTemplate;
@@ -2,32 +2,7 @@
2
2
  * OVERRIDE SearchDetails.jsx
3
3
  * REASON: Special template for displaying this component, use h2 instead of h4
4
4
  */
5
- import React from 'react';
6
- import { defineMessages, useIntl } from 'react-intl';
7
5
 
8
- const messages = defineMessages({
9
- searchResults: {
10
- id: 'Search results',
11
- defaultMessage: 'Search results',
12
- },
13
- searchedFor: {
14
- id: 'Searched for',
15
- defaultMessage: 'Searched for',
16
- },
17
- });
18
-
19
- const SearchDetails = ({ total, text }) => {
20
- const intl = useIntl();
21
- return (
22
- <h2 className="search-details">
23
- <nobr>
24
- <span className="number">{total}</span>{' '}
25
- <span className="label">
26
- {intl.formatMessage(messages.searchResults)}
27
- </span>
28
- </nobr>
29
- </h2>
30
- );
31
- };
6
+ import SearchDetails from '../../../../../../../components/Blocks/Search/components/SearchDetails';
32
7
 
33
8
  export default SearchDetails;
@@ -1,56 +1,8 @@
1
1
  /**
2
- * OVERRIDE SearchDetails.jsx
2
+ * OVERRIDE SearchInput.jsx
3
3
  * REASON: Special template for displaying this component
4
4
  */
5
- import React from 'react';
6
- import { Button, Input } from 'semantic-ui-react';
7
- import { defineMessages, useIntl } from 'react-intl';
8
- import { Icon } from '@plone/volto/components';
9
- import loupeSVG from '@plone/volto/icons/zoom.svg';
10
5
 
11
- const messages = defineMessages({
12
- search: {
13
- id: 'Search',
14
- defaultMessage: 'Search',
15
- },
16
- });
17
-
18
- const SearchInput = (props) => {
19
- const { data, searchText, setSearchText, isLive, onTriggerSearch } = props;
20
- const intl = useIntl();
21
-
22
- return (
23
- <div className="search-input">
24
- <Input
25
- id={`${props.id}-searchtext`}
26
- value={searchText}
27
- placeholder={
28
- data.searchInputPrompt || intl.formatMessage(messages.search)
29
- }
30
- fluid
31
- onKeyPress={(event) => {
32
- if (isLive || event.key === 'Enter') onTriggerSearch(searchText);
33
- }}
34
- onChange={(event, { value }) => {
35
- setSearchText(value);
36
- if (isLive) {
37
- onTriggerSearch(value);
38
- }
39
- }}
40
- aria-label="Search"
41
- />
42
- {isLive && (
43
- <Button
44
- basic
45
- icon
46
- className="search-input-live-icon-button"
47
- aria-label="Search"
48
- >
49
- <Icon name={loupeSVG} />
50
- </Button>
51
- )}
52
- </div>
53
- );
54
- };
6
+ import SearchInput from '../../../../../../../components/Blocks/Search/components/SearchInput';
55
7
 
56
8
  export default SearchInput;