LicenseNotice.jsx 1.1 KB
Newer Older
1
2
3
import React from "react";
import PropTypes from "prop-types";
import Typography from "@material-ui/core/Typography";
Florent Chehab's avatar
Florent Chehab committed
4
import { makeStyles } from "@material-ui/styles";
5
import TextLink from "./TextLink";
6
import APP_ROUTES from "../../config/appRoutes";
7
8
import getWindowBase from "../../utils/getWindowBase";

9
const useStyles = makeStyles((theme) => ({
Florent Chehab's avatar
Florent Chehab committed
10
  spacer: {
11
12
    marginBottom: theme.spacing(2),
  },
Florent Chehab's avatar
Florent Chehab committed
13
14
}));

15
16
17
18
/**
 * Component to render the links in custom manner
 */
function LicenseNotice(props) {
Florent Chehab's avatar
Florent Chehab committed
19
20
  const classes = useStyles();

21
22
  return (
    <>
23
      <Typography variant="caption" display="block">
24
25
26
        Ce contenu est sous license&nbsp;
        {props.variant}.<br />
        Plus d'informations à ce propos sont disponibles&nbsp;
27
28
        <TextLink href={getWindowBase() + APP_ROUTES.aboutCgu}>ici</TextLink>.
      </Typography>
29
      {props.spacer && <div className={classes.spacer} />}
30
31
32
33
34
    </>
  );
}

LicenseNotice.propTypes = {
35
  variant: PropTypes.oneOf(["REX-DRI—PRIVATE", "REX-DRI—BY"]).isRequired,
36
37
38
39
40
  spacer: PropTypes.bool,
};

LicenseNotice.defaultProps = {
  spacer: true,
41
42
43
};

export default LicenseNotice;