Skip to content
Snippets Groups Projects
Commit 8dce94c0 authored by René Rösner's avatar René Rösner
Browse files

Feat(planning#1067): Added edit link functionality to template

parent 0ee70056
No related branches found
No related tags found
No related merge requests found
import { ResourceCard } from '@/views/Resource'
import { Resource } from '@/views/Resource'
import Link from 'next/link'
import { IconChevronLeft } from '@tabler/icons'
......@@ -37,7 +37,7 @@ export default function ({ resourceName }) {
</div>
</div>
</nav>
<ResourceCard
<Resource
contact={{
name: content.contactInformation.name,
mail: content.contactInformation.mail,
......@@ -47,6 +47,7 @@ export default function ({ resourceName }) {
alt: content.logo.title,
}}
title={content?.name}
slug={content?.slug}
description={content?.text}
developer={{
name: content?.developer.name,
......
......@@ -22,11 +22,6 @@ const useContent = () => {
}
}
function getContentEditUrl(selectedResourceName: string):string {
const gitBranch = process.env.CURRENT_BRANCH || 'main'
const contentDirPath = 'content/resources'
return `https://git.fitko.de/-/ide/project/fit-connect/entwicklungsportal/edit/${gitBranch}/-/${contentDirPath}/${selectedResourceName}/${selectedResourceName}.md`
}
function getContentByResourceName(selectedResourceName: string) {
return prepareResourceContent(selectedResourceName)
......
......@@ -4,6 +4,7 @@ import ResourceCard from '@/components/ResourceCard'
type ResourceContentProperties = {
title: string
slug: string
description: string
img?: {
src: string
......@@ -25,8 +26,15 @@ type ResourceContentProperties = {
resources: any[]
}
const getContentEditUrl = function (selectedResourceName: string):string {
const gitBranch = process.env.CURRENT_BRANCH || 'main'
const contentDirPath = 'content/resources'
return `https://git.fitko.de/-/ide/project/fit-connect/entwicklungsportal/edit/${gitBranch}/-/${contentDirPath}/${selectedResourceName}/${selectedResourceName}.md`
}
export function Resource({
title,
slug,
description,
img,
developer,
......@@ -133,6 +141,15 @@ export function Resource({
</div>
</div>
)}
{(
<div className="sm:col-span-1">
<div className="sm:text-center sm:max-w-lg lg:mxw-0 flex items-stretch flex-grow">
<a className="text-center text-lg relative inline-flex space-x-2 px-4 py-2 font-medium rounded-md text-white bg-yellow-400 hover:bg-yellow-300 hover:cursor-pointer shadow-sm" href={getContentEditUrl(slug)}>
Inhalt bearbeiten
</a>
</div>
</div>
)}
</ResourceCard>
)
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment