@eeacms/volto-clms-theme 1.0.77 → 1.0.78
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/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/src/components/CclCard/CclCard.jsx +140 -124
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,16 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
#### [1.0.78](https://github.com/eea/volto-clms-theme/compare/1.0.77...1.0.78)
|
|
8
|
+
|
|
9
|
+
- refactor card link [`e3ab510`](https://github.com/eea/volto-clms-theme/commit/e3ab51012c21a1bc62e2600431aac225dbd76003)
|
|
10
|
+
- add link to the entire card [`aee0981`](https://github.com/eea/volto-clms-theme/commit/aee09811585c925a050347259bb10369c0ec4845)
|
|
11
|
+
|
|
7
12
|
#### [1.0.77](https://github.com/eea/volto-clms-theme/compare/1.0.76...1.0.77)
|
|
8
13
|
|
|
14
|
+
> 3 March 2022
|
|
15
|
+
|
|
16
|
+
- Develop [`#222`](https://github.com/eea/volto-clms-theme/pull/222)
|
|
9
17
|
- cardContainerBlock refactoring, remove cardBlock and make ImageEditor… [`#221`](https://github.com/eea/volto-clms-theme/pull/221)
|
|
10
18
|
- fix image uploading workflow [`86c10e6`](https://github.com/eea/volto-clms-theme/commit/86c10e6b9bf2d0e82aa1415539d291d04b6f86e9)
|
|
11
19
|
- cardContainerBlock refactoring, remove cardBlock and make ImageEditor reusable [`2292c6b`](https://github.com/eea/volto-clms-theme/commit/2292c6bdb11eeac3f99df080b096b2d923ed2926)
|
package/package.json
CHANGED
|
@@ -25,17 +25,23 @@ const CardImage = ({ card, size = 'preview', isCustomCard }) => {
|
|
|
25
25
|
);
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
const CardLink = ({ url,
|
|
28
|
+
const CardLink = ({ url, children, className, condition = true }) => {
|
|
29
29
|
function hasProtocol(protocolUrl) {
|
|
30
30
|
return (
|
|
31
31
|
protocolUrl.startsWith('https://') || protocolUrl.startsWith('http://')
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
34
|
const RenderElement = hasProtocol(url) ? 'a' : Link;
|
|
35
|
-
return
|
|
36
|
-
|
|
35
|
+
return !condition ? (
|
|
36
|
+
children
|
|
37
|
+
) : hasProtocol(url) ? (
|
|
38
|
+
<RenderElement className={className} href={url}>
|
|
39
|
+
{children}
|
|
40
|
+
</RenderElement>
|
|
37
41
|
) : (
|
|
38
|
-
<RenderElement to={url}>
|
|
42
|
+
<RenderElement className={className} to={url}>
|
|
43
|
+
{children}
|
|
44
|
+
</RenderElement>
|
|
39
45
|
);
|
|
40
46
|
};
|
|
41
47
|
|
|
@@ -99,136 +105,146 @@ function CclCard(props) {
|
|
|
99
105
|
'threeColumns',
|
|
100
106
|
'globalSearch',
|
|
101
107
|
];
|
|
108
|
+
const wrapperClass =
|
|
109
|
+
'card-' + (type === 'globalSearch' ? 'doc' : type || 'line');
|
|
102
110
|
return (
|
|
103
|
-
<
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
onKeyDown={() => onClickImage()}
|
|
108
|
-
className={'card-' + (type === 'globalSearch' ? 'doc' : type || 'line')}
|
|
111
|
+
<CardLink
|
|
112
|
+
url={url}
|
|
113
|
+
className={wrapperClass}
|
|
114
|
+
condition={type === 'block' || type === 'threeColumns'}
|
|
109
115
|
>
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
)}
|
|
151
|
-
{type === 'news' && (
|
|
152
|
-
<>
|
|
153
|
-
<div className="card-news-image">
|
|
154
|
-
{isCustomCard && CclImageEditor ? (
|
|
155
|
-
CclImageEditor
|
|
156
|
-
) : (
|
|
157
|
-
<CardImage
|
|
158
|
-
isCustomCard={isCustomCard}
|
|
159
|
-
card={card}
|
|
160
|
-
size={'mini'}
|
|
161
|
-
/>
|
|
162
|
-
)}
|
|
163
|
-
</div>
|
|
164
|
-
<div className="card-news-text">
|
|
165
|
-
<div className="card-news-title">
|
|
166
|
-
<CardLink url={url} title={card?.title} />
|
|
167
|
-
</div>
|
|
168
|
-
<div className="card-news-date">
|
|
169
|
-
{new Date(card?.effective).toLocaleString()}
|
|
116
|
+
<div
|
|
117
|
+
tabIndex="0"
|
|
118
|
+
role="button"
|
|
119
|
+
onClick={() => onClickImage()}
|
|
120
|
+
onKeyDown={() => onClickImage()}
|
|
121
|
+
className={
|
|
122
|
+
!(type === 'block' || type === 'threeColumns') && wrapperClass
|
|
123
|
+
}
|
|
124
|
+
>
|
|
125
|
+
{conditional_types.includes(type) ? (
|
|
126
|
+
<>
|
|
127
|
+
{type === 'doc' && (
|
|
128
|
+
<>
|
|
129
|
+
<DocCard card={card} url={url} showEditor={showEditor}>
|
|
130
|
+
{children}
|
|
131
|
+
</DocCard>
|
|
132
|
+
</>
|
|
133
|
+
)}
|
|
134
|
+
{type === 'globalSearch' && (
|
|
135
|
+
<>
|
|
136
|
+
<Label ribbon="right" color="olive">
|
|
137
|
+
{content_type}
|
|
138
|
+
</Label>
|
|
139
|
+
<DocCard card={card} url={url} showEditor={showEditor}>
|
|
140
|
+
{children}
|
|
141
|
+
</DocCard>
|
|
142
|
+
</>
|
|
143
|
+
)}
|
|
144
|
+
{(type === 'block' || type === 'threeColumns') && (
|
|
145
|
+
<>
|
|
146
|
+
<div className={`card-${type}-image`}>
|
|
147
|
+
{isCustomCard && CclImageEditor ? (
|
|
148
|
+
CclImageEditor
|
|
149
|
+
) : (
|
|
150
|
+
<CardImage
|
|
151
|
+
isCustomCard={isCustomCard}
|
|
152
|
+
card={card}
|
|
153
|
+
size={'preview'}
|
|
154
|
+
/>
|
|
155
|
+
)}
|
|
170
156
|
</div>
|
|
171
|
-
<
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
{type === 'event' && (
|
|
176
|
-
<>
|
|
177
|
-
<div className={'card-event-text'}>
|
|
178
|
-
<div className="card-event-title">
|
|
179
|
-
<CardLink url={url} title={card?.title} />
|
|
157
|
+
<div className="card-text">
|
|
158
|
+
<div className="card-title">{card?.title}</div>
|
|
159
|
+
<div className="card-description">{card?.description}</div>
|
|
160
|
+
{children}
|
|
180
161
|
</div>
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
162
|
+
</>
|
|
163
|
+
)}
|
|
164
|
+
{type === 'news' && (
|
|
165
|
+
<>
|
|
166
|
+
<div className="card-news-image">
|
|
167
|
+
{isCustomCard && CclImageEditor ? (
|
|
168
|
+
CclImageEditor
|
|
169
|
+
) : (
|
|
170
|
+
<CardImage
|
|
171
|
+
isCustomCard={isCustomCard}
|
|
172
|
+
card={card}
|
|
173
|
+
size={'mini'}
|
|
188
174
|
/>
|
|
175
|
+
)}
|
|
176
|
+
</div>
|
|
177
|
+
<div className="card-news-text">
|
|
178
|
+
<div className="card-news-title">
|
|
179
|
+
<CardLink url={url}>{card?.title}</CardLink>
|
|
180
|
+
{/* <CardLink url={url} title={card?.title} /> */}
|
|
189
181
|
</div>
|
|
182
|
+
<div className="card-news-date">
|
|
183
|
+
{new Date(card?.effective).toLocaleString()}
|
|
184
|
+
</div>
|
|
185
|
+
<p className="card-news-description">{card?.description}</p>
|
|
190
186
|
</div>
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
187
|
+
</>
|
|
188
|
+
)}
|
|
189
|
+
{type === 'event' && (
|
|
190
|
+
<>
|
|
191
|
+
<div className={'card-event-text'}>
|
|
192
|
+
<div className="card-event-title">
|
|
193
|
+
<CardLink url={url}>{card?.title}</CardLink>
|
|
194
|
+
{/* <CardLink url={url} title={card?.title} /> */}
|
|
199
195
|
</div>
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
196
|
+
<div className="card-event-when">
|
|
197
|
+
<FontAwesomeIcon icon={['far', 'calendar-alt']} />
|
|
198
|
+
<div className="card-event-when-text">
|
|
199
|
+
<When
|
|
200
|
+
start={card.start}
|
|
201
|
+
end={card.whole_day ? card.start : card.end}
|
|
202
|
+
whole_day={card.whole_day}
|
|
203
|
+
/>
|
|
204
|
+
</div>
|
|
205
|
+
</div>
|
|
206
|
+
{card?.location ? (
|
|
207
|
+
<div className="card-event-where">
|
|
208
|
+
<>
|
|
209
|
+
<FontAwesomeIcon icon={['fas', 'map-marker-alt']} />
|
|
210
|
+
<div className="card-event-where-text">
|
|
211
|
+
{card?.location}
|
|
212
|
+
</div>
|
|
213
|
+
</>
|
|
214
|
+
</div>
|
|
215
|
+
) : (
|
|
216
|
+
''
|
|
217
|
+
)}
|
|
218
|
+
<p className="card-event-description">{card?.description}</p>
|
|
219
|
+
</div>
|
|
220
|
+
</>
|
|
219
221
|
)}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
{
|
|
222
|
+
</>
|
|
223
|
+
) : (
|
|
224
|
+
<>
|
|
225
|
+
<div className="card-image">
|
|
226
|
+
{isCustomCard && CclImageEditor ? (
|
|
227
|
+
CclImageEditor
|
|
228
|
+
) : (
|
|
229
|
+
<CardImage
|
|
230
|
+
isCustomCard={isCustomCard}
|
|
231
|
+
card={card}
|
|
232
|
+
size={'mini'}
|
|
233
|
+
/>
|
|
234
|
+
)}
|
|
235
|
+
</div>
|
|
236
|
+
<div className={'card-text'}>
|
|
237
|
+
<div className="card-title">
|
|
238
|
+
<CardLink url={url}>{card?.title}</CardLink>
|
|
239
|
+
{/* <CardLink url={url} title={card?.title} /> */}
|
|
240
|
+
</div>
|
|
241
|
+
<div className="card-description">{card?.description}</div>
|
|
242
|
+
{children}
|
|
225
243
|
</div>
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
)}
|
|
231
|
-
</div>
|
|
244
|
+
</>
|
|
245
|
+
)}
|
|
246
|
+
</div>
|
|
247
|
+
</CardLink>
|
|
232
248
|
);
|
|
233
249
|
}
|
|
234
250
|
|