-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove src/ and update importFromGoogleDocs
- Loading branch information
Showing
35 changed files
with
113 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
src/components/article/Article.tsx → app/components/article/Article.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
src/components/article/Common.tsx → app/components/article/Common.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import { ReactNode } from 'react' | ||
|
||
import { getSlug } from '../../utils' | ||
|
||
type PropsString = { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/components/image/ImageFloat.tsx → app/components/image/ImageFloat.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { readdir, stat } from 'fs/promises' | ||
import path from 'path' | ||
|
||
const ARTICLES_DIRECTORY = path.join(process.cwd(), 'app') | ||
|
||
export async function getArticles() { | ||
const slugs: string[] = [] | ||
|
||
async function readDirectory(dir) { | ||
const entries = await readdir(dir) | ||
|
||
for (const entry of entries) { | ||
const entryPath = path.join(dir, entry) | ||
|
||
if (!(await stat(entryPath)).isDirectory()) { | ||
continue | ||
} | ||
|
||
try { | ||
await stat(path.join(entryPath, 'article.tsx')) | ||
} catch (e) { | ||
continue | ||
} | ||
|
||
slugs.push(entry) | ||
} | ||
} | ||
|
||
await readDirectory(ARTICLES_DIRECTORY) | ||
|
||
const articles = await Promise.all( | ||
slugs.map((slug) => | ||
import(`./${slug}/article`).then((m) => ({ | ||
...m.article, | ||
slug, | ||
})), | ||
), | ||
) | ||
|
||
return articles.sort((a, b) => b.published - a.published) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,18 @@ | ||
import { readdir, stat } from 'fs/promises' | ||
import path from 'path' | ||
|
||
const ARTICLES_DIRECTORY = path.join(process.cwd(), 'app') | ||
|
||
export async function getArticles() { | ||
const slugs: string[] = [] | ||
|
||
async function readDirectory(dir) { | ||
const entries = await readdir(dir) | ||
|
||
for (const entry of entries) { | ||
const entryPath = path.join(dir, entry) | ||
|
||
if ((await stat(entryPath)).isDirectory()) { | ||
slugs.push(entry) | ||
} | ||
} | ||
} | ||
export function classNames(...classes: string[]) { | ||
return classes.filter(Boolean).join(' ') | ||
} | ||
|
||
await readDirectory(ARTICLES_DIRECTORY) | ||
export function unixTimestampToMonthYear(unixTimestamp: number) { | ||
const date = new Date(unixTimestamp * 1000) | ||
const month = new Intl.DateTimeFormat('en-US', { month: 'long' }).format(date) | ||
const year = date.getFullYear() | ||
|
||
const articles = await Promise.all( | ||
slugs.map((slug) => | ||
import(`./${slug}/article`).then((m) => ({ | ||
...m.article, | ||
slug, | ||
})), | ||
), | ||
) | ||
return `${month}, ${year}` | ||
} | ||
|
||
return articles.sort((a, b) => b.published - a.published) | ||
export function getSlug(text: string) { | ||
return text | ||
.toLowerCase() | ||
.replace(/\s+/g, '-') | ||
.replace(/[^0-9a-z\-]/gi, '') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.