ActionCard.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. const Component = use('util.Component');
  2. export default def(class ActionCard extends Component {
  3. static ID = 'ui.component.ActionCard';
  4. static RENDER_MODE = Component.NO_SHADOW;
  5. static PROPERTIES = {
  6. title: {
  7. value: 'Title'
  8. },
  9. info: {},
  10. button_text: {},
  11. button_style: {},
  12. on_click: {},
  13. style: {},
  14. }
  15. create_template ({ template }) {
  16. $(template).html(/*html*/`
  17. <div class="settings-card ${ this.get('style') ? this.get('style') : '' }">
  18. <div>
  19. <strong style="display: block">${ this.get('title') }</strong>
  20. <span style="display: block margin-top: 5px">${
  21. this.get('info')
  22. }</span>
  23. </div>
  24. <div style="flex-grow: 1">
  25. <button class="button ${ this.get('button_style') }" style="float: right;">${
  26. this.get('button_text')
  27. }</button>
  28. </div>
  29. </div>
  30. `);
  31. }
  32. on_ready ({ listen }) {
  33. $(this.dom_).find('button').on('click', this.get('on_click') || (() => {}));
  34. }
  35. });