-
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.
- Loading branch information
1 parent
3da2368
commit bf35e6a
Showing
50 changed files
with
653 additions
and
271 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { PLATFORM } from "@fern-api/ui-core-utils"; | ||
import { useEffect, useState } from "react"; | ||
|
||
// this is updated by the browser | ||
let globalPlatform: typeof PLATFORM | undefined; | ||
|
||
/** | ||
* Returns the platform that the app is running on. | ||
* | ||
* This is useful for conditional rendering of platform-specific components. | ||
*/ | ||
export function usePlatform(): typeof PLATFORM | undefined { | ||
const [platform, setPlatform] = useState(() => globalPlatform); | ||
|
||
// upon mount, update the global platform | ||
useEffect(() => { | ||
globalPlatform = PLATFORM; | ||
setPlatform(PLATFORM); | ||
}, []); | ||
|
||
return platform; | ||
} | ||
|
||
export function usePlatformKbdShortcut(): string | undefined { | ||
const platform = usePlatform(); | ||
if (platform === undefined) { | ||
return undefined; | ||
} | ||
return platform === "mac" ? "⌘" : "Ctrl"; | ||
} |
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
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 was deleted.
Oops, something went wrong.
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,72 @@ | ||
@import "./variants.scss"; | ||
|
||
@layer components { | ||
.fern-docs-badge { | ||
align-items: center; | ||
display: inline-flex; | ||
gap: 0.25rem; | ||
justify-content: center; | ||
line-height: 1rem; | ||
box-sizing: border-box; | ||
font-weight: 600; | ||
|
||
white-space: nowrap; | ||
|
||
&.interactive:not(:disabled):hover, | ||
&[data-state="open"]:not(:disabled) { | ||
cursor: pointer; | ||
transition: background-color 150ms ease-in-out; | ||
} | ||
|
||
&:disabled { | ||
opacity: 0.5; | ||
cursor: not-allowed; | ||
} | ||
|
||
&.rounded { | ||
border-radius: 9999px !important; | ||
} | ||
|
||
&.small { | ||
border-radius: 0.25rem; | ||
font-size: 0.75rem; | ||
height: 1rem; | ||
padding: 0 0.375rem; | ||
} | ||
|
||
&.large { | ||
border-radius: calc(0.5rem - 2px); | ||
font-size: 0.875rem; | ||
height: 1.5rem; | ||
padding: 0.25rem 0.5rem; | ||
} | ||
|
||
&[data-badge-type="http-method"], | ||
&[data-badge-type="status-code"] { | ||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", | ||
monospace !important; | ||
font-variant-numeric: slashed-zero; | ||
text-transform: uppercase; | ||
font-weight: 700; | ||
} | ||
|
||
&.small[data-http-method="PATCH"], | ||
&.small[data-http-method="TRACE"] { | ||
letter-spacing: -0.025em; | ||
} | ||
|
||
&[data-badge-type="http-method"].small { | ||
font-size: 0.625rem; | ||
width: 2.25rem; | ||
} | ||
|
||
&[data-badge-type="http-method"].large { | ||
font-size: 0.75rem; | ||
} | ||
|
||
& > svg { | ||
width: 1.25em; | ||
height: 1.25em; | ||
} | ||
} | ||
} |
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,6 @@ | ||
import { clsx, type ClassValue } from "clsx"; | ||
import { twMerge } from "tailwind-merge"; | ||
|
||
export function cn(...inputs: ClassValue[]): string { | ||
return twMerge(clsx(inputs)); | ||
} |
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 |
---|---|---|
|
@@ -12,3 +12,4 @@ | |
@import "./FernTag"; | ||
@import "./FernHighlight"; | ||
@import "./badges/index.scss"; | ||
@import "./kbd.scss"; |
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,13 @@ | ||
@layer base { | ||
kbd { | ||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important; | ||
font-variant-numeric: slashed-zero; | ||
font-weight: 700; | ||
} | ||
} | ||
|
||
@layer components { | ||
.fern-kbd { | ||
@apply bg-[var(--grayscale-a3)] text-[var(--grayscale-a10)] rounded px-1 py-0.5 text-xs; | ||
} | ||
} |
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.