Add urls to `ItNavigationProgress` to make them clickable
This commit is contained in:
parent
7217424fdc
commit
02d637f971
|
|
@ -8,11 +8,15 @@ export interface Props {
|
||||||
currentStep: number;
|
currentStep: number;
|
||||||
startBadgeText?: string;
|
startBadgeText?: string;
|
||||||
endBadgeText?: string;
|
endBadgeText?: string;
|
||||||
|
baseUrl?: string;
|
||||||
|
queryParam?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
startBadgeText: undefined,
|
startBadgeText: undefined,
|
||||||
endBadgeText: undefined,
|
endBadgeText: undefined,
|
||||||
|
baseUrl: undefined,
|
||||||
|
queryParam: "page",
|
||||||
});
|
});
|
||||||
|
|
||||||
const hasStartBadge = computed(() => typeof props.startBadgeText !== "undefined");
|
const hasStartBadge = computed(() => typeof props.startBadgeText !== "undefined");
|
||||||
|
|
@ -55,7 +59,10 @@ const endBadgeClasses = computed(() => {
|
||||||
class="inline-flex h-7 items-center justify-center whitespace-nowrap rounded-3xl px-3 text-sm"
|
class="inline-flex h-7 items-center justify-center whitespace-nowrap rounded-3xl px-3 text-sm"
|
||||||
:class="startBadgeClasses"
|
:class="startBadgeClasses"
|
||||||
>
|
>
|
||||||
{{ props.startBadgeText }}
|
<router-link v-if="props.baseUrl" :to="`${props.baseUrl}?${props.queryParam}=0`">
|
||||||
|
{{ props.startBadgeText }}
|
||||||
|
</router-link>
|
||||||
|
<span v-else>{{ props.startBadgeText }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-for="(_, step) in numNumberSteps" :key="step" class="flex flex-row">
|
<div v-for="(_, step) in numNumberSteps" :key="step" class="flex flex-row">
|
||||||
<hr
|
<hr
|
||||||
|
|
@ -66,7 +73,13 @@ const endBadgeClasses = computed(() => {
|
||||||
class="inline-flex h-7 w-7 items-center justify-center rounded-full px-3 py-1 text-sm"
|
class="inline-flex h-7 w-7 items-center justify-center rounded-full px-3 py-1 text-sm"
|
||||||
:class="getPillClasses(step)"
|
:class="getPillClasses(step)"
|
||||||
>
|
>
|
||||||
{{ step + 1 }}
|
<router-link
|
||||||
|
v-if="props.baseUrl"
|
||||||
|
:to="`${props.baseUrl}?${props.queryParam}=${step + 1}`"
|
||||||
|
>
|
||||||
|
{{ step + 1 }}
|
||||||
|
</router-link>
|
||||||
|
<span v-else>{{ step + 1 }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr v-if="hasEndBadge" class="w-8 self-center border border-gray-400" />
|
<hr v-if="hasEndBadge" class="w-8 self-center border border-gray-400" />
|
||||||
|
|
@ -75,7 +88,13 @@ const endBadgeClasses = computed(() => {
|
||||||
class="inline-flex h-7 items-center justify-center whitespace-nowrap rounded-3xl px-3 text-sm"
|
class="inline-flex h-7 items-center justify-center whitespace-nowrap rounded-3xl px-3 text-sm"
|
||||||
:class="endBadgeClasses"
|
:class="endBadgeClasses"
|
||||||
>
|
>
|
||||||
{{ props.endBadgeText }}
|
<router-link
|
||||||
|
v-if="props.baseUrl"
|
||||||
|
:to="`${props.baseUrl}?${props.queryParam}=${steps - 1}`"
|
||||||
|
>
|
||||||
|
{{ props.endBadgeText }}
|
||||||
|
</router-link>
|
||||||
|
<span v-else>{{ props.endBadgeText }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -146,6 +146,8 @@ const assignmentUser = computed(() => {
|
||||||
:show-exit-button="showExitButton"
|
:show-exit-button="showExitButton"
|
||||||
:show-start-button="false"
|
:show-start-button="false"
|
||||||
:show-previous-button="showPreviousButton"
|
:show-previous-button="showPreviousButton"
|
||||||
|
:base-url="props.learningContent.frontend_url"
|
||||||
|
query-param="page"
|
||||||
start-badge-text="Einleitung"
|
start-badge-text="Einleitung"
|
||||||
end-badge-text="Abgabe"
|
end-badge-text="Abgabe"
|
||||||
close-button-variant="close"
|
close-button-variant="close"
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@ interface Props {
|
||||||
startBadgeText?: string;
|
startBadgeText?: string;
|
||||||
endBadgeText?: string;
|
endBadgeText?: string;
|
||||||
closeButtonVariant?: ClosingButtonVariant;
|
closeButtonVariant?: ClosingButtonVariant;
|
||||||
|
baseUrl?: string;
|
||||||
|
queryParam?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
|
@ -55,6 +57,8 @@ const emit = defineEmits(["previous", "next", "exit"]);
|
||||||
:start-badge-text="props.startBadgeText"
|
:start-badge-text="props.startBadgeText"
|
||||||
:steps="stepsCount"
|
:steps="stepsCount"
|
||||||
:end-badge-text="props.endBadgeText"
|
:end-badge-text="props.endBadgeText"
|
||||||
|
:base-url="props.baseUrl"
|
||||||
|
:query-param="props.queryParam"
|
||||||
class="overflow-hidden pb-12"
|
class="overflow-hidden pb-12"
|
||||||
></ItNavigationProgress>
|
></ItNavigationProgress>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue