better markdown support, minor layout fixes
This commit is contained in:
@@ -22,9 +22,9 @@ export default function CvCategory(props:CvCategoryProps) {
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
{(query.data?.cvEntry.length ? query.data?.cvEntry.length : 0 ) > 0 ?
|
||||
<CardContent className={cn(props.layout == "row" ? "flex flex-row" : "flex flex-col","gap-[1rem]")}>
|
||||
<CardContent className={cn(props.layout == "row" ? "flex flex-row flex-wrap justify-center lg:justify-between" : "flex flex-col","gap-[1rem]","overflow-scroll")}>
|
||||
{query.data?.cvEntry.map((entry) => (
|
||||
<CvEntry key={entry.id} initialData={entry}/>
|
||||
<CvEntry className={props.layout == "row" ? "w-full lg:w-fit" : undefined} key={entry.id} initialData={entry}/>
|
||||
))}
|
||||
</CardContent>
|
||||
:
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
import { trpc } from "~/app/_trpc/Client"
|
||||
import { Card, CardContent, CardFooter, CardHeader, CardTitle } from "~/components/ui/card"
|
||||
import { Skeleton } from "~/components/ui/skeleton"
|
||||
import type { Element } from "~/lib/utils"
|
||||
import { cn, type Element } from "~/lib/utils"
|
||||
import type { CategoryRouterOutputs } from "~/server/routers/cv/category"
|
||||
import type { EntryRouterOutputs } from "~/server/routers/cv/entry"
|
||||
import Markdown from 'react-markdown'
|
||||
import rehypeRaw from 'rehype-raw'
|
||||
import { format } from 'date-fns'
|
||||
|
||||
import rehypeHighlight from 'rehype-highlight'
|
||||
import rehypeRaw from 'rehype-raw'
|
||||
export default function CvEntry(params: {
|
||||
initialData: EntryRouterOutputs['get'] | Element<Element<CategoryRouterOutputs['list']>['cvEntry']>
|
||||
className?: string
|
||||
}) {
|
||||
const query = trpc.cv.entry.get.useQuery({ id: params.initialData?.id ? params.initialData.id : "" })
|
||||
const { data } = query
|
||||
@@ -18,7 +19,7 @@ export default function CvEntry(params: {
|
||||
{
|
||||
data ?
|
||||
<>
|
||||
<Card className="w-fit">
|
||||
<Card className={params.className ? cn("w-fit",params.className) : "w-fit"}>
|
||||
{
|
||||
data.title ?
|
||||
<CardHeader>
|
||||
@@ -28,9 +29,9 @@ export default function CvEntry(params: {
|
||||
}
|
||||
{
|
||||
data.description ?
|
||||
<CardContent>
|
||||
<CardContent className="text-sm lg:text-base">
|
||||
<div>
|
||||
<Markdown rehypePlugins={[rehypeRaw]}>{data.description}</Markdown>
|
||||
<Markdown rehypePlugins={[rehypeHighlight,rehypeRaw]}>{data.description}</Markdown>
|
||||
</div>
|
||||
</CardContent> :
|
||||
<></>
|
||||
|
||||
@@ -61,8 +61,8 @@ export default function CvPage() {
|
||||
{categories.data.filter((cat) => cat.layoutPosition == 'sidebar').length > 0 ?
|
||||
<>
|
||||
<SidebarTriggerDisappearsOnMobile />
|
||||
<Sidebar className="z-[51] gsapan">
|
||||
<SidebarContent className="p-2">
|
||||
<Sidebar className="gsapan ">
|
||||
<SidebarContent className="p-2 lg:pt-[3.2rem]">
|
||||
{sidebarCategories.map((cat) => {
|
||||
return (
|
||||
<CvCategory layout="col" initialData={cat} key={cat.id} />
|
||||
@@ -74,17 +74,17 @@ export default function CvPage() {
|
||||
<></>
|
||||
}
|
||||
<div className="h-full w-full flex flex-wrap flex-row p-[1rem] pt-[2rem] ">
|
||||
<div id="mainwrap" className="flex w-full flex-col gap-[1rem]">
|
||||
<div id="header" className="flex w-full h-fit flex-row gap-[1rem]">
|
||||
<div id="mainwrap" className="flex w-full flex-col gap-[1rem] lg:px-[15vw]">
|
||||
<div id="header" className="flex w-full h-fit flex-row gap-[1rem] flex-wrap">
|
||||
{headerCategories.map((cat) => {
|
||||
return (
|
||||
<CvCategory layout="row" initialData={cat} key={cat.id} />
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
<div id="colwrapper" className="flex flex-col md:flex-row w-full h-3/4 gap-[1rem]">
|
||||
<div id="colwrapper" className="flex flex-col lg:flex-row w-full h-3/4 gap-[1rem]">
|
||||
{col1Categories.length > 0 ?
|
||||
<div id="col1" className={`flex flex-col w-full ${col2Categories.length > 0 ? "md:w-1/2" : ""} h-full gap-[1rem]`}>
|
||||
<div id="col1" className={`flex flex-col w-full ${col2Categories.length > 0 ? "lg:w-1/2" : ""} h-full gap-[1rem]`}>
|
||||
{col1Categories.map((cat) => {
|
||||
return (
|
||||
<CvCategory layout="col" initialData={cat} key={cat.id} />
|
||||
@@ -94,7 +94,7 @@ export default function CvPage() {
|
||||
<></>
|
||||
}
|
||||
{col2Categories.length > 0 ?
|
||||
<div id="col2" className={`flex flex-col w-full ${col1Categories.length > 0 ? "md:w-1/2" : ""} h-full gap-[1rem]`}>
|
||||
<div id="col2" className={`flex flex-col w-full ${col1Categories.length > 0 ? "lg:w-1/2" : ""} h-full gap-[1rem]`}>
|
||||
{col2Categories.map((cat) => {
|
||||
return (
|
||||
<CvCategory layout="col" initialData={cat} key={cat.id} />
|
||||
|
||||
Reference in New Issue
Block a user