mirror of
https://github.com/morten-olsen/morten-olsen.github.io.git
synced 2026-02-08 01:46:28 +01:00
feat: init
This commit is contained in:
1
profile/src/data/index.ts
Normal file
1
profile/src/data/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './positions';
|
||||
14
profile/src/data/positions.ts
Normal file
14
profile/src/data/positions.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Position } from "../types/positions";
|
||||
|
||||
const context = (require as any).context('../../positions', true, /\.md$/)
|
||||
|
||||
const getPositions = () => context.keys().map((key: string) => context(key)).map((a: any) => ({
|
||||
...a,
|
||||
attributes: {
|
||||
...a.attributes,
|
||||
start: a.attributes.start ? new Date(a.attributes.start).getTime() : null,
|
||||
end: a.attributes.end ? new Date(a.attributes.end).getTime() : null,
|
||||
},
|
||||
})) as Position[];
|
||||
|
||||
export { getPositions };
|
||||
2
profile/src/index.ts
Normal file
2
profile/src/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './data';
|
||||
export * from './types';
|
||||
1
profile/src/types/index.ts
Normal file
1
profile/src/types/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './positions';
|
||||
11
profile/src/types/positions.ts
Normal file
11
profile/src/types/positions.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
type Position = {
|
||||
body: string;
|
||||
attributes: {
|
||||
start: number;
|
||||
end?: number;
|
||||
company: string;
|
||||
title: string;
|
||||
};
|
||||
};
|
||||
|
||||
export type { Position };
|
||||
Reference in New Issue
Block a user