The frontend/UI server, written in JS using the MarkoJS library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
541 B

6 years ago
6 years ago
6 years ago
  1. module.exports = class {
  2. onCreate() {
  3. this.state = {
  4. classes: [],
  5. }
  6. }
  7. onInput(input) {
  8. this.state.classes = ["menu-link", "color-menu"].concat(input.class)
  9. if (input.dark) {
  10. this.state.classes.push(input)
  11. }
  12. if (Array.isArray(input.class)) {
  13. this.state.classes.push(...input.class)
  14. } else if (input.class != null) {
  15. this.state.classes.push(input.class)
  16. }
  17. this.state.classes.push(input.selected ? "selected" : "not-selected")
  18. }
  19. onClick() {
  20. this.emit("click")
  21. }
  22. }