Skip to content

Commit

Permalink
Refactor content.ts and page.tsx files
Browse files Browse the repository at this point in the history
  • Loading branch information
ProchaLu committed Mar 5, 2024
1 parent 612f21c commit af86553
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
14 changes: 1 addition & 13 deletions app/[contentType]/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
getContentData,
getContentList,
getContentTypes,
IContentData,
IContentType,
} from '../../../utils/content';
import { contentTypesMap } from '../../../utils/content-types';
Expand Down Expand Up @@ -174,16 +175,3 @@ function TechStack({ techStack }: { techStack: string[] }) {
</li>
);
}

export interface IContentData {
id: string;
contentHtml: string;
date: Date;
title: string;
previewImage?: string;
description?: string;
tags?: string[];
category?: string;
problem?: string;
techStack?: string[];
}
16 changes: 14 additions & 2 deletions utils/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,25 @@ import html from 'remark-html';
import remarkParse from 'remark-parse';
import { unified } from 'unified';
import { v4 as uuid } from 'uuid';
import { IContentData } from '../app/[contentType]/[slug]/page';
import { contentTypesMap } from './content-types';

const workDirectory = path.join(process.cwd(), 'content', 'work');
const notesDirectory = path.join(process.cwd(), 'content', 'notes');
const articlesDirectory = path.join(process.cwd(), 'content', 'articles');

export interface IContentData {
id: string;
contentHtml: string;
date: Date;
title: string;
previewImage?: string;
description?: string;
tags?: string[];
category?: string;
problem?: string;
techStack?: string[];
}

export type IContent = {
title: string;
slug: string;
Expand All @@ -30,7 +42,7 @@ export type IContent = {

export type IContentType = 'articles' | 'notes' | 'works';

export type ContentType = IContentData & Pick<IContent, 'draft'>;
export type ContentDataType = IContentData & Pick<IContent, 'draft'>;

/**
* Sorts content by their dates
Expand Down

0 comments on commit af86553

Please sign in to comment.