Tesla 클론코딩 1: styled-components로 Model S 섹션 만들기
Tesla 메인 화면을 따라 만들며 App.css·index.css 기본 스타일과 styled-components로 Header·Section 컴포넌트를 작성했습니다.
2023년에 쓴 글이라 지금과 다른 내용이 있을 수 있습니다.
-Icon,img

-App.css
- { margin: 0; padding: 0; box-sizing: border-box; font-family: "Rubik", sans-serif; color: #393c41; } body{ width: 100%; }
-index.css
- { margin: 0; padding: 0; box-sizing: border-box; } body{ width: 100%; overflow-x: hidden; } @keyframes animateDown { 0%, 20%, 50%, 80%, 100% { transform: translateY(0); } 40%{ transform: translateY(5px); } 60%{ transform: translateY(3px); }
-Header.jsx
import React from "react";
import styled from "styled-components";
import Section from "./Section";
const Container = styled.div height: 100vh; text-align: center;;
export default class Header extends React.Component { render() { return ( <Container> <Section /> <Section /> <Section /> </Container> ); } }
-Section.jsx
import React from "react"; import styled from "styled-components";
const Wrap = styled.div width: 100vw; height: 100vh; background-size: cover; background-position: center; background-repeat: no-repeat; background-image: url("/img/Tesla_1.jpeg"); display: flex; flex-direction: column; justify-content: space-between; align-items: center; ;
const ItemText = styled.div padding-top: 15vh; text-align: center; ;
const ButtonGroup = styled.div display: flex; margin-bottom: 30px; @media (max-width: 768px) { flex-direction: column; } ;
const LeftButton = styled.div background-color: rgba(23, 26, 32, 0.8); height: 40px; width: 256px; color: white; display: flex; justify-content: center; align-items: center; border-radius: 100px; opacity: 0.85; text-transform: uppercase; font-size: 12px; margin-right: 20px; &:hover { background-color: #ffffff; color: rgba(23, 26, 32, 0.8); }
const RightButton = styled(LeftButton);
const DownArrow = styled.img margin-top: 20px; height: 40px; animation: animateDown infinite 1.5s; ; const Buttons = styled.div margin: 8px; ;
const Section = () => { return ( <Wrap> <ItemText> <h1>Model S</h1> <p>Order Online for Touchless Delivery</p> </ItemText> <Buttons> <ButtonGroup> <LeftButton>Custom Order</LeftButton> <RightButton>Existing Inventory</RightButton> </ButtonGroup> <DownArrow src="/img/down-arrow.png" /> </Buttons> </Wrap> ); }; export default Section;
같은 주제의 글
림카 홈페이지 제작 2: 메인 애니메이션과 반응형 디자인
림카 홈페이지 메인 화면에 애니메이션 효과를 넣고, focus 이슈를 해결한 뒤 반응형 디자인을 적용한 결과를 GIF로 남겼습니다.
1분 읽기#토이 프로젝트KOBIS 공공데이터로 영화 좌석 예매 화면 만들기
KOBIS 영화 목록 API를 SWR로 불러오고, 3×10 좌석 배열과 sessionStorage로 좌석 선택 상태를 다루는 Seat·Detail 컴포넌트를 정리했습니다.
1분 읽기#토이 프로젝트