footer.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. const html = require('choo/html');
  2. const Component = require('choo/component');
  3. class Footer extends Component {
  4. constructor(name, state) {
  5. super(name);
  6. this.state = state;
  7. }
  8. update() {
  9. return false;
  10. }
  11. createElement() {
  12. const translate = this.state.translate;
  13. // Add additional links from configuration if available
  14. var links = [];
  15. if (this.state != undefined && this.state.WEB_UI != undefined) {
  16. const WEB_UI = this.state.WEB_UI;
  17. if (WEB_UI.FOOTER_DONATE_URL != '') {
  18. links.push(html`
  19. <li class="m-2">
  20. <a href="${WEB_UI.FOOTER_DONATE_URL}" target="_blank">
  21. ${translate('footerLinkDonate')}
  22. </a>
  23. </li>
  24. `);
  25. }
  26. if (WEB_UI.FOOTER_CLI_URL != '') {
  27. links.push(html`
  28. <li class="m-2">
  29. <a href="${WEB_UI.FOOTER_CLI_URL}" target="_blank">
  30. ${translate('footerLinkCli')}
  31. </a>
  32. </li>
  33. `);
  34. }
  35. if (WEB_UI.FOOTER_DMCA_URL != '') {
  36. links.push(html`
  37. <li class="m-2">
  38. <a href="${WEB_UI.FOOTER_DMCA_URL}" target="_blank">
  39. ${translate('footerLinkDmca')}
  40. </a>
  41. </li>
  42. `);
  43. }
  44. if (WEB_UI.FOOTER_SOURCE_URL != '') {
  45. links.push(html`
  46. <li class="m-2">
  47. <a href="${WEB_UI.FOOTER_SOURCE_URL}" target="_blank">
  48. ${translate('footerLinkSource')}
  49. </a>
  50. </li>
  51. `);
  52. }
  53. } else {
  54. links.push(html`
  55. <li class="m-2">
  56. <a href="https://gitlab.com/timvisee/send" target="_blank">
  57. ${translate('footerLinkSource')}
  58. </a>
  59. </li>
  60. `);
  61. }
  62. return html`
  63. <footer
  64. class="flex flex-col md:flex-row items-start w-full flex-none self-start p-6 md:p-8 font-medium text-xs text-grey-60 dark:text-grey-40 md:items-center justify-between"
  65. >
  66. <ul
  67. class="flex flex-col md:flex-row items-start md:items-center md:justify-start"
  68. >
  69. <li class="m-2">${translate('footerText')}</li>
  70. </ul>
  71. <ul
  72. class="flex flex-col md:flex-row items-start md:items-center md:justify-end"
  73. >
  74. ${links}
  75. </ul>
  76. </footer>
  77. `;
  78. }
  79. }
  80. module.exports = Footer;