Skip to content

Commit

Permalink
[Refactor] 소개페이지 상단 배너 로딩 속도 개선 (#428)
Browse files Browse the repository at this point in the history
* feat: ISR도입, revalidate 간격 120초

* fix: div background image를 next/image로 수정

* Update ci.yml
  • Loading branch information
lydiacho authored Sep 16, 2024
1 parent 21743f1 commit 00882b6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 16.x
uses: actions/setup-node@v1
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: '18'

- name: Install pnpm
run: npm install -g [email protected]
Expand Down
1 change: 1 addition & 0 deletions src/pages/about.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const getStaticProps = async () => {
aboutInfo,
memberInfo,
},
revalidate: 120,
};
};

Expand Down
15 changes: 14 additions & 1 deletion src/views/AboutPage/components/Banner/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Image from 'next/image';
import * as S from './style';

interface BannerProps {
Expand All @@ -8,7 +9,19 @@ interface BannerProps {
const Banner = (props: BannerProps) => {
const { imageSrc } = props;

return <S.Banner src={imageSrc}></S.Banner>;
return (
<S.Banner>
<Image
src={imageSrc}
alt="SOPT banner"
fill
style={{
objectFit: 'cover',
objectPosition: 'center',
}}
/>
</S.Banner>
);
};

export default Banner;
5 changes: 3 additions & 2 deletions src/views/AboutPage/components/Banner/style.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import styled from '@emotion/styled';

export const Banner = styled.div<{ src: string }>`
export const Banner = styled.div`
width: 100vw;
max-height: 630px;
height: calc(376px + 13vw);
background: center / cover no-repeat url(${({ src }) => src});
position: relative;
overflow: hidden;
/* 태블릿 뷰 */
@media (max-width: 48rem) {
Expand Down

0 comments on commit 00882b6

Please sign in to comment.