-
+ {multiline ? (
+
+ ) : (
+
+ )}
= ({
)
}
-
-export default FormControl
diff --git a/website/src/components/TextField.tsx b/website/src/components/TextField.tsx
index 5d4121099..15a353224 100644
--- a/website/src/components/TextField.tsx
+++ b/website/src/components/TextField.tsx
@@ -1,55 +1,21 @@
import { clsx } from 'clsx'
-import { forwardRef } from 'react'
-import TextareaAutosize from 'react-textarea-autosize'
import styles from './TextField.module.css'
-import type { HTMLAttributes, Ref } from 'react'
+import type { ComponentProps } from 'react'
-type Props = {
- block?: boolean
- disabled?: boolean
- multiline?: boolean
- type?: string
-} & Omit<
- HTMLAttributes,
- 'height' | 'style'
->
-
-const TextField = forwardRef(
- function TextField(
+export default function TextField({
+ block = false,
+ className: additionalClassName,
+ ref,
+ type = 'text',
+ ...props
+}: Readonly<{ block?: boolean } & ComponentProps<'input'>>) {
+ const className = clsx(
+ styles.root,
{
- block = false,
- className: additionalClassName,
- multiline = false,
- type = 'text',
- ...props
+ [styles.block]: block
},
- ref
- ) {
- const className = clsx(
- styles.root,
- {
- [styles.multiline]: multiline,
- [styles.block]: block
- },
- additionalClassName
- )
-
- return multiline ? (
- }
- {...props}
- />
- ) : (
- }
- type={type}
- {...props}
- />
- )
- }
-)
+ additionalClassName
+ )
-export default TextField
+ return
+}
diff --git a/website/src/data/products.ts b/website/src/data/products.ts
index 528133703..1ca1bf4a7 100644
--- a/website/src/data/products.ts
+++ b/website/src/data/products.ts
@@ -1,4 +1,4 @@
-/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment */
+/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-require-imports, @typescript-eslint/no-unsafe-assignment */
type Product = {
description: string
diff --git a/website/src/pages/contact/index.tsx b/website/src/pages/contact/index.tsx
index 90a5a9e04..46a945400 100644
--- a/website/src/pages/contact/index.tsx
+++ b/website/src/pages/contact/index.tsx
@@ -2,9 +2,8 @@ import Layout from '@theme/Layout'
import { FormProvider, useForm } from 'react-hook-form'
import ContactForm from '@site/src/components/ContactForm'
import type { FormData } from '@site/src/components/ContactForm'
-import type { VFC } from 'react'
-const Contact: VFC = () => {
+export default function Contact() {
const methods = useForm({
mode: 'onBlur',
reValidateMode: 'onChange',
@@ -21,5 +20,3 @@ const Contact: VFC = () => {
)
}
-
-export default Contact
diff --git a/website/src/pages/index.tsx b/website/src/pages/index.tsx
index 68fce890f..46bf40b66 100755
--- a/website/src/pages/index.tsx
+++ b/website/src/pages/index.tsx
@@ -5,16 +5,14 @@ import Image from '@theme/IdealImage'
import Layout from '@theme/Layout'
import chunk from 'lodash/chunk'
import products from '../data/products'
-import type { VFC } from 'react'
-const Home: VFC = () => {
+export default function Home() {
const { siteConfig } = useDocusaurusContext()
const { withBaseUrl } = useBaseUrlUtils()
return (
@@ -78,5 +76,3 @@ const Home: VFC = () => {
)
}
-
-export default Home
diff --git a/website/src/theme/IdealImage/index.tsx b/website/src/theme/IdealImage/index.tsx
new file mode 100644
index 000000000..4119cd89a
--- /dev/null
+++ b/website/src/theme/IdealImage/index.tsx
@@ -0,0 +1,115 @@
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+/* eslint-disable */
+// @ts-nocheck
+// copy from https://github.com/facebook/docusaurus/blob/06781f024ec70c53c5467f691250a7f3584a5b48/packages/docusaurus-plugin-ideal-image/src/theme/IdealImage/index.tsx
+
+import { translate } from '@docusaurus/Translate'
+import ReactIdealImage, {
+ type IconKey,
+ type State
+} from '@slorber/react-ideal-image'
+import React, { type ReactNode } from 'react'
+import type { Props } from '@theme/IdealImage'
+
+// Adopted from https://github.com/endiliey/react-ideal-image/blob/master/src/components/helpers.js#L59-L65
+function bytesToSize(bytes: number) {
+ const sizes = ['B', 'KB', 'MB', 'GB', 'TB']
+ if (bytes === 0) {
+ return 'n/a'
+ }
+ const scale = Math.floor(Math.log(bytes) / Math.log(1024))
+ if (scale === 0) {
+ return `${bytes} ${sizes[scale]}`
+ }
+ return `${(bytes / 1024 ** scale).toFixed(1)} ${sizes[scale]}`
+}
+
+// Adopted from https://github.com/endiliey/react-ideal-image/blob/master/src/components/IdealImage/index.js#L43-L75
+function getMessage(icon: IconKey, state: State) {
+ switch (icon) {
+ case 'noicon':
+ case 'loaded':
+ return null
+ case 'loading':
+ return translate({
+ id: 'theme.IdealImageMessage.loading',
+ message: 'Loading...',
+ description: 'When the full-scale image is loading'
+ })
+ case 'load': {
+ // We can show `alt` here
+ const { pickedSrc } = state
+ const { size } = pickedSrc
+ const sizeMessage = size ? ` (${bytesToSize(size)})` : ''
+ return translate(
+ {
+ id: 'theme.IdealImageMessage.load',
+ message: 'Click to load{sizeMessage}',
+ description:
+ 'To prompt users to load the full image. sizeMessage is a parenthesized size figure.'
+ },
+ { sizeMessage }
+ )
+ }
+ case 'offline':
+ return translate({
+ id: 'theme.IdealImageMessage.offline',
+ message: 'Your browser is offline. Image not loaded',
+ description: 'When the user is viewing an offline document'
+ })
+ case 'error': {
+ const { loadInfo } = state
+ if (loadInfo === 404) {
+ return translate({
+ id: 'theme.IdealImageMessage.404error',
+ message: '404. Image not found',
+ description: 'When the image is not found'
+ })
+ }
+ return translate({
+ id: 'theme.IdealImageMessage.error',
+ message: 'Error. Click to reload',
+ description: 'When the image fails to load for unknown error'
+ })
+ }
+ default:
+ throw new Error(`Wrong icon: ${icon}`)
+ }
+}
+
+export default function IdealImage(props: Props): ReactNode {
+ const { img, ...propsRest } = props
+
+ // In dev env just use regular img with original file
+ if (typeof img === 'string' || 'default' in img) {
+ return (
+ // eslint-disable-next-line jsx-a11y/alt-text
+
+ )
+ }
+
+ return (
+ = 19 not applying defaultProps
+ icons={ReactIdealImage.defaultProps.icons}
+ // @ts-expect-error: quick fix for React >= 19 not applying defaultProps
+ theme={ReactIdealImage.defaultProps.theme}
+ {...propsRest}
+ getMessage={getMessage}
+ height={img.src.height ?? 100}
+ placeholder={{ lqip: img.preSrc }}
+ src={img.src.src}
+ srcSet={img.src.images.map((image) => ({
+ ...image,
+ src: image.path
+ }))}
+ width={img.src.width ?? 100}
+ />
+ )
+}
diff --git a/website/src/theme/Root/index.tsx b/website/src/theme/Root/index.tsx
index f9bd5a2ca..77682182c 100644
--- a/website/src/theme/Root/index.tsx
+++ b/website/src/theme/Root/index.tsx
@@ -1,16 +1,14 @@
import { FormspreeProvider } from '@formspree/react'
-import type { ReactNode, VFC } from 'react'
+import type { ReactNode } from 'react'
-type Props = {
+export default function Root({
+ children
+}: Readonly<{
children: ReactNode
-}
-
-const Root: VFC = ({ children }) => {
+}>) {
return (
{children}
)
}
-
-export default Root
diff --git a/website/vercel.json b/website/vercel.json
index 8589e02df..2be705a72 100644
--- a/website/vercel.json
+++ b/website/vercel.json
@@ -12,13 +12,9 @@
"destination": "/docs/shinju-date",
"source": "/docs/animare-search"
},
- {
- "destination": "/docs/21g",
- "source": "/docs/graph"
- },
{
"destination": "/",
- "source": "/(products|docs)/(npm-packages|eslint-config|prettier-config|renovate-config)(.html)?"
+ "source": "/(products|docs)/(21g|npm-packages|eslint-config|prettier-config|renovate-config)(.html)?"
},
{
"destination": "/docs/:name",