]> git.localhorst.tv Git - alttp.git/blob - resources/js/components/events/Detail.js
event details
[alttp.git] / resources / js / components / events / Detail.js
1 import PropTypes from 'prop-types';
2 import React from 'react';
3 import { Button } from 'react-bootstrap';
4 import { useTranslation } from 'react-i18next';
5
6 import Icon from '../common/Icon';
7 import RawHTML from '../common/RawHTML';
8 import { getTranslation } from '../../helpers/Technique';
9 import i18n from '../../i18n';
10
11 const Detail = ({ actions, event }) => {
12         const { t } = useTranslation();
13
14         return <>
15                 <div className="d-flex align-items-center justify-content-between">
16                         <h1>{event.title}</h1>
17                         {event.description && actions.editContent ?
18                                 <Button
19                                         className="ms-3"
20                                         onClick={() => actions.editContent(event.description)}
21                                         size="sm"
22                                         title={t('button.edit')}
23                                         variant="outline-secondary"
24                                 >
25                                         <Icon.EDIT title="" />
26                                 </Button>
27                         : null}
28                 </div>
29                 {event.description ?
30                         <RawHTML html={getTranslation(event.description, 'description', i18n.language)} />
31                 : null}
32         </>;
33 };
34
35 Detail.propTypes = {
36         actions: PropTypes.shape({
37                 editContent: PropTypes.func,
38         }),
39         event: PropTypes.shape({
40                 description: PropTypes.shape({
41                 }),
42                 title: PropTypes.string,
43         }),
44 };
45
46 export default Detail;