mirror of
https://github.com/actualbudget/actual.git
synced 2026-04-27 17:48:17 -05:00
initial
This commit is contained in:
19
api/index.md
Normal file
19
api/index.md
Normal 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
42
api/types.js
Normal 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>
|
||||
);
|
||||
})}
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user