Refactor LearningContentSimpleLayout component
This commit is contained in:
parent
4c26f4f72d
commit
d4cb37d229
|
|
@ -1,8 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<LearningContentSimpleLayout
|
<LearningContentSimpleLayout learning-content-type="resource">
|
||||||
:subtitle="learningContentTypeData('resource').title"
|
|
||||||
:learning-content-type="'resource'"
|
|
||||||
>
|
|
||||||
<div class="h-screen">
|
<div class="h-screen">
|
||||||
<iframe width="100%" height="100%" scrolling="no" :src="value.url" />
|
<iframe width="100%" height="100%" scrolling="no" :src="value.url" />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -12,13 +9,12 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import LearningContentSimpleLayout from "@/pages/learningPath/learningContentPage/layouts/LearningContentSimpleLayout.vue";
|
import LearningContentSimpleLayout from "@/pages/learningPath/learningContentPage/layouts/LearningContentSimpleLayout.vue";
|
||||||
import type { LearningContent } from "@/types";
|
import type { LearningContent } from "@/types";
|
||||||
import { learningContentTypeData } from "@/utils/typeMaps";
|
|
||||||
|
|
||||||
interface Value {
|
export interface Value {
|
||||||
url: string;
|
url: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<{
|
defineProps<{
|
||||||
value: Value;
|
value: Value;
|
||||||
content: LearningContent;
|
content: LearningContent;
|
||||||
}>();
|
}>();
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<LearningContentSimpleLayout
|
<LearningContentSimpleLayout
|
||||||
:title="content.title"
|
:title="content.title"
|
||||||
:subtitle="learningContentTypeData('media_library').title"
|
learning-content-type="media_library"
|
||||||
:learning-content-type="'media_library'"
|
|
||||||
>
|
>
|
||||||
<div class="container-medium">
|
<div class="container-medium">
|
||||||
<p class="text-large my-4 lg:my-8">{{ value.description }}</p>
|
<p class="text-large my-4 lg:my-8">{{ value.description }}</p>
|
||||||
|
|
@ -16,16 +15,15 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import LearningContentSimpleLayout from "@/pages/learningPath/learningContentPage/layouts/LearningContentSimpleLayout.vue";
|
import LearningContentSimpleLayout from "@/pages/learningPath/learningContentPage/layouts/LearningContentSimpleLayout.vue";
|
||||||
import type { LearningContent } from "@/types";
|
import type { LearningContent } from "@/types";
|
||||||
import { learningContentTypeData } from "@/utils/typeMaps";
|
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
|
|
||||||
const route = useRoute();
|
export interface Value {
|
||||||
|
|
||||||
interface Value {
|
|
||||||
description: string;
|
description: string;
|
||||||
url: string;
|
url: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const route = useRoute();
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
value: Value;
|
value: Value;
|
||||||
content: LearningContent;
|
content: LearningContent;
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,19 @@
|
||||||
<template>
|
<template>
|
||||||
<LearningContentSimpleLayout
|
<LearningContentSimpleLayout
|
||||||
:title="content.title"
|
:title="content.title"
|
||||||
:subtitle="learningContentTypeData('placeholder').title"
|
learning-content-type="placeholder"
|
||||||
:learning-content-type="'placeholder'"
|
|
||||||
></LearningContentSimpleLayout>
|
></LearningContentSimpleLayout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import LearningContentSimpleLayout from "@/pages/learningPath/learningContentPage/layouts/LearningContentSimpleLayout.vue";
|
import LearningContentSimpleLayout from "@/pages/learningPath/learningContentPage/layouts/LearningContentSimpleLayout.vue";
|
||||||
import type { LearningContent } from "@/types";
|
import type { LearningContent } from "@/types";
|
||||||
import { learningContentTypeData } from "@/utils/typeMaps";
|
|
||||||
|
|
||||||
interface Value {
|
export interface Value {
|
||||||
description: string;
|
description: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<{
|
defineProps<{
|
||||||
value: Value;
|
value: Value;
|
||||||
content: LearningContent;
|
content: LearningContent;
|
||||||
}>();
|
}>();
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<LearningContentSimpleLayout
|
<LearningContentSimpleLayout :title="content.title" learning-content-type="video">
|
||||||
:title="content.title"
|
|
||||||
:subtitle="learningContentTypeData('video').title"
|
|
||||||
:learning-content-type="'video'"
|
|
||||||
>
|
|
||||||
<div class="container-medium">
|
<div class="container-medium">
|
||||||
<iframe
|
<iframe
|
||||||
class="mt-8 aspect-video w-full"
|
class="mt-8 aspect-video w-full"
|
||||||
|
|
@ -20,13 +16,12 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import LearningContentSimpleLayout from "@/pages/learningPath/learningContentPage/layouts/LearningContentSimpleLayout.vue";
|
import LearningContentSimpleLayout from "@/pages/learningPath/learningContentPage/layouts/LearningContentSimpleLayout.vue";
|
||||||
import type { LearningContent } from "@/types";
|
import type { LearningContent } from "@/types";
|
||||||
import { learningContentTypeData } from "@/utils/typeMaps";
|
|
||||||
|
|
||||||
interface Value {
|
export interface Value {
|
||||||
url: string;
|
url: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<{
|
defineProps<{
|
||||||
value: Value;
|
value: Value;
|
||||||
content: LearningContent;
|
content: LearningContent;
|
||||||
}>();
|
}>();
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,16 @@ import LearningContentFooter from "@/pages/learningPath/learningContentPage/layo
|
||||||
import type { LearningContentType } from "@/types";
|
import type { LearningContentType } from "@/types";
|
||||||
import { learningContentTypeData } from "@/utils/typeMaps";
|
import { learningContentTypeData } from "@/utils/typeMaps";
|
||||||
|
|
||||||
interface Props {
|
export interface Props {
|
||||||
title: string | undefined;
|
title: string;
|
||||||
subtitle: string;
|
|
||||||
learningContentType: LearningContentType;
|
learningContentType: LearningContentType;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
title: undefined,
|
title: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const type = learningContentTypeData(props.learningContentType);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -21,12 +22,9 @@ const props = withDefaults(defineProps<Props>(), {
|
||||||
v-if="props.learningContentType !== 'placeholder'"
|
v-if="props.learningContentType !== 'placeholder'"
|
||||||
class="flex h-min w-full items-center gap-2 pb-8"
|
class="flex h-min w-full items-center gap-2 pb-8"
|
||||||
>
|
>
|
||||||
<component
|
<component :is="type.icon" class="h-6 w-6 text-gray-900"></component>
|
||||||
:is="learningContentTypeData(props.learningContentType).icon"
|
|
||||||
class="h-6 w-6 text-gray-900"
|
|
||||||
></component>
|
|
||||||
<p class="whitespace-nowrap text-gray-900">
|
<p class="whitespace-nowrap text-gray-900">
|
||||||
{{ props.subtitle }}
|
{{ type.title }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
import type { LearningContentType } from "@/types";
|
import type { LearningContentType } from "@/types";
|
||||||
import { assertUnreachable } from "@/utils/utils";
|
import { assertUnreachable } from "@/utils/utils";
|
||||||
|
|
||||||
export function learningContentTypeData(t: LearningContentType): {
|
export interface LearningContentIdentifier {
|
||||||
title: string;
|
title: string;
|
||||||
icon: string;
|
icon: string;
|
||||||
} {
|
}
|
||||||
|
|
||||||
|
export function learningContentTypeData(t: LearningContentType): LearningContentIdentifier {
|
||||||
switch (t) {
|
switch (t) {
|
||||||
case "assignment":
|
case "assignment":
|
||||||
return { title: "Transferauftrag", icon: "it-icon-lc-assignment" };
|
return { title: "Transferauftrag", icon: "it-icon-lc-assignment" };
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue