refactor(website): font loading and reduce cls

This commit is contained in:
iCrawl
2023-03-25 13:44:35 +01:00
parent d6f4e60efd
commit ad31edc7aa
28 changed files with 100 additions and 62 deletions

View File

@@ -13,7 +13,12 @@ export default function Footer() {
target="_blank"
title="Vercel"
>
<Image alt="Vercel" src={vercelLogo} />
<Image
alt="Vercel"
blurDataURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAABLCAQAAAA1k5H2AAAAi0lEQVR42u3SMQEAAAgDoC251a3gL2SgmfBYBRAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARAAARCAgwWEOSWBnYbKggAAAABJRU5ErkJggg=="
placeholder="blur"
src={vercelLogo}
/>
</a>
<div className="flex flex-row gap-6 md:gap-12">
<div className="flex flex-col gap-2">

View File

@@ -2,7 +2,7 @@
import { VscChevronDown } from '@react-icons/all-files/vsc/VscChevronDown';
import { VscVersions } from '@react-icons/all-files/vsc/VscVersions';
import { Menu, MenuButton, MenuItem, useMenuState } from 'ariakit';
import { Menu, MenuButton, MenuItem, useMenuState } from 'ariakit/menu';
import type { PropsWithChildren, ReactNode } from 'react';
import { useState } from 'react';

View File

@@ -1,3 +1,5 @@
'use client';
import { VscChevronDown } from '@react-icons/all-files/vsc/VscChevronDown';
import { VscVersions } from '@react-icons/all-files/vsc/VscVersions';
import { Menu, MenuButton, MenuItem, useMenuState } from 'ariakit/menu';

View File

@@ -1,9 +1,9 @@
import type { ApiConstructor } from '@microsoft/api-extractor-model';
import { VscSymbolMethod } from '@react-icons/all-files/vsc/VscSymbolMethod';
import { useCallback } from 'react';
import { ParameterTable } from '../../ParameterTable';
import { TSDoc } from '../tsdoc/TSDoc';
import { DocumentationSection } from './DocumentationSection';
import { ParameterTable } from '~/components/ParameterTable';
export function ConstructorSection({ item }: { item: ApiConstructor }) {
const getShorthandName = useCallback(

View File

@@ -8,8 +8,8 @@ import type {
import { ApiItemKind } from '@microsoft/api-extractor-model';
import { VscSymbolMethod } from '@react-icons/all-files/vsc/VscSymbolMethod';
import { useMemo, Fragment } from 'react';
import { Method } from '../../model/method/Method';
import { DocumentationSection } from './DocumentationSection';
import { Method } from '~/components/model/method/Method';
import { resolveMembers } from '~/util/members';
function isMethodLike(item: ApiItem): item is ApiMethod | ApiMethodSignature {

View File

@@ -1,7 +1,7 @@
import type { ApiParameterListMixin } from '@microsoft/api-extractor-model';
import { VscSymbolParameter } from '@react-icons/all-files/vsc/VscSymbolParameter';
import { ParameterTable } from '../../ParameterTable';
import { DocumentationSection } from './DocumentationSection';
import { ParameterTable } from '~/components/ParameterTable';
export function ParameterSection({ item }: { item: ApiParameterListMixin }) {
return (

View File

@@ -1,7 +1,7 @@
import type { ApiItemContainerMixin } from '@microsoft/api-extractor-model';
import { VscSymbolProperty } from '@react-icons/all-files/vsc/VscSymbolProperty';
import { PropertyList } from '../../PropertyList';
import { DocumentationSection } from './DocumentationSection';
import { PropertyList } from '~/components/PropertyList';
export function PropertiesSection({ item }: { item: ApiItemContainerMixin }) {
return (

View File

@@ -1,7 +1,7 @@
import type { ApiTypeParameterListMixin } from '@microsoft/api-extractor-model';
import { VscSymbolParameter } from '@react-icons/all-files/vsc/VscSymbolParameter';
import { TypeParamTable } from '../../TypeParamTable';
import { DocumentationSection } from './DocumentationSection';
import { TypeParamTable } from '~/components/TypeParamTable';
export function TypeParameterSection({ item }: { item: ApiTypeParameterListMixin }) {
return (

View File

@@ -3,10 +3,10 @@ import type { DocComment, DocFencedCode, DocLinkTag, DocNode, DocNodeContainer,
import { DocNodeKind, StandardTags } from '@microsoft/tsdoc';
import Link from 'next/link';
import { Fragment, useCallback, type ReactNode } from 'react';
import { ItemLink } from '../../ItemLink';
import { SyntaxHighlighter } from '../../SyntaxHighlighter';
import { resolveItemURI } from '../util';
import { DeprecatedBlock, ExampleBlock, RemarksBlock, SeeBlock } from './BlockComment';
import { ItemLink } from '~/components/ItemLink';
export function TSDoc({ item, tsdoc }: { item: ApiItem; tsdoc: DocNode }): JSX.Element {
const createNode = useCallback(

View File

@@ -1,11 +1,11 @@
import type { ApiEnum } from '@microsoft/api-extractor-model';
import { VscSymbolEnum } from '@react-icons/all-files/vsc/VscSymbolEnum';
import { Panel } from '../../Panel';
import { Documentation } from '../../documentation/Documentation';
import { ObjectHeader } from '../../documentation/ObjectHeader';
import { DocumentationSection } from '../../documentation/section/DocumentationSection';
import { SummarySection } from '../../documentation/section/SummarySection';
import { EnumMember } from './EnumMember';
import { Panel } from '~/components/Panel';
import { ObjectHeader } from '~/components/documentation/ObjectHeader';
import { DocumentationSection } from '~/components/documentation/section/DocumentationSection';
import { SummarySection } from '~/components/documentation/section/SummarySection';
export function Enum({ item }: { item: ApiEnum }) {
return (

View File

@@ -1,8 +1,8 @@
import type { ApiEnumMember } from '@microsoft/api-extractor-model';
import { Anchor } from '~/components/Anchor';
import { NameText } from '~/components/NameText';
import { SignatureText } from '~/components/SignatureText';
import { TSDoc } from '~/components/documentation/tsdoc/TSDoc';
import { Anchor } from '../../Anchor';
import { NameText } from '../../NameText';
import { SignatureText } from '../../SignatureText';
import { TSDoc } from '../../documentation/tsdoc/TSDoc';
export function EnumMember({ member }: { member: ApiEnumMember }) {
return (

View File

@@ -1,7 +1,7 @@
import type { ApiFunction } from '@microsoft/api-extractor-model';
import dynamic from 'next/dynamic';
import { Header } from '../../documentation/Header';
import { FunctionBody } from './FunctionBody';
import { Header } from '~/components/documentation/Header';
const OverloadSwitcher = dynamic(async () => import('../../OverloadSwitcher'));

View File

@@ -1,9 +1,9 @@
import type { ApiFunction } from '@microsoft/api-extractor-model';
import { SyntaxHighlighter } from '~/components/SyntaxHighlighter';
import { Documentation } from '~/components/documentation/Documentation';
import { ParameterSection } from '~/components/documentation/section/ParametersSection';
import { SummarySection } from '~/components/documentation/section/SummarySection';
import { TypeParameterSection } from '~/components/documentation/section/TypeParametersSection';
import { SyntaxHighlighter } from '../../SyntaxHighlighter';
import { Documentation } from '../../documentation/Documentation';
import { ParameterSection } from '../../documentation/section/ParametersSection';
import { SummarySection } from '../../documentation/section/SummarySection';
import { TypeParameterSection } from '../../documentation/section/TypeParametersSection';
export interface FunctionBodyProps {
mergedSiblingCount: number;

View File

@@ -4,18 +4,16 @@ import type {
ApiMethod,
ApiMethodSignature,
} from '@microsoft/api-extractor-model';
import type { DocSection } from '@microsoft/tsdoc';
import { InheritanceText } from '~/components/InheritanceText';
import { ParameterTable } from '~/components/ParameterTable';
import { TSDoc } from '~/components/documentation/tsdoc/TSDoc';
import { InheritanceText } from '../../InheritanceText';
import { ParameterTable } from '../../ParameterTable';
import { TSDoc } from '../../documentation/tsdoc/TSDoc';
export interface MethodDocumentationProps {
fallbackSummary?: DocSection;
inheritedFrom?: (ApiDeclaredItem & ApiItemContainerMixin) | undefined;
method: ApiMethod | ApiMethodSignature;
}
export function MethodDocumentation({ method, fallbackSummary, inheritedFrom }: MethodDocumentationProps) {
export function MethodDocumentation({ method, inheritedFrom }: MethodDocumentationProps) {
const parent = method.parent as ApiDeclaredItem;
if (!(method.tsdocComment?.summarySection || method.parameters.length > 0)) {