Groups.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <div class="group-component">
  3. <div v-if="tab === 'home'">
  4. <groups-home />
  5. </div>
  6. <div v-if="tab === 'createGroup'">
  7. <!-- <div class="col-12 group-component-hero">
  8. <h3 class="font-weight-bold">Create Group</h3>
  9. <button class="btn btn-outline-primary px-3 rounded-pill font-weight-bold" @click="switchTab('home')">Back to Groups</button>
  10. </div> -->
  11. <create-group />
  12. </div>
  13. <div v-if="tab === 'show'">
  14. <group-feed :group-id="groupId" :path="path" />
  15. </div>
  16. </div>
  17. </template>
  18. <script type="text/javascript">
  19. import GroupsHome from '@/groups/GroupsHome.vue';
  20. import GroupFeed from '@/groups/GroupFeed.vue';
  21. import CreateGroup from '@/groups/CreateGroup.vue';
  22. export default {
  23. props: {
  24. groupId: {
  25. type: String
  26. },
  27. path: {
  28. type: String
  29. }
  30. },
  31. data() {
  32. return {
  33. tab: 'home'
  34. }
  35. },
  36. components: {
  37. "groups-home": GroupsHome,
  38. "create-group": CreateGroup,
  39. "group-feed": GroupFeed,
  40. },
  41. mounted() {
  42. if(this.groupId) {
  43. this.tab = 'show';
  44. }
  45. },
  46. methods: {
  47. switchTab(newTab) {
  48. this.tab = newTab;
  49. }
  50. }
  51. }
  52. </script>
  53. <style lang="scss">
  54. .group-component {
  55. &-hero {
  56. display: flex;
  57. justify-content: space-between;
  58. align-items: center;
  59. padding: 1rem;
  60. border: 1px solid #dee2e6;
  61. border-top: 0;
  62. background-color: #fff;
  63. h3 {
  64. margin-bottom: 0;
  65. }
  66. }
  67. }
  68. </style>