Skip to content

Commit 35bd2a8

Browse files
authored
Merge branch 'feature/api-docs' into apiDocs-modal-tabbing
2 parents ce49862 + b803bbc commit 35bd2a8

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

src/components/ApiDocs/FunctionReturn.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { MDXHeading } from '../MDXComponents';
33
import { Promise } from './display/Promise';
44
import { ApiComment } from './ApiComment';
55
import references from '@/directory/apiReferences.json';
6+
import { ParameterType } from './display';
67

78
export const FunctionReturn = ({ functionReturn, sigName }) => {
89
const name = functionReturn.name;
@@ -15,7 +16,7 @@ export const FunctionReturn = ({ functionReturn, sigName }) => {
1516
}
1617
} else {
1718
const returnType = references[functionReturn.target];
18-
display = name;
19+
display = <ParameterType typeData={functionReturn} />;
1920
if (returnType?.comment?.summary) {
2021
description = <ApiComment apiComment={returnType.comment.summary} />;
2122
}

src/components/ApiDocs/display/ApiModal.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ export const ApiModal = ({
9090
setTimeout(() => {
9191
ref?.current?.focus();
9292
}, 0);
93+
94+
if (typeof window != 'undefined') {
95+
window.onclick = function (event) {
96+
if (event.target.className.includes('api-modal-container--open')) {
97+
closeModal();
98+
}
99+
};
93100
}
94101

95102
return (
@@ -128,7 +135,7 @@ export const ApiModal = ({
128135
* viewports.
129136
*/}
130137
<dd
131-
className="api-modal__api-value"
138+
className="api-modal__api-value api-modal__content__value"
132139
tabIndex={data.type?.type === 'reference' ? -1 : 0}
133140
>
134141
<View as="code" className="parameter">
@@ -138,7 +145,7 @@ export const ApiModal = ({
138145
{description ? (
139146
<>
140147
<dt>Description:</dt>
141-
<dd>
148+
<dd className="api-modal__content__description">
142149
<ApiComment apiComment={description} />
143150
</dd>
144151
</>

src/components/ApiDocs/display/Promise.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const Promise = ({ typeObject }) => {
88
}, []);
99
return (
1010
<>
11-
<View>Promise&lt;{promiseTypes}&gt;</View>
11+
<View className="api-promise">Promise&lt;{promiseTypes}&gt;</View>
1212
</>
1313
);
1414
};

src/styles/reference.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@
6767
font-weight: bold;
6868
align-items: baseline;
6969
}
70+
&__description, &__value {
71+
color: var(--amplify-colors-neutral-90);
72+
}
7073
}
7174

7275
.api-modal__api-name {
@@ -97,6 +100,12 @@
97100
margin-inline-start: var(--amplify-space-medium);
98101
}
99102

103+
.api-promise {
104+
.type-link {
105+
margin: 0;
106+
}
107+
}
108+
100109
.type-link {
101110
cursor: pointer;
102111
margin: 4px;

0 commit comments

Comments
 (0)