News.vue 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <div class='app'>
  3. <main-header></main-header>
  4. <div class='container'>
  5. <div class='card is-fullwidth' v-for='item in news'>
  6. <header class='card-header'>
  7. <p class='card-header-title'>
  8. {{ item.title }} - {{ formatDate(item.createdAt) }}
  9. </p>
  10. </header>
  11. <div class='card-content'>
  12. <div class='content'>
  13. <p>{{ item.description }}</p>
  14. </div>
  15. <div class='sect' v-show='item.features.length > 0'>
  16. <div class='sect-head-features'>The features are so great</div>
  17. <ul class='sect-body'>
  18. <li v-for='li in item.features'>{{ li }}</li>
  19. </ul>
  20. </div>
  21. <div class='sect' v-show='item.improvements.length > 0'>
  22. <div class='sect-head-improvements'>Improvements</div>
  23. <ul class='sect-body'>
  24. <li v-for='li in item.improvements'>{{ li }}</li>
  25. </ul>
  26. </div>
  27. <div class='sect' v-show='item.bugs.length > 0'>
  28. <div class='sect-head-bugs'>Bugs Smashed</div>
  29. <ul class='sect-body'>
  30. <li v-for='li in item.bugs'>{{ li }}</li>
  31. </ul>
  32. </div>
  33. <div class='sect' v-show='item.upcoming.length > 0'>
  34. <div class='sect-head-upcoming'>Coming Soon to a Musare near you</div>
  35. <ul class='sect-body'>
  36. <li v-for='li in item.upcoming'>{{ li }}</li>
  37. </ul>
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. <main-footer></main-footer>
  43. </div>
  44. </template>
  45. <script>
  46. import MainHeader from '../MainHeader.vue';
  47. import MainFooter from '../MainFooter.vue';
  48. import io from '../../io';
  49. export default {
  50. components: { MainHeader, MainFooter },
  51. methods: {
  52. formatDate: unix => {
  53. return moment(unix).format('DD-MM-YYYY');
  54. },
  55. },
  56. data() {
  57. return {
  58. news: []
  59. }
  60. },
  61. ready: function () {
  62. let _this = this;
  63. io.getSocket((socket) => {
  64. _this.socket = socket;
  65. _this.socket.emit('news.index', res => {
  66. _this.news = res.data;
  67. });
  68. });
  69. }
  70. }
  71. </script>
  72. <style lang='scss' scoped>
  73. .card { margin-top: 50px; }
  74. .sect {
  75. div[class^='sect-head'], div[class*=' sect-head']{
  76. padding: 12px;
  77. text-transform: uppercase;
  78. font-weight: bold;
  79. color: #fff;
  80. }
  81. .sect-head-features { background-color: dodgerblue; }
  82. .sect-head-improvements { background-color: seagreen; }
  83. .sect-head-bugs { background-color: brown; }
  84. .sect-head-upcoming { background-color: mediumpurple; }
  85. .sect-body {
  86. padding: 15px 25px;
  87. li { list-style-type: disc; }
  88. }
  89. }
  90. </style>