diff --git a/website/pages/[...listPathPage].tsx b/website/pages/[...listPathPage].tsx index 0290f575f..41fe42458 100644 --- a/website/pages/[...listPathPage].tsx +++ b/website/pages/[...listPathPage].tsx @@ -122,10 +122,11 @@ export const getStaticProps: GetStaticProps = async ( const next = section === 'usage' - ? sidebarUsageFlat.find( - (item, index) => - index > 0 && sidebarUsageFlat[index - 1].url === slug && item[0] === '/' - ) + ? sidebarUsageFlat.find((item, index) => { + return ( + index > 0 && sidebarUsageFlat[index - 1].url === slug && item.url[0] === '/' + ) + }) : undefined return { diff --git a/website/pages/index.tsx b/website/pages/index.tsx index dba1868c3..170bca137 100644 --- a/website/pages/index.tsx +++ b/website/pages/index.tsx @@ -29,6 +29,7 @@ import tailoredPipelinesImage from '../public/images/spacy-tailored-pipelines_wi import { nightly, legacy } from '../meta/dynamicMeta.mjs' import Benchmarks from '../docs/usage/_benchmarks-models.mdx' +import { ImageFill } from '../src/components/embed' function getCodeExample(nightly) { return `# pip install -U ${nightly ? 'spacy-nightly --pre' : 'spacy'} @@ -113,7 +114,10 @@ const Landing = () => { >

- spaCy Tailored Pipelines +

@@ -159,9 +163,8 @@ const Landing = () => { >

- {/** Update image */} - Prodigy: Radically efficient machine teaching @@ -203,7 +206,7 @@ const Landing = () => { - +

@@ -259,8 +262,8 @@ const Landing = () => { >

- Advanced NLP with spaCy: A free online course diff --git a/website/src/components/card.js b/website/src/components/card.js index 852349f24..9eb597b7b 100644 --- a/website/src/components/card.js +++ b/website/src/components/card.js @@ -18,6 +18,7 @@ export default function Card({ title, to, image, header, small, onClick, childre

{image && (
+ {/* eslint-disable-next-line @next/next/no-img-element */}
)} diff --git a/website/src/components/embed.js b/website/src/components/embed.js index 15587ff95..53f4e9184 100644 --- a/website/src/components/embed.js +++ b/website/src/components/embed.js @@ -1,6 +1,7 @@ import React, { Fragment } from 'react' import PropTypes from 'prop-types' import classNames from 'classnames' +import ImageNext from 'next/image' import Link from './link' import Button from './button' @@ -88,6 +89,7 @@ const Image = ({ src, alt, title, href, ...props }) => { return (
+ {/* eslint-disable-next-line @next/next/no-img-element */} {alt} {title && ( @@ -99,6 +101,17 @@ const Image = ({ src, alt, title, href, ...props }) => { ) } +const ImageFill = ({ image, ...props }) => { + return ( + + + + ) +} + const GoogleSheet = ({ id, link, height, button = 'View full table' }) => { return (
@@ -118,4 +131,4 @@ const GoogleSheet = ({ id, link, height, button = 'View full table' }) => { ) } -export { YouTube, SoundCloud, Iframe, Image, GoogleSheet } +export { YouTube, SoundCloud, Iframe, Image, ImageFill, GoogleSheet } diff --git a/website/src/components/title.js b/website/src/components/title.js index 3200bea90..0aab4b5ba 100644 --- a/website/src/components/title.js +++ b/website/src/components/title.js @@ -10,6 +10,7 @@ import { H1, Label, InlineList, Help } from './typography' import Icon from './icon' import classes from '../styles/title.module.sass' +import Image from 'next/image' const MetaItem = ({ label, url, children, help }) => ( @@ -50,6 +51,7 @@ export default function Title({ {image && (
+ {/* eslint-disable-next-line @next/next/no-img-element */}
)} diff --git a/website/src/styles/embed.module.sass b/website/src/styles/embed.module.sass index fdb740951..82b7408ca 100644 --- a/website/src/styles/embed.module.sass +++ b/website/src/styles/embed.module.sass @@ -32,6 +32,13 @@ max-width: 100% margin: 0 auto +.figure-fill + display: block + position: relative + width: 100% + img + object-fit: contain + .image-link display: block diff --git a/website/src/templates/universe.js b/website/src/templates/universe.js index 719928dba..fcd433823 100644 --- a/website/src/templates/universe.js +++ b/website/src/templates/universe.js @@ -20,6 +20,7 @@ import { github, MarkdownToReact } from '../components/util' import { nightly, legacy } from '../../meta/dynamicMeta.mjs' import universe from '../../meta/universe.json' +import Image from 'next/image' function filterResources(resources, data) { const sorted = resources.sort((a, b) => a.id.localeCompare(b.id)) @@ -80,6 +81,7 @@ const UniverseContent = ({ content = [], categories, theme, pageContext, mdxComp } const url = `/universe/project/${id}` const header = youtube && ( + // eslint-disable-next-line @next/next/no-img-element + {/* eslint-disable-next-line @next/next/no-img-element */} {title

@@ -205,6 +208,7 @@ const Project = ({ data, components }) => ( `license/${data.github}.svg?style=flat-square`, `stars/${data.github}.svg?style=social&label=Stars`, ].map((url, i) => ( + // eslint-disable-next-line @next/next/no-img-element ( {data.cover && (

+ {/* eslint-disable-next-line @next/next/no-img-element */} {data.title}

)} @@ -266,6 +271,7 @@ const Project = ({ data, components }) => ( {data.image && (

+ {/* eslint-disable-next-line @next/next/no-img-element */}

)}