Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
Re-add getImage calls
Browse files Browse the repository at this point in the history
  • Loading branch information
jcxldn committed Oct 11, 2023
1 parent 7582086 commit 0672301
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/components/homepage/card.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from "react";
import { navigate } from "gatsby";

import { GatsbyImage } from "gatsby-plugin-image";
import { GatsbyImage, getImage, ImageDataLike } from "gatsby-plugin-image";
import {
createTheme,
Card,
Expand Down Expand Up @@ -47,6 +47,9 @@ const imageStyle = (theme: Theme) => ({
});
export default class HomepageCard extends React.Component<HomepageCardProps, {}> {
render(): React.ReactNode {
// To make TS happy, use the notNull assertion for dynamicImage as well as getImage's return value.
// Also cast dynamicImage to ImageDataLike (mismatched so must cast to unknown first.)
const image = getImage(this.props.card.dynamicImage! as unknown as ImageDataLike)!;
return (
<>
<ThemeProvider theme={theme}>
Expand Down
5 changes: 4 additions & 1 deletion src/components/team/creditEntry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import Grid from "@mui/material/Unstable_Grid2/Grid2";

import HtmlReactParser from "html-react-parser";

import { GatsbyImage } from "gatsby-plugin-image";
import { GatsbyImage, getImage, ImageDataLike } from "gatsby-plugin-image";

type CreditEntryArgs = {
member: TeamMemberNode;
Expand Down Expand Up @@ -55,6 +55,9 @@ export class CreditEntry extends React.Component<CreditEntryArgs, CreditEntrySta
};
image.src = this.assetBasePath + this.props.member.picturePath;
}
// To make TS happy, use the notNull assertion for dynamicImage as well as getImage's return value.
// Also cast dynamicImage to ImageDataLike (mismatched so must cast to unknown first.)
const image = getImage(this.props.member.dynamicImage! as unknown as ImageDataLike)!;
return (
<div style={{ padding: 16 }}>
<Card raised>
Expand Down

0 comments on commit 0672301

Please sign in to comment.