Modal.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <div class="modal is-active">
  3. <div class="modal-background" @click="closeCurrentModal()" />
  4. <div class="modal-card">
  5. <header class="modal-card-head">
  6. <h2 class="modal-card-title is-marginless">
  7. {{ title }}
  8. </h2>
  9. <button class="delete" @click="closeCurrentModal()" />
  10. </header>
  11. <section class="modal-card-body">
  12. <slot name="body" />
  13. </section>
  14. <footer class="modal-card-foot" v-if="$slots['footer'] != null">
  15. <slot name="footer" />
  16. </footer>
  17. </div>
  18. </div>
  19. </template>
  20. <script>
  21. import { mapActions } from "vuex";
  22. export default {
  23. props: {
  24. title: { type: String, default: "Modal" }
  25. },
  26. methods: {
  27. toCamelCase: str => {
  28. return str
  29. .toLowerCase()
  30. .replace(/[-_]+/g, " ")
  31. .replace(/[^\w\s]/g, "")
  32. .replace(/ (.)/g, $1 => $1.toUpperCase())
  33. .replace(/ /g, "");
  34. },
  35. ...mapActions("modals", ["closeCurrentModal"])
  36. },
  37. mounted() {
  38. this.type = this.toCamelCase(this.title);
  39. }
  40. };
  41. </script>
  42. <style lang="scss" scoped>
  43. .night-mode {
  44. .modal-card-head,
  45. .modal-card-foot {
  46. background-color: #222;
  47. border-color: #333;
  48. }
  49. .modal-card-body {
  50. background-color: #111 !important;
  51. }
  52. .modal-card-title {
  53. color: #fff;
  54. }
  55. p,
  56. label,
  57. td,
  58. h1,
  59. h2,
  60. h3,
  61. h4,
  62. h5,
  63. h6 {
  64. color: #ddd !important;
  65. }
  66. }
  67. .modal-card {
  68. width: 800px;
  69. font-size: 16px;
  70. }
  71. p {
  72. font-size: 17px;
  73. }
  74. .modal-card-title {
  75. font-size: 27px;
  76. }
  77. </style>