Skip to content

Commit

Permalink
fixup lint
Browse files Browse the repository at this point in the history
  • Loading branch information
rebeccahongsf committed Oct 30, 2024
1 parent 8984cab commit c249c04
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/components/Typography/SrOnlyText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ export const SrOnlyText = ({
as="span"
srOnly
className="white-space-pre"
>{` ${children}`}</Text>
>{` ${String(children)}`}</Text>
);
13 changes: 10 additions & 3 deletions app/utilities/loadTimelineData.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import fs from "fs";
import path from "path";

export async function loadTimelineData() {
interface TimelineItem {
year: string;
heading: string;
intro: string;
content: string;
}

export async function loadTimelineData(): Promise<TimelineItem[]> {
const directoryPath = path.join(process.cwd(), "data/timeline");
const fileNames = fs.readdirSync(directoryPath);

const timelineData = fileNames.map((fileName) => {
const timelineData: TimelineItem[] = fileNames.map((fileName) => {
const filePath = path.join(directoryPath, fileName);
const fileContents = fs.readFileSync(filePath, "utf8");
return JSON.parse(fileContents);
return JSON.parse(fileContents) as TimelineItem;
});

timelineData.sort((a, b) => parseInt(a.year) - parseInt(b.year));
Expand Down

0 comments on commit c249c04

Please sign in to comment.