2일차 사진 갤러리 로직 및 CSS 완료

2021. 4. 8. 15:10·Projects/JStargram_2021

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_2021' 카테고리의 다른 글

4일차 CSS/기능 리팩토링 및 배포 완료  (0) 2021.04.09
3일차 파이어베이스 로그인/로그아웃 및 채팅 구현  (0) 2021.04.09
1일차 셋업/기본 로직 구현  (0) 2021.04.08
'Projects/JStargram_2021' 카테고리의 다른 글
  • 4일차 CSS/기능 리팩토링 및 배포 완료
  • 3일차 파이어베이스 로그인/로그아웃 및 채팅 구현
  • 1일차 셋업/기본 로직 구현
JTB
JTB
웹/앱 개발 정보를 공유하고 있습니다.
  • JTB
    JTechBlog
    JTB
  • 전체
    오늘
    어제
    • All About Programming;) N
      • Computer Science
        • Terminology and Concepts
        • Network
        • Operating System
        • Database
        • Data Structure
      • Frontend
        • Javascript Essentials
        • Perfomance Optimization
        • JS Patterns
        • Next.js
        • Flutter
      • Backend
        • Node.js
      • DevOps
        • Docker & Kubernetes
      • Coding Test N
        • LeetCode N
        • Programmers
      • Tech Books & Lectures
        • Javascript_Modern JS Deep d..
        • Network_IT 엔지니어를 위한 네트워크 입문
      • Projects
        • PolyLingo_2025
        • Build Your Body_2024
        • JStargram_2021
        • Covid19 Tracker_2021
        • JPortfolio_2021
      • BootCamp_Codestates
        • TIL
        • TILookCloser
        • Pre Tech Blog
        • IM Tech Blog
        • Daily Issues and DeBugging
        • First Project
        • Final Project
        • Sprint Review
        • Good to Know
        • Socrative Review
        • HTML &amp; CSS
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

    • 글쓰기
    • 관리
  • 공지사항

  • 인기 글

  • 태그

    js pattern
    structure of os
    testing
    JavaScript
    이벤트
    CPU scheduling algorithm
    Operating System
    Binary Tree BFS
    프론트엔드 성능 최적화 가이드
    스코프
    TCP/IP
    mobile app
    자바스크립트 딥다이브
    Shared resources
    How memory manage data
    indie hacker
    Network
    커리어
    Data Structure
    DOM
    polylingo
    VoiceJournal
    모던 자바스크립트 Deep Dive
    database
    leetcode
    딥다이브
    자바스크립트
    Threads and Multithreading
    Time complexity and Space complexity
    need a database
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.5
JTB
2일차 사진 갤러리 로직 및 CSS 완료
상단으로

티스토리툴바