Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 모던 자바스크립트 Deep Dive
- 프론트엔드 성능 최적화 가이드
- 커리어
- 이미지 갤러리 최적화
- middleware pattern
- 딥다이브
- peerdependencies
- Babel과 Webpack
- 자바스크립트 패턴
- package management
- 이벤트
- 스코프
- mixin pattern
- 제너레이터와 async/await
- js pattern
- js pattern
- 새 코드 받아오기
- unique identifiers
- DOM
- 브라우저의 렌더링 과정
- 올림픽 통계 서비스 최적화
- 프로그래머스
- 블로그 서비스 최적화
- version management
- 학습내용정리
- 진행기록
- 자바스크립트 딥다이브
- pr review
- 자바스크립트
- const
Archives
- Today
- Total
Dev Blog
2일차 사진 갤러리 로직 및 CSS 완료 본문
Modal.js
framer-motion 라이브러리를 이용하여 이미지가 opacity 0->1 으로 변화하고 상단에서 아래로 떨어지도록 했다.
import React from "react";
import styled from "styled-components";
import { motion } from "framer-motion";
import Chatroom from "./Chatroom";
const Modal = ({ selectedImg, setSelectedImg, user }) => {
const handleClick = (e) => {
// console.log(e.target.classList);
if (e.target.classList.contains("backdrop")) {
setSelectedImg(null);
}
};
return (
<Backdrop
className="backdrop"
onClick={handleClick}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
// transition={{ duration: 1 }}
>
<MainImg
src={selectedImg.url}
alt="enlarged img"
initial={{ y: "-100vh" }}
animate={{ y: 0 }}
/>
{user ? <Chatroom user={user} selectedImgId={selectedImg.id} /> : null}
</Backdrop>
);
};
도움 받은 사이트
motion library with react: www.framer.com/motion/
visible effect: stackoverflow.com/questions/3331353/transitions-on-the-css-display-property
Scroll effect: www.w3schools.com/howto/tryit.asp?filename=tryhow_js_scroll_to_top
Smooth scroll:
www.w3schools.com/howto/tryit.asp?filename=tryhow_css_smooth_scroll
stackoverflow.com/questions/55472649/how-to-change-scroll-behavior-e-g-speed-acceleration-on-website
사진 크롤링 다운: hogni.tistory.com/81
'Projects > JStargram' 카테고리의 다른 글
4일차 CSS/기능 리팩토링 및 배포 완료 (0) | 2021.04.09 |
---|---|
3일차 파이어베이스 로그인/로그아웃 및 채팅 구현 (0) | 2021.04.09 |
1일차 셋업/기본 로직 구현 (0) | 2021.04.08 |
Comments