Skip to content

Commit

Permalink
improvement: move fontawesome to cdn (#422)
Browse files Browse the repository at this point in the history
  • Loading branch information
abvthecity authored Feb 1, 2024
1 parent 80f1895 commit 9bf4502
Show file tree
Hide file tree
Showing 29 changed files with 417 additions and 122 deletions.
1 change: 1 addition & 0 deletions .github/workflows/development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ env:
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_SEARCH_INDEX: ${{ secrets. ALGOLIA_SEARCH_INDEX }}
FONTAWESOME_CDN_HOST: https://fontawesome-cdn.vercel.app
on:
push:
branches:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ env:
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_SEARCH_INDEX: ${{ secrets. ALGOLIA_SEARCH_INDEX }}
FONTAWESOME_CDN_HOST: https://fontawesome-cdn.vercel.app
on:
push:
branches-ignore:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ env:
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_SEARCH_INDEX: ${{ secrets. ALGOLIA_SEARCH_INDEX }}
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
FONTAWESOME_CDN_HOST: https://fontawesome-cdn.vercel.app
on:
push:
tags:
Expand Down
112 changes: 77 additions & 35 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
8 changes: 0 additions & 8 deletions packages/ui/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@
"@fern-ui/loadable": "workspace:*",
"@fern-ui/react-commons": "workspace:*",
"@fontsource/ibm-plex-mono": "^4.5.13",
"@fortawesome/fontawesome-svg-core": "^6.5.1",
"@fortawesome/free-brands-svg-icons": "^6.5.1",
"@fortawesome/free-solid-svg-icons": "^6.5.1",
"@fortawesome/pro-duotone-svg-icons": "^6.5.1",
"@fortawesome/pro-light-svg-icons": "^6.5.1",
"@fortawesome/pro-regular-svg-icons": "^6.5.1",
"@fortawesome/pro-solid-svg-icons": "^6.5.1",
"@fortawesome/react-fontawesome": "0.2.0",
"@headlessui/react": "^1.7.18",
"@react-hook/size": "^2.1.2",
"@vercel/speed-insights": "^1.0.7",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { FontAwesomeIcon } from "../../commons/FontAwesomeIcon";
import classNames from "classnames";
import { RemoteFontAwesomeIcon } from "../../commons/FontAwesomeIcon";
import { FernMenu, FernMenuItem } from "../../components/FernMenu";
import type { CodeExampleClient, CodeExampleClientId } from "../examples//code-example";

Expand Down Expand Up @@ -31,21 +32,40 @@ export const CodeExampleClientDropdown: React.FC<CodeExampleClientDropdown.Props
<div className="flex justify-end">
<FernMenu
text={selectedClient.name}
icon={<FontAwesomeIcon className="h-4 w-4" icon={getIconForClient(selectedClient.id)} />}
icon={
<RemoteFontAwesomeIcon
className="bg-accent-primary dark:bg-accent-primary-dark h-4 w-4"
icon={getIconForClient(selectedClient.id)}
/>
}
align="right"
>
{clients.map(({ id: clientId, name: clientName }) => (
<FernMenuItem
key={clientId}
selected={clientId === selectedClient.id}
onClick={() => onClickClient(clientId)}
>
<FontAwesomeIcon className="h-4 w-4" icon={getIconForClient(clientId)} />
<div className="flex items-center whitespace-nowrap">
<span className="font-mono text-xs font-normal">{clientName}</span>
</div>
</FernMenuItem>
))}
{clients.map(({ id: clientId, name: clientName }) => {
const selected = clientId === selectedClient.id;
return (
<FernMenuItem
key={clientId}
selected={clientId === selectedClient.id}
onClick={() => onClickClient(clientId)}
>
{(active) => (
<>
<RemoteFontAwesomeIcon
className={classNames("h-4 w-4", {
"!bg-accent-primary dark:!bg-accent-primary-dark":
selected || (active && !selected),
"!bg-text-muted-light dark:!bg-text-muted-dark": !active && !selected,
})}
icon={getIconForClient(clientId)}
/>
<div className="flex items-center whitespace-nowrap">
<span className="font-mono text-xs font-normal">{clientName}</span>
</div>
</>
)}
</FernMenuItem>
);
})}
</FernMenu>
</div>
);
Expand Down
Loading

0 comments on commit 9bf4502

Please sign in to comment.