Skip to content

A local-first personal finance app

initial

James Long8d4317fa8570
diff --git a/api/index.md b/api/index.md
new file mode 100644
index 0000000000..a7d2bb779d
--- /dev/null
+++ b/api/index.md
@@ -0,0 +1,19 @@
+import { types, PrimitiveTypeList, PrimitiveType, StructType } from './types';
+
+# API
+
+This is something that I've been working on a lot.
+
+## Types
+
+Transaction
+
+<PrimitiveTypeList />
+
+<StructType
+ name="Transaction"
+ fields={[
+ { name: 'account_id', type: types.id, description: 'poop' },
+ { name: 'amount', type: types.amount, description: '' }
+ ]}
+/>
diff --git a/api/types.js b/api/types.js
new file mode 100644
index 0000000000..83c8f87af8
--- /dev/null
+++ b/api/types.js
@@ -0,0 +1,42 @@
+export let types = {
+ id: { name: 'id', type: 'string', description: '' },
+ date: { name: 'date', type: 'string', description: 'MM/DD/YYYY' }
+};
+
+export function PrimitiveTypeList() {
+ return Object.keys(types).map(name => {
+ return (
+ <PrimitiveType
+ name={types[name].name}
+ type={types[name].type}
+ description={types[name].description}
+ />
+ );
+ });
+}
+
+export function PrimitiveType({ name, type, description }) {
+ return (
+ <>
+ <h1>{name}</h1>
+ <div>
+ {type} - {description}
+ </div>
+ </>
+ );
+}
+
+export function StructType({ name, fields }) {
+ return (
+ <>
+ <h1>{name}</h1>
+ {fields.map(field => {
+ return (
+ <div>
+ {field.name} - {field.type} - {field.description}
+ </div>
+ );
+ })}
+ </>
+ );
+}