@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.
- package/.eslintrc +48 -0
- package/.github/workflows/acceptance.yml +1 -1
- package/.github/workflows/deploy.yml +1 -1
- package/CHANGELOG.md +33 -0
- package/Makefile +4 -5
- package/README.md +187 -7
- package/dockerfiles/docker-compose.yml +2 -0
- package/package.json +13 -4
- package/src/components/Blocks/Listing/DefaultTemplate.jsx +47 -0
- package/src/components/Blocks/Search/components/SearchDetails.jsx +33 -0
- package/src/components/Blocks/Search/components/SearchInput.jsx +56 -0
- package/src/components/Theme/EventView.jsx +11 -11
- package/src/components/Theme/FileView.jsx +65 -0
- package/src/components/Theme/ImageView.jsx +92 -0
- package/src/components/Theme/NewsItemView.jsx +56 -0
- package/src/customizations/volto/components/manage/Blocks/Listing/DefaultTemplate.jsx +13 -44
- package/src/customizations/volto/components/manage/Blocks/Search/components/SearchDetails.jsx +1 -26
- package/src/customizations/volto/components/manage/Blocks/Search/components/SearchInput.jsx +2 -50
- package/src/customizations/volto/components/theme/View/FileView.jsx +2 -124
- package/src/customizations/volto/components/theme/View/ImageView.jsx +10 -0
- package/src/customizations/volto/components/theme/View/NewsItemView.jsx +2 -49
- package/src/helpers/Filetype.js +64 -0
- package/src/index.js +0 -15
- package/src/theme/_content.scss +53 -28
- package/.eslintrc.local.js +0 -50
- package/src/customizations/volto/components/manage/Blocks/Grid/View.jsx +0 -44
- package/src/customizations/volto/components/manage/Form/Form.jsx +0 -803
package/.eslintrc
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": ["react-app", "prettier", "plugin:jsx-a11y/recommended"],
|
|
3
|
+
"plugins": ["prettier", "react-hooks", "jsx-a11y"],
|
|
4
|
+
"env": {
|
|
5
|
+
"es6": true,
|
|
6
|
+
"browser": true,
|
|
7
|
+
"node": true,
|
|
8
|
+
"mocha": true,
|
|
9
|
+
"jasmine": true
|
|
10
|
+
},
|
|
11
|
+
"parser": "babel-eslint",
|
|
12
|
+
"parserOptions": {
|
|
13
|
+
"ecmaVersion": 6,
|
|
14
|
+
"sourceType": "module",
|
|
15
|
+
"ecmaFeatures": {
|
|
16
|
+
"legacyDecorators": true
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"rules": {
|
|
20
|
+
"import/no-unresolved": 0,
|
|
21
|
+
"no-alert": 1,
|
|
22
|
+
"no-console": 1,
|
|
23
|
+
"no-debugger": 1,
|
|
24
|
+
"prettier/prettier": [
|
|
25
|
+
"error",
|
|
26
|
+
{ "trailingComma": "all", "singleQuote": true }
|
|
27
|
+
],
|
|
28
|
+
"react-hooks/rules-of-hooks": "error",
|
|
29
|
+
"react-hooks/exhaustive-deps": "warn",
|
|
30
|
+
"react/react-in-jsx-scope": "off"
|
|
31
|
+
},
|
|
32
|
+
"globals": {
|
|
33
|
+
"root": true,
|
|
34
|
+
"__DEVELOPMENT__": true,
|
|
35
|
+
"__CLIENT__": true,
|
|
36
|
+
"__SERVER__": true,
|
|
37
|
+
"__DISABLE_SSR__": true,
|
|
38
|
+
"__DEVTOOLS__": true,
|
|
39
|
+
"__DEBUG__": true,
|
|
40
|
+
"__SSR__": true,
|
|
41
|
+
"__SENTRY__": true,
|
|
42
|
+
"cy": true,
|
|
43
|
+
"Cypress": true,
|
|
44
|
+
"jest": true,
|
|
45
|
+
"socket": true,
|
|
46
|
+
"webpackIsomorphicTools": true
|
|
47
|
+
}
|
|
48
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,39 @@
|
|
|
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
|
+
|
|
31
|
+
## 1.0.0-rc.8 (2023-07-14)
|
|
32
|
+
|
|
33
|
+
### Bugfix
|
|
34
|
+
|
|
35
|
+
- Fix Image content type @iRohitSingh [#18](https://github.com/kitconcept/volto-light-theme/pull/18)
|
|
36
|
+
- Fix a11y issues in EventView @steffenri [#147](https://github.com/kitconcept/volto-light-theme/pull/147)
|
|
37
|
+
- Remove typo in fileview @steffenri [#148](https://github.com/kitconcept/volto-light-theme/pull/148)
|
|
38
|
+
|
|
39
|
+
### Documentation
|
|
40
|
+
|
|
41
|
+
- Documentation on local docker development - local ESlint working @sneridagh [#144](https://github.com/kitconcept/volto-light-theme/pull/144)
|
|
42
|
+
|
|
43
|
+
|
|
11
44
|
## 1.0.0-rc.7 (2023-07-13)
|
|
12
45
|
|
|
13
46
|
### 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.
|
|
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'
|
|
@@ -135,7 +135,6 @@ status-test-acceptance-server: ## Status of Acceptance Server (for use it while
|
|
|
135
135
|
debug-frontend: ## Run bash in the Frontend container (for debug infrastructure purposes)
|
|
136
136
|
${DEV_COMPOSE} run --entrypoint bash addon-dev
|
|
137
137
|
|
|
138
|
-
.PHONY:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
mv .eslintrc.local.js .eslintrc.js
|
|
138
|
+
.PHONY: pull-backend-image
|
|
139
|
+
pull-backend-image: ## Pulls and updates the backend image (for use it while developing)
|
|
140
|
+
docker pull ghcr.io/kitconcept/voltolighttheme:latest
|
package/README.md
CHANGED
|
@@ -98,11 +98,68 @@ These main rules spec applies to the theme:
|
|
|
98
98
|
- Separator-Block (https://www.npmjs.com/package/@kitconcept/volto-separator-block)
|
|
99
99
|
- Heading-Block (https://www.npmjs.com/package/@kitconcept/volto-heading-block)
|
|
100
100
|
- Introduction-Block (https://www.npmjs.com/package/@kitconcept/volto-introduction-block)
|
|
101
|
+
- Accordion-Block (https://www.npmjs.com/package/@eeacms/volto-accordion-block)
|
|
101
102
|
|
|
102
103
|
and the following add-ons:
|
|
103
104
|
|
|
104
105
|
- DSGVO-Banner (https://www.npmjs.com/package/@kitconcept/volto-dsgvo-banner)
|
|
105
106
|
|
|
107
|
+
## Installation
|
|
108
|
+
|
|
109
|
+
It is recommended that your project or policy add-on `package.json` include the aforementioned add-ons.
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
"dependencies": {
|
|
113
|
+
"@eeacms/volto-accordion-block": "9.0.0",
|
|
114
|
+
"@kitconcept/volto-button-block": "2.1.0",
|
|
115
|
+
"@kitconcept/volto-dsgvo-banner": "1.3.0",
|
|
116
|
+
"@kitconcept/volto-heading-block": "2.2.0",
|
|
117
|
+
"@kitconcept/volto-introduction-block": "1.0.0",
|
|
118
|
+
"@kitconcept/volto-light-theme": "1.0.0",
|
|
119
|
+
"@kitconcept/volto-separator-block": "3.2.0",
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
This theme won't install them for you, as they are declared as `peerDependencies`.
|
|
124
|
+
This is because the theme won't have to force you to use any specific add-on version, and avoids package hoisting issues.
|
|
125
|
+
|
|
126
|
+
In your project or policy add-on `package.json` you should declare all of them as Volto add-ons
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
"addons": [
|
|
130
|
+
"@eeacms/volto-accordion-block",
|
|
131
|
+
"@kitconcept/volto-button-block",
|
|
132
|
+
"@kitconcept/volto-heading-block",
|
|
133
|
+
"@kitconcept/volto-introduction-block",
|
|
134
|
+
"@kitconcept/volto-highlight-block",
|
|
135
|
+
"@kitconcept/volto-separator-block",
|
|
136
|
+
"@kitconcept/volto-light-theme",
|
|
137
|
+
"your_policy_addon_here"
|
|
138
|
+
],
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Make sure your policy add-on is the last one, as you would want that its configuration has priority over all the others. Make sure also that `@kitconcept/volto-light-theme` is the one before your policy add-on.
|
|
142
|
+
|
|
143
|
+
Then, declare the theme in your project `package.json`:
|
|
144
|
+
|
|
145
|
+
```json
|
|
146
|
+
"theme": "@kitconcept/volto-light-theme",
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Alternativelly, you can also declare it in your project's `volto.config.js`:
|
|
150
|
+
|
|
151
|
+
```js
|
|
152
|
+
const addons = [];
|
|
153
|
+
const theme = '@kitconcept/volto-light-theme';
|
|
154
|
+
|
|
155
|
+
module.exports = {
|
|
156
|
+
addons,
|
|
157
|
+
theme,
|
|
158
|
+
};
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
You can specify your project add-ons in `volto.config.js`, but sometimes is better to have them all in one place (in your policy add-on) for portability.
|
|
162
|
+
|
|
106
163
|
## Development Setup
|
|
107
164
|
|
|
108
165
|
This theme works under Volto 17 alpha 16 onwards.
|
|
@@ -110,24 +167,147 @@ Compatibility with Volto 16 might be achieved, but it has to be at customization
|
|
|
110
167
|
specific project add-on.
|
|
111
168
|
This is mainly due to the `RenderBlocks` customization that is based in the one in 17 because of the Grid block in core and the autogrouping feature.
|
|
112
169
|
See more information about the other dependencies in `peerDependencies` in `package.json`.
|
|
170
|
+
It is possible to develop this add-on using docker containers and the provided convenience Makefile commands.
|
|
171
|
+
Run `make help` to list the available commands.
|
|
172
|
+
|
|
173
|
+
````text
|
|
174
|
+
build-backend Build
|
|
175
|
+
start-backend Starts Docker backend
|
|
176
|
+
stop-backend Stop Docker backend
|
|
177
|
+
build-live Build Addon live
|
|
178
|
+
build-addon Build Addon dev
|
|
179
|
+
start-dev Starts Dev container
|
|
180
|
+
dev Develop the addon
|
|
181
|
+
help Show this help.
|
|
182
|
+
i18n Sync i18n
|
|
183
|
+
format Format codebase
|
|
184
|
+
lint Lint Codebase
|
|
185
|
+
test Run unit tests
|
|
186
|
+
test-ci Run unit tests in CI
|
|
187
|
+
install-acceptance Install Cypress, build acceptance containers
|
|
188
|
+
start-test-acceptance-server Start acceptance server (for use it in while developing)
|
|
189
|
+
start-test-acceptance-server-prod Start acceptance server in prod (used by CI)
|
|
190
|
+
test-acceptance Start Cypress (for use it while developing)
|
|
191
|
+
test-acceptance-headless Run cypress tests in CI
|
|
192
|
+
stop-test-acceptance-server Stop acceptance server (for use it while finished developing)
|
|
193
|
+
status-test-acceptance-server Status of Acceptance Server (for use it while developing)
|
|
194
|
+
debug-frontend Run bash in the Frontend container (for debug infrastructure purposes)
|
|
195
|
+
pull-backend-image Pulls and updates the backend image (for use it while developing)
|
|
196
|
+
````
|
|
113
197
|
|
|
114
198
|
### Prerequisites
|
|
115
199
|
|
|
116
200
|
- Docker
|
|
117
201
|
- Node 18 (e.g. via nvm)
|
|
118
202
|
|
|
119
|
-
###
|
|
203
|
+
### Development environment Setup
|
|
204
|
+
|
|
205
|
+
Run once
|
|
206
|
+
|
|
207
|
+
```shell
|
|
208
|
+
make dev
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
which will build and launch the backend and frontend containers.
|
|
212
|
+
There's no need to build them again after doing it the first time unless something has changed from the container setup.
|
|
213
|
+
|
|
214
|
+
In order to make the local IDE play well with this setup, is it required to run once `yarn` to install locally the required packages (ESlint, Prettier, Stylelint).
|
|
120
215
|
|
|
121
216
|
Run
|
|
122
217
|
|
|
123
|
-
|
|
218
|
+
```shell
|
|
219
|
+
yarn
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Build the containers manually
|
|
223
|
+
|
|
224
|
+
Run
|
|
225
|
+
|
|
226
|
+
```shell
|
|
227
|
+
make build-backend
|
|
228
|
+
make build-addon
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Run the containers
|
|
232
|
+
|
|
233
|
+
Run
|
|
234
|
+
|
|
235
|
+
```shell
|
|
124
236
|
make start-dev
|
|
125
|
-
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
This will start both the frontend and backend containers.
|
|
126
240
|
|
|
127
241
|
### Stop Backend (Docker)
|
|
128
242
|
|
|
129
|
-
|
|
243
|
+
After developing, in order to stop the running backend, don't forget to run:
|
|
130
244
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
245
|
+
Run
|
|
246
|
+
|
|
247
|
+
```shell
|
|
248
|
+
make stop-backend
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Linting
|
|
252
|
+
|
|
253
|
+
Run
|
|
254
|
+
|
|
255
|
+
```shell
|
|
256
|
+
make lint
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Formatting
|
|
260
|
+
|
|
261
|
+
Run
|
|
262
|
+
|
|
263
|
+
```shell
|
|
264
|
+
make format
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### i18n
|
|
268
|
+
|
|
269
|
+
Run
|
|
270
|
+
|
|
271
|
+
```shell
|
|
272
|
+
make i18n
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Unit tests
|
|
276
|
+
|
|
277
|
+
Run
|
|
278
|
+
|
|
279
|
+
```shell
|
|
280
|
+
make test
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Acceptance tests
|
|
284
|
+
|
|
285
|
+
Run once
|
|
286
|
+
|
|
287
|
+
```shell
|
|
288
|
+
make install-acceptance
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
For starting the servers
|
|
292
|
+
|
|
293
|
+
Run
|
|
294
|
+
|
|
295
|
+
```shell
|
|
296
|
+
make start-test-acceptance-server
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
The frontend is run in dev mode, so development while writing tests is possible.
|
|
300
|
+
|
|
301
|
+
Run
|
|
302
|
+
|
|
303
|
+
```shell
|
|
304
|
+
make test-acceptance
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
To run Cypress tests afterwards.
|
|
308
|
+
|
|
309
|
+
When finished, don't forget to shutdown the backend server.
|
|
310
|
+
|
|
311
|
+
```shell
|
|
312
|
+
make stop-test-acceptance-server
|
|
313
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitconcept/volto-light-theme",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
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",
|
|
@@ -33,6 +32,16 @@
|
|
|
33
32
|
},
|
|
34
33
|
"devDependencies": {
|
|
35
34
|
"@plone/scripts": "^3.0.0",
|
|
35
|
+
"babel-eslint": "10.1.0",
|
|
36
|
+
"eslint": "6.8.0",
|
|
37
|
+
"eslint-config-prettier": "6.11.0",
|
|
38
|
+
"eslint-config-react-app": "5.2.1",
|
|
39
|
+
"eslint-plugin-flowtype": "4.7.0",
|
|
40
|
+
"eslint-plugin-import": "2.20.2",
|
|
41
|
+
"eslint-plugin-jsx-a11y": "6.2.3",
|
|
42
|
+
"eslint-plugin-prettier": "3.1.3",
|
|
43
|
+
"eslint-plugin-react": "7.20.0",
|
|
44
|
+
"eslint-plugin-react-hooks": "4.0.2",
|
|
36
45
|
"postcss-scss": "4.0.6",
|
|
37
46
|
"prettier": "2.0.5",
|
|
38
47
|
"razzle-plugin-scss": "4.2.18",
|
|
@@ -57,10 +66,10 @@
|
|
|
57
66
|
"@kitconcept/volto-button-block": "^2.1.0",
|
|
58
67
|
"@kitconcept/volto-dsgvo-banner": "^1.3.0",
|
|
59
68
|
"@kitconcept/volto-heading-block": "^2.2.0",
|
|
60
|
-
"@kitconcept/volto-image-block": "^1.0.
|
|
69
|
+
"@kitconcept/volto-image-block": "^1.0.3",
|
|
61
70
|
"@kitconcept/volto-introduction-block": "^1.0.0",
|
|
62
71
|
"@kitconcept/volto-separator-block": "^3.2.2",
|
|
63
72
|
"@kitconcept/volto-slider-block": "^4.2.0",
|
|
64
|
-
"@plone/volto": "^17.0.0-alpha.
|
|
73
|
+
"@plone/volto": "^17.0.0-alpha.20"
|
|
65
74
|
}
|
|
66
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;
|
|
@@ -224,21 +224,21 @@ const EventView = (props) => {
|
|
|
224
224
|
</div>
|
|
225
225
|
</Grid.Column>
|
|
226
226
|
<div className="event-button">
|
|
227
|
-
<
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
>
|
|
227
|
+
<a
|
|
228
|
+
className="ics-download"
|
|
229
|
+
target="_blank"
|
|
230
|
+
rel="noreferrer"
|
|
231
|
+
href={`${expandToBackendURL(
|
|
232
|
+
content['@id'],
|
|
233
|
+
)}/ics_view`}
|
|
234
|
+
>
|
|
235
|
+
<Button className="event-btn">
|
|
236
236
|
<FormattedMessage
|
|
237
237
|
id="ICS-Download"
|
|
238
238
|
defaultMessage="ICS Download"
|
|
239
239
|
/>
|
|
240
|
-
</
|
|
241
|
-
</
|
|
240
|
+
</Button>
|
|
241
|
+
</a>
|
|
242
242
|
</div>
|
|
243
243
|
</Grid.Row>
|
|
244
244
|
</Grid>
|
|
@@ -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;
|