|
| 1 | +<!-- |
| 2 | + ~ Copyright 2023 Exactpro (Exactpro Systems Limited) |
| 3 | + ~ |
| 4 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + ~ you may not use this file except in compliance with the License. |
| 6 | + ~ You may obtain a copy of the License at |
| 7 | + ~ |
| 8 | + ~ http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + ~ |
| 10 | + ~ Unless required by applicable law or agreed to in writing, software |
| 11 | + ~ distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + ~ See the License for the specific language governing permissions and |
| 14 | + ~ limitations under the License. |
| 15 | + --> |
| 16 | + |
| 17 | +<script setup lang="ts"> |
| 18 | +import type { ParsedContent } from '@nuxt/content/dist/runtime/types' |
| 19 | +
|
| 20 | +const props = defineProps<{ |
| 21 | + doc: Pick<ParsedContent, string> |
| 22 | +}>() |
| 23 | +
|
| 24 | +const githubInfo = useAppConfig().exactproDocs.github |
| 25 | +
|
| 26 | +const { data: editBasePath } = useFetch( |
| 27 | + '/api/_docs-toolkit/github/edit-base-path' |
| 28 | +) |
| 29 | +
|
| 30 | +const editPath = computed(() => { |
| 31 | + return `${editBasePath.value}/${props.doc._source}/${props.doc._file}` |
| 32 | +}) |
| 33 | +
|
| 34 | +const createIssuePath = computed(() => { |
| 35 | + return `${githubInfo.repoLink}/issues/new/choose` |
| 36 | +}) |
| 37 | +</script> |
| 38 | + |
| 39 | +<template> |
| 40 | + <div |
| 41 | + v-if="githubInfo.repoLink" |
| 42 | + class="flex justify-end gap-4 flex-wrap items-center" |
| 43 | + > |
| 44 | + <a :href="editPath" class="github-action-button"> |
| 45 | + <Icon |
| 46 | + class="w-4 h-4 mr-2 text-primary" |
| 47 | + name="heroicons:pencil-square-solid" |
| 48 | + /> |
| 49 | + <span>Edit this page</span> |
| 50 | + </a> |
| 51 | + <a :href="createIssuePath" class="github-action-button"> |
| 52 | + <Icon |
| 53 | + class="w-4 h-4 mr-2 text-error" |
| 54 | + name="heroicons:chat-bubble-left-20-solid" |
| 55 | + /> |
| 56 | + <span>Create issue</span> |
| 57 | + </a> |
| 58 | + </div> |
| 59 | +</template> |
| 60 | + |
| 61 | +<style> |
| 62 | +.github-action-button { |
| 63 | + @apply bg-gray-200 hover:bg-gray-300 text-gray-800 font-bold py-2 px-4 rounded inline-flex items-center; |
| 64 | +} |
| 65 | +</style> |
0 commit comments