Skip to content

Commit 8bc40e5

Browse files
committed
only show 200 fonts for speed
1 parent f7616a8 commit 8bc40e5

File tree

4 files changed

+7
-14
lines changed

4 files changed

+7
-14
lines changed

packages/app/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272
"@codesandbox/executors": "^0.1.0",
7373
"@codesandbox/template-icons": "^1.0.1",
7474
"@emmetio/codemirror-plugin": "^0.3.5",
75-
"@samuelmeuli/font-manager": "^1.2.0",
7675
"@sentry/webpack-plugin": "^1.8.0",
7776
"@styled-system/css": "^5.0.23",
7877
"@svgr/core": "^2.4.1",

packages/app/src/app/pages/Sandbox/Editor/Workspace/Dependencies/AddFont/FontPicker/List.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@ export const FontList: FunctionComponent<Props> = ({
1212
activeFontFamily,
1313
}) => {
1414
const [searchTerm, setSearchTerm] = useState('');
15+
const usedFonts = fonts.slice(0, 200);
1516

1617
const updateSearch = (e: any) => setSearchTerm(e.target.value);
1718

1819
const getFonts: string[] = useMemo(
1920
() =>
20-
fonts.filter(f =>
21+
usedFonts.filter(f =>
2122
f.toLowerCase().includes(searchTerm.trim().toLowerCase())
2223
),
23-
[searchTerm]
24+
[searchTerm, usedFonts]
2425
);
2526
return (
2627
<>

packages/app/src/app/pages/Sandbox/Editor/Workspace/Dependencies/AddFont/FontPicker/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ export const FontPicker = ({ activeFontFamily = 'Open Sans', onChange }) => {
3030
>
3131
{activeFontFamily}
3232
</SelectedFont>
33-
{expanded && (
34-
<Portal>
33+
<Portal>
34+
{expanded && (
3535
<div
3636
style={{
3737
position: 'fixed',
@@ -50,8 +50,8 @@ export const FontPicker = ({ activeFontFamily = 'Open Sans', onChange }) => {
5050
/>
5151
</OutsideClickHandler>
5252
</div>
53-
</Portal>
54-
)}
53+
)}
54+
</Portal>
5555
</>
5656
);
5757
};

yarn.lock

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3079,13 +3079,6 @@
30793079
react-lifecycles-compat "^3.0.4"
30803080
warning "^3.0.0"
30813081

3082-
"@samuelmeuli/font-manager@^1.2.0":
3083-
version "1.2.0"
3084-
resolved "https://registry.yarnpkg.com/@samuelmeuli/font-manager/-/font-manager-1.2.0.tgz#ec9ec3dab4cbbd56ce2f579f332bbd7e3aa26894"
3085-
integrity sha512-ChNcTdVDL0OjXAMQYi8R9ScXvVZ3p32/4MupKbGksGtF1xPKKTM6vEo74XCBo7LEPQ+Eb+BiS9yD4B0Oo4/LQw==
3086-
dependencies:
3087-
"@babel/runtime" "^7.5.5"
3088-
30893082
"@samverschueren/stream-to-observable@^0.3.0":
30903083
version "0.3.0"
30913084
resolved "https://registry.yarnpkg.com/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.0.tgz#ecdf48d532c58ea477acfcab80348424f8d0662f"

0 commit comments

Comments
 (0)