Skip to content

Commit b8bc1a5

Browse files
author
Chris D. Macrae
committed
Setup bookshelf
1 parent b103b43 commit b8bc1a5

31 files changed

+1992
-783
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ build/Release
4040
# Dependency directories
4141
node_modules/
4242
jspm_packages/
43+
.yalc/
4344

4445
# Snowpack dependency directory (https://snowpack.dev/)
4546
web_modules/

package-lock.json

Lines changed: 1096 additions & 637 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"start": "next start"
1010
},
1111
"dependencies": {
12+
"@chrisdmacrae/teditor": "^0.1.7",
1213
"bootstrap": "^4.5.2",
1314
"dotenv": "^8.2.0",
1415
"gray-matter": "^4.0.3",
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
href: "https://www.goodreads.com/book/show/4898.Blue_Ocean_Strategy"
3+
title: "Blue Ocean Strategy"
4+
description: "An extremely well-thought out primer on how to create uncontested market space and make your competition irrelevant to your efforts. A seriously important read for anyone trying to innovate."
5+
author: W. Chan Kim, Renée Mauborgne
6+
rating: 4
7+
src: "/uploads/blue-ocean-strategy.jpg"
8+
---
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { join } from 'path';
2+
import {getAllContent, getContentPaths, getContentBySlug, BaseModel} from '../content';
3+
4+
export type BookModel = BaseModel & {
5+
title: string;
6+
description: string;
7+
href: string;
8+
src: string;
9+
}
10+
11+
export const booksDirectory = join(process.cwd(), 'packages/cdm-content/books/');
12+
export const getBookPaths = () => getContentPaths(booksDirectory, ['.md']);
13+
export const getBookBySlug = (slug: string, fields?: string[]) => getContentBySlug<BookModel>(slug, booksDirectory, '.md');
14+
export const getAllBooks = (fields?: string[]) => getAllContent<BookModel>(booksDirectory, ['.md'], '', fields);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
href: https://www.goodreads.com/book/show/38315.Fooled_by_Randomness?from_search=true&from_srp=true&qid=6VJqZRvKnP&rank=1
3+
title: Fooled by Randomness
4+
subtitle: The Hidden Role of Chance in Life and in the Markets
5+
description: This book helps you see directly into the heart of human bias, helping us understand the shortcuts -- and shortcomings -- of the human brain that lead us to allow randomness to fool us into taking unreasonable courses of action. A must read.
6+
author: Nassim Nicholas Taleb
7+
rating: 4
8+
src: /uploads/fooled-by-randomness.jpg
9+
---
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './books';
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
href: https://www.goodreads.com/book/show/242472.The_Black_Swan
3+
title: The Black Swan
4+
subtitle: The Impact of the Highly Improbable
5+
description: |
6+
In a modern world access to the answer to billions of questions and thousands of years of history are at our fingertips, the black swan reminds us how our forefathers dealt with risk, keeps us humble, and prevents us from being fooled by randomness.
7+
author: Nassim Nicholas Taleb
8+
rating: 5
9+
src: /uploads/the-black-swan.jpg
10+
---
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
href: https://www.goodreads.com/book/show/3828902-thinking-in-systems
3+
title: Thinking in Systems
4+
subtitle: "A Primer"
5+
description: |
6+
The greatest shortcut you can take to becoming a senior manager, architect, designer, or developer. Seeing the world systematically is a priceless super power.
7+
author: Donella H. Meadows, Diana Wright
8+
rating: 5
9+
src: /uploads/thinking-in-systems.jpg
10+
---
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React, { useEffect, useMemo } from 'react';
2+
import { Cms, CmsConfig, CmsProvider } from '@chrisdmacrae/teditor';
3+
4+
export type CdmCmsProviderProps = {
5+
config: CmsConfig
6+
}
7+
8+
export const CdmCmsProvider: React.FC<CdmCmsProviderProps> = ({ config, children }) => {
9+
const cms = useMemo(() => new Cms(config), [JSON.stringify(config)]);
10+
useEffect(() => cms.enable(), []);
11+
12+
return (
13+
<CmsProvider cms={cms}>
14+
{children}
15+
</CmsProvider>
16+
)
17+
}

0 commit comments

Comments
 (0)