Skip to content

Commit

Permalink
chore: create image component to avoid img domain erros
Browse files Browse the repository at this point in the history
  • Loading branch information
luizmuraro committed Oct 2, 2024
1 parent 517f5fb commit e319502
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 10 deletions.
8 changes: 1 addition & 7 deletions apps/govquests-frontend/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/** @type {import('next').NextConfig} */
// TODO: DOMAIN JUST FOR TESTING, SHOUDL BE REMOVED OP-298
const nextConfig = {
reactStrictMode: true,
images: {
domains: ["file.coinexstatic.com"],
},
};
const nextConfig = {};
export default nextConfig;
2 changes: 1 addition & 1 deletion apps/govquests-frontend/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function RootLayout({
return (
<html lang="en">
<body>
{/* MOCKED HEADER AND SIDE BAR */}
{/* MOCKED HEADER AND SIDE BAR, SHOUDL BE REMOVED: OP-299 & OP-300 */}
<header className="h-16 bg-red-500 flex-1">
<div />
</header>
Expand Down
29 changes: 29 additions & 0 deletions apps/govquests-frontend/src/components/Image.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import type React from "react";

interface ImageProps {
src: string;
alt: string;
width?: number;
height?: number;
className?: string;
}

const Image: React.FC<ImageProps> = ({
src,
alt,
width,
height,
className,
}) => {
return (
<img
src={src}
alt={alt}
width={width}
height={height}
className={className}
/>
);
};

export default Image;
8 changes: 6 additions & 2 deletions apps/govquests-frontend/src/components/Quest.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Reward } from "@/types/quest";
import Image from "next/image";
import Link from "next/link";
import type React from "react";
import Image from "./Image";

interface QuestProps {
id: string;
Expand All @@ -23,7 +23,11 @@ const Quest: React.FC<QuestProps> = ({
return (
<div className="flex flex-col bg-red-300 rounded-lg">
<div className="relative w-full border border-black h-36">
<Image src={imageSrc} alt={altText} layout="fill" objectFit="cover" />
<Image
src={imageSrc}
alt={altText}
className="object-cover w-full h-full"
/>
</div>
<div className="flex flex-col p-4">
<h3>{title}</h3>
Expand Down

0 comments on commit e319502

Please sign in to comment.