feat: work on displaying more complex doc structure
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import { Fragment } from 'react';
|
||||||
import { DocSection } from '../types/types';
|
import { DocSection } from '../types/types';
|
||||||
import styles from './Main.module.css';
|
import styles from './Main.module.css';
|
||||||
import Section from './Section';
|
import Section from './Section';
|
||||||
@@ -10,13 +11,13 @@ export default function Main({
|
|||||||
return (
|
return (
|
||||||
<main className={styles.container}>
|
<main className={styles.container}>
|
||||||
{versionSections.map(section => (
|
{versionSections.map(section => (
|
||||||
<>
|
<Fragment key={section.title}>
|
||||||
<Section key={section.title}>
|
<Section key={section.title}>
|
||||||
{section.copy}
|
{section.copy}
|
||||||
{section.example}
|
{section.example}
|
||||||
</Section>
|
</Section>
|
||||||
<div className={styles.divider}> </div>
|
<div className={styles.divider}> </div>
|
||||||
</>
|
</Fragment>
|
||||||
))}
|
))}
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -27,18 +27,22 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 0.25rem;
|
gap: 0.25rem;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.listItem {
|
.listItem {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
gap: 0.5rem;
|
gap: 0.25rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
padding: 0 0.5rem;
|
padding-left: 0.5rem;
|
||||||
|
margin-right: 1rem;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.link {
|
.link,
|
||||||
|
.activeLink {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: #a3acb9;
|
color: #a3acb9;
|
||||||
}
|
}
|
||||||
@@ -47,12 +51,16 @@
|
|||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.activeLink {
|
||||||
|
background-color: #1e1e1e;
|
||||||
|
}
|
||||||
|
|
||||||
.expandable {
|
.expandable {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 1rem;
|
gap: 3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chevron {
|
.chevron {
|
||||||
|
|||||||
@@ -81,11 +81,13 @@ export function loadSections(
|
|||||||
sections: DocSection[] = []
|
sections: DocSection[] = []
|
||||||
): DocSection[] {
|
): DocSection[] {
|
||||||
for (const doc of docs) {
|
for (const doc of docs) {
|
||||||
sections.push({
|
if (doc.copy && doc.example) {
|
||||||
title: doc.title,
|
sections.push({
|
||||||
copy: getCopyChild(version, doc),
|
title: doc.title,
|
||||||
example: getExampleChild(version, doc),
|
copy: getCopyChild(version, doc),
|
||||||
});
|
example: getExampleChild(version, doc),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (doc.children && doc.children.length > 0) {
|
if (doc.children && doc.children.length > 0) {
|
||||||
loadSections(version, doc.children, sections);
|
loadSections(version, doc.children, sections);
|
||||||
|
|||||||
@@ -17,5 +17,26 @@ export const versionTwo: DocsStructure = {
|
|||||||
example: 'example.md',
|
example: 'example.md',
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: 'Resources',
|
||||||
|
folder: 'resources',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
title: 'Records',
|
||||||
|
folder: 'resources/records',
|
||||||
|
copy: 'copy.md',
|
||||||
|
example: 'example.md',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
title: 'Get Records by App',
|
||||||
|
folder:
|
||||||
|
'resources/records/get_records_by_app',
|
||||||
|
copy: 'copy.md',
|
||||||
|
example: 'example.md',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
# The Record Object
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
# Records
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Get Records by App
|
||||||
|
|
||||||
|
Some place holder text.
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
{% code heading="GET /Records/appId/{appID}" language="text" %}
|
||||||
|
|
||||||
|
```curl
|
||||||
|
curl --location 'https://api.onspring.com/Records/appId/195' \
|
||||||
|
--header 'X-ApiKey: 61642d8c686f9e8747e42af8/52cae9a9-4c49-48b6-a3fe-10a48d46ac69'
|
||||||
|
```
|
||||||
|
|
||||||
|
{% /code %}
|
||||||
|
|
||||||
|
{% code heading="RESPONSE" language="json" %}
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"pageNumber": 1,
|
||||||
|
"pageSize": 1,
|
||||||
|
"totalPages": 1,
|
||||||
|
"totalRecords": 1,
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"appId": 195,
|
||||||
|
"recordId": 1,
|
||||||
|
"fieldData": [
|
||||||
|
{
|
||||||
|
"type": "Integer",
|
||||||
|
"fieldId": 6976,
|
||||||
|
"value": 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
{% /code %}
|
||||||
Reference in New Issue
Block a user