@kitconcept/volto-light-theme 1.0.0-rc.7 → 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.
Files changed (27) hide show
  1. package/.eslintrc +48 -0
  2. package/.github/workflows/acceptance.yml +1 -1
  3. package/.github/workflows/deploy.yml +1 -1
  4. package/CHANGELOG.md +33 -0
  5. package/Makefile +4 -5
  6. package/README.md +187 -7
  7. package/dockerfiles/docker-compose.yml +2 -0
  8. package/package.json +13 -4
  9. package/src/components/Blocks/Listing/DefaultTemplate.jsx +47 -0
  10. package/src/components/Blocks/Search/components/SearchDetails.jsx +33 -0
  11. package/src/components/Blocks/Search/components/SearchInput.jsx +56 -0
  12. package/src/components/Theme/EventView.jsx +11 -11
  13. package/src/components/Theme/FileView.jsx +65 -0
  14. package/src/components/Theme/ImageView.jsx +92 -0
  15. package/src/components/Theme/NewsItemView.jsx +56 -0
  16. package/src/customizations/volto/components/manage/Blocks/Listing/DefaultTemplate.jsx +13 -44
  17. package/src/customizations/volto/components/manage/Blocks/Search/components/SearchDetails.jsx +1 -26
  18. package/src/customizations/volto/components/manage/Blocks/Search/components/SearchInput.jsx +2 -50
  19. package/src/customizations/volto/components/theme/View/FileView.jsx +2 -124
  20. package/src/customizations/volto/components/theme/View/ImageView.jsx +10 -0
  21. package/src/customizations/volto/components/theme/View/NewsItemView.jsx +2 -49
  22. package/src/helpers/Filetype.js +64 -0
  23. package/src/index.js +0 -15
  24. package/src/theme/_content.scss +53 -28
  25. package/.eslintrc.local.js +0 -50
  26. package/src/customizations/volto/components/manage/Blocks/Grid/View.jsx +0 -44
  27. package/src/customizations/volto/components/manage/Form/Form.jsx +0 -803
@@ -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;
@@ -1,132 +1,10 @@
1
1
  /**
2
2
  * OVERRIDE FileView.jsx
3
- * REASON: BFS theme
3
+ * REASON: Adding size of file.
4
4
  * DATE: 2023-07-11
5
5
  * DEVELOPER: @iRohitSingh
6
6
  */
7
7
 
8
- /**
9
- * File view component.
10
- * @module components/theme/View/FileView
11
- */
12
-
13
- import React from 'react';
14
- import PropTypes from 'prop-types';
15
- import { Container } from 'semantic-ui-react';
16
-
17
- import { flattenToAppURL } from '@plone/volto/helpers';
18
-
19
- /**
20
- * File view component class.
21
- * @function FileView
22
- * @params {object} content Content object.
23
- * @returns {string} Markup of the component.
24
- */
25
- const FileView = ({ content }) => (
26
- <Container className="view-wrapper">
27
- <h1 className="documentFirstHeading">
28
- {content.title}
29
- {content.subtitle && ` - ${content.subtitle}`}
30
- </h1>
31
- <div className="file-detail">
32
- {content.description && (
33
- <p className="documentDescription">{content.description}iRohitSingh</p>
34
- )}
35
- {content.file?.download && (
36
- <>
37
- <a href={flattenToAppURL(content.file.download)}>
38
- {content.file.filename}
39
- </a>{' '}
40
- <span>
41
- (
42
- {(() => {
43
- switch (content?.file['content-type']) {
44
- case 'image/jpeg':
45
- return 'JPEG';
46
- case 'image/png':
47
- return 'PNG';
48
- case 'image/svg+xml':
49
- return 'SVG';
50
- case 'image/gif':
51
- return 'GIF';
52
- case 'application/pdf':
53
- return 'PDF';
54
- case 'application/msexcel':
55
- return 'XLS';
56
- case 'application/vnd.ms-excel':
57
- return 'XLS';
58
- case 'application/msword':
59
- return 'DOC';
60
- case 'application/mspowerpoint':
61
- return 'PPT';
62
- case 'audio/mp4':
63
- return 'MP4';
64
- case 'application/zip':
65
- return 'ZIP';
66
- case 'video/webm':
67
- return 'WEBM';
68
- case 'video/x-msvideo':
69
- return 'AVI';
70
- case 'video/x-sgi-movie':
71
- return 'MOVIE';
72
- case 'text/xml':
73
- return 'XML';
74
- case 'text/plain':
75
- return 'TXT';
76
- case 'text/calendar':
77
- return 'ICS';
78
- case 'image/x-icon':
79
- return 'ICO';
80
- case 'image/bmp':
81
- return 'BMP';
82
- case 'audio/mpeg':
83
- return 'MP3';
84
- case 'audio/wav':
85
- return 'WAV';
86
- case 'application/json':
87
- return 'JSON';
88
- case 'application/postscript':
89
- return 'PS';
90
- case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
91
- return 'XLSX';
92
- case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
93
- return 'DOCX';
94
- case 'application/xml':
95
- return 'XML';
96
- case 'application/mshelp':
97
- return 'HLP';
98
- case 'application/gzip':
99
- return 'GZ';
100
- default:
101
- return '';
102
- }
103
- })()}{' '}
104
- /{' '}
105
- {content.file?.size < 1000000
106
- ? Math.round(content.file.size / 1000)
107
- : Math.round(content.file.size / 1000000)}
108
- {content.file?.size < 1000000 ? 'KB' : 'MB'})
109
- </span>
110
- </>
111
- )}
112
- </div>
113
- </Container>
114
- );
115
-
116
- /**
117
- * Property types.
118
- * @property {Object} propTypes Property types.
119
- * @static
120
- */
121
- FileView.propTypes = {
122
- content: PropTypes.shape({
123
- title: PropTypes.string,
124
- description: PropTypes.string,
125
- file: PropTypes.shape({
126
- download: PropTypes.string,
127
- filename: PropTypes.string,
128
- }),
129
- }).isRequired,
130
- };
8
+ import FileView from '../../../../../components/Theme/FileView';
131
9
 
