Skip to content

Commit

Permalink
hack: remove Built With Fern logo for Polytomic (#367)
Browse files Browse the repository at this point in the history
  • Loading branch information
abvthecity authored Jan 18, 2024
1 parent cf22b1e commit be40493
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/ui/app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const App: React.FC<App.Props> = ({ docs, resolvedPath }) => {
(children, Context) => (
<Context>{children}</Context>
),
<DocsContextProvider docsDefinition={docs.definition}>
<DocsContextProvider docsDefinition={docs.definition} domain={docs.baseUrl.domain}>
<NavigationContextProvider resolvedPath={resolvedPath} basePath={docs.baseUrl.basePath}>
<Docs />
</NavigationContextProvider>
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/app/src/docs-context/DocsContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { APIV1Read, DocsV1Read, FdrAPI } from "@fern-api/fdr-sdk";
import React from "react";

export const DocsContext = React.createContext<DocsContextValue>({
domain: "app.buildwithfern.com",
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
docsDefinition: undefined!,
resolveApi: () => undefined,
Expand All @@ -10,6 +11,7 @@ export const DocsContext = React.createContext<DocsContextValue>({
});

export interface DocsContextValue {
domain: string;
docsDefinition: DocsV1Read.DocsDefinition;

resolveApi: (apiId: FdrAPI.ApiDefinitionId) => APIV1Read.ApiDefinition | undefined;
Expand Down
3 changes: 3 additions & 0 deletions packages/ui/app/src/docs-context/DocsContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ import { DocsContext } from "./DocsContext";
export declare namespace DocsContextProvider {
export type Props = PropsWithChildren<{
docsDefinition: DocsV1Read.DocsDefinition;
domain: string;
}>;
}

export const DocsContextProvider: React.FC<DocsContextProvider.Props> = ({
domain,
docsDefinition: unmemoizedDocsDefinition,
children,
}) => {
Expand Down Expand Up @@ -54,6 +56,7 @@ export const DocsContextProvider: React.FC<DocsContextProvider.Props> = ({
return (
<DocsContext.Provider
value={{
domain,
docsDefinition,
resolveApi,
resolvePage,
Expand Down
22 changes: 13 additions & 9 deletions packages/ui/app/src/sidebar/BuiltWithFern.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useIsHovering } from "@fern-ui/react-commons";
import classNames from "classnames";
import { useCallback } from "react";
import Link from "next/link";
import { useDocsContext } from "../docs-context/useDocsContext";
import { FernLogo } from "./FernLogo";

export declare namespace BuiltWithFern {
Expand All @@ -10,16 +11,19 @@ export declare namespace BuiltWithFern {
}

export const BuiltWithFern: React.FC<BuiltWithFern.Props> = ({ className }) => {
const onClick = useCallback(() => {
window.open("https://buildwithfern.com", "_blank", "noopener noreferrer");
}, []);

const { isHovering, ...containerCallbacks } = useIsHovering();

const { domain } = useDocsContext();

// TODO: move this to venus
if (domain.toLowerCase().includes("polytomic")) {
return null;
}

return (
<div
className={classNames("flex cursor-pointer items-center space-x-2 pl-3 py-3 mt-4", className)}
onClick={onClick}
<Link
href="https://buildwithfern.com"
className={classNames("flex cursor-pointer items-center space-x-2 pl-3 py-3 mt-4 !no-underline", className)}
{...containerCallbacks}
>
<div className="h-4 w-4">
Expand All @@ -33,6 +37,6 @@ export const BuiltWithFern: React.FC<BuiltWithFern.Props> = ({ className }) => {
>
Built with Fern
</div>
</div>
</Link>
);
};

1 comment on commit be40493

@vercel
Copy link

@vercel vercel bot commented on be40493 Jan 18, 2024

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

app-dev.buildwithfern.com
fern-dev-buildwithfern.vercel.app
fern-dev-git-main-buildwithfern.vercel.app

Please sign in to comment.