Skip to content

Commit 557cbaf

Browse files
authored
Merge pull request #231 from plone/erral-issue-226-ical-link
feat: show ical/ICS download link in the event infobox
2 parents f77314d + e3ca86a commit 557cbaf

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

frontend/src/components/Blocks/InfoBox/Body.jsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import React from 'react';
22
import { defineMessages, useIntl } from 'react-intl';
33
import { When, Recurrence } from '@package/components';
44
import { List } from 'semantic-ui-react';
5+
import Icon from '@plone/volto/components/theme/Icon/Icon';
6+
import calendarSVG from '@plone/volto/icons/calendar.svg';
7+
import { expandToBackendURL } from '@plone/volto/helpers/Url/Url';
58

69
const messages = defineMessages({
710
date: {
@@ -32,6 +35,10 @@ const messages = defineMessages({
3235
id: 'attendees',
3336
defaultMessage: 'Attendees',
3437
},
38+
downloadEvent: {
39+
id: 'Download Event',
40+
defaultMessage: 'Download Event',
41+
},
3542
});
3643

3744
const Body = (props) => {
@@ -121,6 +128,23 @@ const Body = (props) => {
121128
<List items={properties.attendees} />
122129
</>
123130
)}
131+
132+
{/* ICS link */}
133+
<div className="download-event">
134+
<Icon name={calendarSVG} />
135+
<a
136+
className="ics-download"
137+
target="_blank"
138+
rel="noreferrer"
139+
href={
140+
properties && properties['@id']
141+
? `${expandToBackendURL(properties['@id'])}/ics_view `
142+
: ''
143+
}
144+
>
145+
{intl.formatMessage(messages.downloadEvent)}
146+
</a>
147+
</div>
124148
</>
125149
) : (
126150
<></>

frontend/theme/extras/site/components/blocks/infobox.less

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,12 @@
2828
margin-bottom: 0.3rem;
2929
}
3030
}
31+
32+
.download-event {
33+
display: flex;
34+
35+
a {
36+
padding-top: 0.5rem;
37+
}
38+
}
3139
}

0 commit comments

Comments
 (0)