132
10
  export default FileView;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * OVERRIDE ImageView.jsx
3
+ * REASON: Using custom component to render Image and Caption.
4
+ * DATE: 2023-07-19
5
+ * DEVELOPER: @IFlameing
6
+ */
7
+
8
+ import ImageView from '../../../../../components/Theme/ImageView';
9
+
10
+ export default ImageView;
@@ -1,57 +1,10 @@
1
1
  /**
2
2
  * OVERRIDE NewsItemView.jsx
3
- * REASON: BFS theme
3
+ * REASON: Adding dates and headtitle above the title of page.
4
4
  * DATE: 2023-07-04
5
5
  * DEVELOPER: @IFlameing
6
6
  */
7
7
 
8
- /**
9
- * NewsItemView view component.
10
- * @module components/theme/View/NewsItemView
11
- */
12
-
13
- import React from 'react';
14
- import PropTypes from 'prop-types';
15
- import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
16
- import { FormattedDate } from '@plone/volto/components';
17
-
18
- /**
19
- * NewsItemView view component class.
20
- * @function NewsItemView
21
- * @params {object} content Content object.
22
- * @returns {string} Markup of the component.
23
- */
24
- const NewsItemView = ({ content }) => {
25
- return (
26
- <div id="page-document" className="ui container viewwrapper event-view">
27
- <div className="dates">
28
- {content?.effective ? (
29
- <span className="day">
30
- <FormattedDate date={content?.effective} />{' '}
31
- </span>
32
- ) : (
33
- <span className="day">No date</span>
34
- )}{' '}
35
- <span className="headtitle">| {content?.head_title}</span>
36
- </div>
37
- <RenderBlocks content={content} />
38
- </div>
39
- );
40
- };
41
-
42
- /**
43
- * Property types.
44
- * @property {Object} propTypes Property types.
45
- * @static
46
- */
47
- NewsItemView.propTypes = {
48
- content: PropTypes.shape({
49
- title: PropTypes.string,
50
- description: PropTypes.string,
51
- text: PropTypes.shape({
52
- data: PropTypes.string,
53
- }),
54
- }).isRequired,
55
- };
8
+ import NewsItemView from '../../../../../components/Theme/NewsItemView';
56
9
 
57
10
  export default NewsItemView;
@@ -0,0 +1,64 @@
1
+ const Filetype = (mime_type) => {
2
+ switch (mime_type) {
3
+ case 'image/jpeg':
4
+ return 'JPEG';
5
+ case 'image/png':
6
+ return 'PNG';
7
+ case 'image/svg+xml':
8
+ return 'SVG';
9
+ case 'image/gif':
10
+ return 'GIF';
11
+ case 'application/pdf':
12
+ return 'PDF';
13
+ case 'application/msexcel':
14
+ return 'XLS';
15
+ case 'application/vnd.ms-excel':
16
+ return 'XLS';
17
+ case 'application/msword':
18
+ return 'DOC';
19
+ case 'application/mspowerpoint':
20
+ return 'PPT';
21
+ case 'audio/mp4':
22
+ return 'MP4';
23
+ case 'application/zip':
24
+ return 'ZIP';
25
+ case 'video/webm':
26
+ return 'WEBM';
27
+ case 'video/x-msvideo':
28
+ return 'AVI';
29
+ case 'video/x-sgi-movie':
30
+ return 'MOVIE';
31
+ case 'text/xml':
32
+ return 'XML';
33
+ case 'text/plain':
34
+ return 'TXT';
35
+ case 'text/calendar':
36
+ return 'ICS';
37
+ case 'image/x-icon':
38
+ return 'ICO';
39
+ case 'image/bmp':
40
+ return 'BMP';
41
+ case 'audio/mpeg':
42
+ return 'MP3';
43
+ case 'audio/wav':
44
+ return 'WAV';
45
+ case 'application/json':
46
+ return 'JSON';
47
+ case 'application/postscript':
48
+ return 'PS';
49
+ case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
50
+ return 'XLSX';
51
+ case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
52
+ return 'DOCX';
53
+ case 'application/xml':
54
+ return 'XML';
55
+ case 'application/mshelp':
56
+ return 'HLP';
57
+ case 'application/gzip':
58
+ return 'GZ';
59
+ default:
60
+ return '';
61
+ }
62
+ };
63
+
64
+ export default Filetype;
package/src/index.js CHANGED
@@ -47,21 +47,6 @@ const applyConfig = (config) => {
47
47
  component: Container,
48
48
  });
49
49
 
50
- config.settings.apiExpanders = [
51
- ...config.settings.apiExpanders,
52
- {
53
- match: '',
54
- GET_CONTENT: ['breadcrumbs', 'actions', 'types'],
55
- },
56
- {
57
- match: '',
58
- GET_CONTENT: ['navigation'],
59
- querystring: {
60
- 'expand.navigation.depth': config.settings.navDepth,
61
- },
62
- },
63
- ];
64
-
65
50
  // Register custom StyleWrapper ClassNames
66
51
  config.settings.styleClassNameExtenders = [
67
52
  ({ block, content, data, classNames }) => {