-
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.
Implement Availability custom markdown component (#117)
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import type * as FernRegistryApiRead from "@fern-fern/registry-browser/api/resources/api/resources/v1/resources/read"; | ||
import { EndpointAvailabilityTag } from "../../api-page/endpoints/EndpointAvailabilityTag"; | ||
|
||
export declare namespace Availability { | ||
export interface Props { | ||
type: string; | ||
} | ||
} | ||
|
||
function parseAvailability(type: unknown): FernRegistryApiRead.Availability { | ||
if (typeof type !== "string") { | ||
return "GenerallyAvailable"; | ||
} else if (type === "GenerallyAvailable" || type.toLowerCase() === "ga") { | ||
return "GenerallyAvailable"; | ||
} else if (type.toLowerCase() === "beta") { | ||
return "Beta"; | ||
} else if (type.toLowerCase() === "deprecated") { | ||
return "Deprecated"; | ||
} else { | ||
return "GenerallyAvailable"; | ||
} | ||
} | ||
|
||
export const Availability: React.FC<Availability.Props> = ({ type }) => { | ||
return <EndpointAvailabilityTag availability={parseAvailability(type)} />; | ||
}; |
80c9bd5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
fern-dev – ./packages/ui/fe-bundle
devtest.buildwithfern.com
fern-dev-git-main-buildwithfern.vercel.app
app-dev.buildwithfern.com
fern-dev-buildwithfern.vercel.app