1 | import { h } from 'preact';
|
2 | import ms from 'milliseconds';
|
3 | const currentYear = new Date().getFullYear();
|
4 |
|
5 | const getUpdatedText = updatedDate => {
|
6 | if (Date.now() - updatedDate < ms.weeks(2)) {
|
7 | const date = new Date(updatedDate);
|
8 | return `${date.getMonth() + 1}/${date.getDate()}/${(date.getFullYear() + '').slice(2)}`;
|
9 | }
|
10 | };
|
11 |
|
12 | const linkClasses = 'link f6 gray no-underline underline-hover';
|
13 |
|
14 | export const Footer = ({
|
15 | privacyUrl = 'https://legal.anesthesiacharting.com/privacy',
|
16 | termsUrl = 'https://legal.anesthesiacharting.com/terms',
|
17 | version,
|
18 | privacyUpdatedDate,
|
19 | hideLinks
|
20 | }) => {
|
21 | const updateText = privacyUpdatedDate && getUpdatedText(privacyUpdatedDate);
|
22 | return h(
|
23 | 'footer',
|
24 | { className: 'pt2 pb3 tc f6 gray mb7' },
|
25 | '\xA9 ',
|
26 | currentYear,
|
27 | ' I.V. Enterprises LLC ',
|
28 | version && `v${version}`,
|
29 | ' ',
|
30 | !hideLinks && h(
|
31 | 'div',
|
32 | { className: 'mt1 no-print' },
|
33 | h(
|
34 | 'a',
|
35 | { className: linkClasses, href: termsUrl, rel: 'noopener' },
|
36 | 'terms'
|
37 | ),
|
38 | ' | ',
|
39 | h(
|
40 | 'a',
|
41 | { className: linkClasses, href: privacyUrl, rel: 'noopener' },
|
42 | 'privacy'
|
43 | ),
|
44 | updateText && ` (updated ${updateText})`
|
45 | )
|
46 | );
|
47 | }; |
\ | No newline at end of file |