This commit is contained in:
James Long
2019-08-01 11:13:52 -04:00
commit 8d4317fa85
2 changed files with 61 additions and 0 deletions

19
api/index.md Normal file
View File

@@ -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: '' }
]}
/>

42
api/types.js Normal file
View File

@@ -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>
);
})}
</>
);
}