Skip to content

Commit

Permalink
Feat: card img 최적화
Browse files Browse the repository at this point in the history
  • Loading branch information
nightowlzz committed May 13, 2024
1 parent 06b13bf commit 1c79c50
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
1 change: 1 addition & 0 deletions components/common/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useRouter } from "next/router";
import { Profile } from "@/styles/commonStyle";
import LinkButton from "./atoms/LinkButton";
import Link from "next/link";
import Image from "next/image";

const logo = '/assets/logo/logo.svg';

Expand Down
2 changes: 1 addition & 1 deletion components/common/atoms/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function Input({
</Button>
)}
</Relative>
{value && <SearchResults><span>{value}</span>으로 검색한 결과입니다.</SearchResults>}
{value && <SearchResults><span>{value} </span>으로 검색한 결과입니다.</SearchResults>}
</>
);
}
Expand Down
5 changes: 3 additions & 2 deletions components/folder/PostCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import { useMemo, useState } from "react";
import Link from "next/link";
import { IFolderContent} from "@/pages/folder/interface";
import { IModal } from "../modal/interface";
import { BookMarkBtn, CardMenu, CardWrap } from "./PostCardStyle";
import { calculateTimeAgo } from "@/src/utils/calcTilmAgo";
import Modal from "../modal/Modal";
import { BookMarkBtn, CardMenu, CardWrap } from "./PostCardStyle";
import { DFlaxAlignCenterBtw, EllipsisLine } from "@/styles/commonStyle";
import Image from "next/image";

const emptyImg = '/assets/logo/logo.svg';

Expand Down Expand Up @@ -46,7 +47,7 @@ export default function PostCard({ image_source, description, created_at}: IFold
<figure>
<div className="card__image">
{image_source ? (
<img src={image_source} alt={image_source} />
<Image fill src={image_source} alt={image_source} />
) : (
<img className="empty" src={emptyImg} alt="" />
)}
Expand Down
16 changes: 6 additions & 10 deletions components/folder/PostCardStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,26 @@ export const CardWrap = styled.div`
border: 1px solid ${theme.color.primary};
.card__image {
img {
transform: scale(1.3) translate(-40%,-40%);
transform: scale(1.3)
}
}
}
}
.card {
&__image {
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 12.5rem;
overflow: hidden;
background-color: #DDDFFF;
img {
position: absolute;
left: 50%;
top: 50%;
width: 100%;
transform: translate(-50%,-50%);
object-fit: cover;
transition: transform 0.3s;
&.empty {
left: 50%;
width: 133px;
opacity:.18;
transform: translateX(-50%);
opacity: 0.5;
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
images: {
remotePatterns: [
{
protocol: 'https',
hostname: '**',
port: '',
pathname: '/**',
},
],
},
}

module.exports = nextConfig

0 comments on commit 1c79c50

Please sign in to comment.