Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6회차 과제 - 권예원 #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.app {
font-family: Arial, sans-serif;
background-color: black;
}

body, html {
margin: 0;
padding: 0;
background-color: #000; /* 전체 배경을 검은색으로 설정 */
color: #fff; /* 텍스트 색상을 흰색으로 설정 */
height: 100%; /* 전체 높이를 차지하도록 설정 */
}
17 changes: 17 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import Header from './components/Header/Header';
import MainContent from './components/MainContent/MainContent';
import Shorts from './components/Shorts/Shorts';
import './App.css';

function App() {
return (
<div className="app">
<Header />
<MainContent />
<Shorts />
</div>
);
}

export default App;
33 changes: 33 additions & 0 deletions src/components/Header/Header.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@


.header {
background-color: black;
color: white;
display: flex;
justify-content: space-between;
padding: 5px;
align-items: center;
height: 40px;

}

.search-input {
color: rgb(228, 228, 228);
background-color: rgb(59, 59, 59);
flex-grow: 1;
margin-right: 20px;
padding: 6px; /* 패딩 줄임 */
margin-top: 0; /* 상단 마진 제거 */
margin-bottom: 0; /* 하단 마진 제거 */
width :400px;

}


.header-user{
display: flex;
justify-content: space-between;
align-items: center;
margin-right: 20px;
padding: 8px;
}
30 changes: 30 additions & 0 deletions src/components/Header/Header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react';
import './Header.css';

function Header() {
return (
<div className= 'header'>
<div className='header-logo'>
<h3>Youtube</h3>
</div>

<div>
<div className="header-input">
<input type="text" placeholder="Search" className="search-input"/>
{/* 아이콘 및 추가 컴포넌트 삽입 가능 */}
</div>
</div>

<div className='header-user'>
<h4>Make Video/</h4>
<h4>Alarm/</h4>
<h4>User</h4>
</div>


</div>

);
}

export default Header;
15 changes: 15 additions & 0 deletions src/components/MainContent/MainContent.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.main-content {
display: flex;
flex-wrap: wrap;
justify-content: flex-start; /* 가로 정렬 */
padding: 0;
gap: 10px; /* 카드 사이의 간격 */
}

.video-card {
flex: 1 1 calc((100% / 6) - 20px); /* 컨테이너 너비의 1/6에서 간격만큼 빼줌 */
margin: 5px;
height: 320px; /* 고정 높이 설정, 필요에 따라 조정 */
background-color: #333;
color: white;
}
18 changes: 18 additions & 0 deletions src/components/MainContent/MainContent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import VideoCard from '../VideoCard/VideoCard';
import './MainContent.css';

function MainContent() {
const videos = new Array(5).fill({ title: "Sample Video", views: "1M views", duration: "12:03" });

return (
<div className="main-content">
{videos.map((video, index) => (
<VideoCard key={index} video={video} />
))}
</div>
);
}


export default MainContent;
18 changes: 18 additions & 0 deletions src/components/Shorts/Shorts.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.Shorts {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
gap: 10px;
}

.video-grid{

max-width: 270px;
flex: 1 1 270px;
margin: 5px;
height: 50px; /* 고정 높이 설정, 필요에 따라 조정 */
background-color: #333;
color: white;

border-radius: 20px;
}
18 changes: 18 additions & 0 deletions src/components/Shorts/Shorts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import VideoGrid from '../VideoGrid/VideoGrid';
import './Shorts.css';

function Shorts() {
const videos = new Array(8).fill({ title: "Sample Video", views: "1M views", duration: "12:03" });

return (
<div className="Shorts">
{videos.map((video, index) => (
<VideoGrid key={index} video={video} />
))}
</div>
);
}


export default Shorts;
18 changes: 18 additions & 0 deletions src/components/VideoCard/VideoCard.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.video-card {
width: 270px;
margin: 10px;
color: white;
background: #000000;
border-radius: 10;
}

.thumbnail {
width: 90%;
height: auto;
}

.video-info {
padding: 5px;
margin-top: -10px
}

17 changes: 17 additions & 0 deletions src/components/VideoCard/VideoCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import './VideoCard.css';
import videoImage from './video.png';

function VideoCard({ video }) {
return (
<div className="video-card">
<img src={videoImage} alt="Thumbnail" className="video-thumbnail" />
<div className="video-info">
<h5>{video.title}</h5>
<p>{video.views} • {video.duration}</p>
</div>
</div>
);
}

export default VideoCard;
Binary file added src/components/VideoCard/video.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions src/components/VideoGrid/VideoGrid.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.video-grid {
width: 50px;
margin: 10px;
color: white;
background: #000000;
border-radius: 10px;
}

.video-thumbnail {
width: 100%;
height: 160px;
object-fit: cover;
}


.video-info {
padding: 5px;
margin-top: -10px
}

17 changes: 17 additions & 0 deletions src/components/VideoGrid/VideoGrid.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import './VideoGrid.css';
import videoImage from './video.png'; // 이미지 파일의 경로를 정확히 지정해야 함

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public 디렉토리에 img 디렉토리를 생성해서 이미지 파일을 저장해두면,

src = "img/imageName"

처럼 쉽게 접근할 수 있더라구요! 필요하시면 참고하시면 될 것 같습니다ㅎㅎ

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그런 방벙이 있었군요!!! 이미지 넣는데 고생했는데 public 디렉토리 사용하면 훨씬 쉽게 이미지 넣을 수있겠네요!!! 감사합니당


function VideoGrid({ video }) {
return (
<div className="video-grid">
<img src={videoImage} alt="Thumbnail" className="video-thumbnail" />
<div className="video-info">
<h5>{video.title}</h5>
<p>{video.views} • {video.duration}</p>
</div>
</div>
);
}

export default VideoGrid;
Binary file added src/components/VideoGrid/video.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}
17 changes: 17 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
1 change: 1 addition & 0 deletions src/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions src/reportWebVitals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const reportWebVitals = onPerfEntry => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};

export default reportWebVitals;
5 changes: 5 additions & 0 deletions src/setupTests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';