Skip to content

Commit

Permalink
lighthouse ranking improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-SKR committed Oct 9, 2022
1 parent c6d91f1 commit fb7dec5
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
25 changes: 19 additions & 6 deletions components/cards/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
CardContent,
Card,
} from "@mui/material";
import Image from "next/image";

interface FoodCardProps {
videoId: string;
Expand All @@ -19,6 +20,7 @@ interface FoodCardProps {
displacement: number;
hasVeg: boolean;
useLocation: boolean;
index: number;
setUseLocation: React.Dispatch<React.SetStateAction<boolean>>;
}

Expand All @@ -30,12 +32,23 @@ export default function FoodCard(props: FoodCardProps): JSX.Element {
sx={{ textAlign: "center", marginBottom: "0.5rem" }}
>
<CardActionArea href={`/fldb/${props.videoId}`}>
<CardMedia
component="img"
height={props.height}
image={props.thumbnail}
alt={props.title ? props.title : "No image found"}
/>
<CardMedia>
<div
style={{
position: "relative",
width: "100%",
height: props.height,
}}
>
<Image
src={props.thumbnail}
alt={props.title ? props.title : "No image found"}
layout="fill"
objectFit="cover"
priority={props.index < 3 ? true : false}
/>
</div>
</CardMedia>
<CardContent>
<Typography gutterBottom variant="h6" component="div">
{props.title ? props.title : "No title"}
Expand Down
3 changes: 3 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
module.exports = {
reactStrictMode: true,
images: {
domains: ["i.ytimg.com"],
},
};
5 changes: 3 additions & 2 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ function Home(props: HomeProps): JSX.Element {
<Accordion expanded sx={{ mb: "1rem" }}>
<AccordionSummary
expandIcon={<TuneIcon />}
aria-controls="filters"
aria-controls="filter-controls"
id="filters"
>
<Typography
Expand Down Expand Up @@ -406,7 +406,7 @@ function Home(props: HomeProps): JSX.Element {
</Accordion>
{currentVideos.length ? (
currentPageVideos.reduce(
(oldRecord: JSX.Element[], newRecord) => {
(oldRecord: JSX.Element[], newRecord, currentIndex) => {
if (newRecord.name) {
oldRecord.push(
<FoodCard
Expand All @@ -424,6 +424,7 @@ function Home(props: HomeProps): JSX.Element {
}
useLocation={useLocation}
setUseLocation={setUseLocation}
index={currentIndex}
/>
);
}
Expand Down
2 changes: 1 addition & 1 deletion public/robots.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
User-agent: *
Sitemap: /sitemap.xml
Sitemap: https://foodloversdatabase.com/sitemap.xml
Disallow:

1 comment on commit fb7dec5

@vercel
Copy link

@vercel vercel bot commented on fb7dec5 Oct 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.