-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: render markdown pages normally when isApiScrollingDisabled is tr…
…ue (#1204)
- Loading branch information
1 parent
c9b055a
commit 50b56a5
Showing
21 changed files
with
232 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { FernNavigation } from "@fern-api/fdr-sdk"; | ||
import { useAtomValue } from "jotai"; | ||
import { ReactElement, useMemo } from "react"; | ||
import { SLUG_ATOM, useNavigationNodes } from "../atoms"; | ||
import { FernErrorBoundary } from "../components/FernErrorBoundary"; | ||
import { ResolvedApiDefinition, ResolvedRootPackage, flattenRootPackage } from "../resolver/types"; | ||
import { Endpoint } from "./endpoints/Endpoint"; | ||
import { WebSocket } from "./web-socket/WebSocket"; | ||
import { Webhook } from "./webhooks/Webhook"; | ||
|
||
interface SingleApiPageContentProps { | ||
root: ResolvedRootPackage; | ||
showErrors: boolean; | ||
} | ||
|
||
export function SingleApiPageContent({ root, showErrors }: SingleApiPageContentProps): ReactElement | null { | ||
const flattened = useMemo(() => { | ||
return flattenRootPackage(root); | ||
}, [root]); | ||
const selectedSlug = useAtomValue(SLUG_ATOM); | ||
const navigationNodes = useNavigationNodes(); | ||
|
||
const apiDefinition = flattened.apiDefinitions.find((api) => api.slug === selectedSlug); | ||
|
||
if (apiDefinition == null) { | ||
return null; | ||
} | ||
|
||
const parents = navigationNodes.getParents(apiDefinition.nodeId); | ||
const breadcrumbs = FernNavigation.utils.createBreadcrumb(parents); | ||
|
||
return ( | ||
<FernErrorBoundary component="ApiPackageContents"> | ||
{ResolvedApiDefinition.visit(apiDefinition, { | ||
endpoint: (endpoint) => ( | ||
<Endpoint | ||
api={root.api} | ||
showErrors={showErrors} | ||
endpoint={endpoint} | ||
breadcrumbs={breadcrumbs} | ||
isLastInApi={true} | ||
types={root.types} | ||
/> | ||
), | ||
webhook: (webhook) => ( | ||
<Webhook webhook={webhook} breadcrumbs={breadcrumbs} isLastInApi={true} types={root.types} /> | ||
), | ||
websocket: (websocket) => ( | ||
<WebSocket api={root.api} websocket={websocket} isLastInApi={true} types={root.types} /> | ||
), | ||
})} | ||
</FernErrorBoundary> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.