Skip to content
Snippets Groups Projects
CommunityHeader.vue 2.11 KiB
Newer Older
Gilgard's avatar
Gilgard committed
<template>
  <div class="flex items-center justify-between mx-4">
    <div class="flex-1 min-w-0">
      <h2
        class="text-2xl font-bold leading-7 text-gray-900 sm:text-3xl sm:truncate"
      >
        {{ community.name }}
      </h2>
      <div
        class="mt-1 flex flex-col sm:flex-row sm:flex-wrap sm:mt-0 sm:space-x-6"
      >
        <div class="mt-2 flex items-center text-sm text-gray-500">
          <svg
            class="flex-shrink-0 mr-1.5 h-5 w-5 text-gray-400"
            xmlns="http://www.w3.org/2000/svg"
            viewBox="0 0 20 20"
            fill="currentColor"
            aria-hidden="true"
          >
            <path
              fill-rule="evenodd"
              d="M5.05 4.05a7 7 0 119.9 9.9L10 18.9l-4.95-4.95a7 7 0 010-9.9zM10 11a2 2 0 100-4 2 2 0 000 4z"
              clip-rule="evenodd"
            />
          </svg>
          {{ community.location }}
        </div>
      </div>
    </div>
    <div class="flex">
      <span class="hidden sm:block">
        <button
          v-if="adminStatus"
          @click="edit()"
          type="button"
          class="inline-flex items-center px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
        >
          <!-- Heroicon name: solid/pencil -->
          <svg
            xmlns="http://www.w3.org/2000/svg"
            class="h-5 w-5"
            viewBox="0 0 20 20"
            fill="currentColor"
          >
            <path
              d="M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z"
            />
          </svg>
          Edit
        </button>
      </span>
    </div>
  </div>
</template>

<script>
export default {
  name: "CommunityHeader",
  props: {
    adminStatus: Boolean,
    community: {
      communityId: Number,
      name: String,
      description: String,
      visibility: Number,
      location: String,
      picture: String,
    },
  },
  methods: {
    edit() {
      this.$emit("edit");
    },
  },
};
</script>