Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hack: remove Built With Fern logo for Polytomic #367

Merged
merged 2 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
);
};