Skip to content

Commit

Permalink
Merge pull request #70 from nbcamp-a3/feature/style
Browse files Browse the repository at this point in the history
style: 메인 페이지 스타일 수정
  • Loading branch information
scseong authored Nov 27, 2023
2 parents b73eb66 + c8b92e0 commit df01c2f
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 40 deletions.
1 change: 1 addition & 0 deletions src/components/Headermodal/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const StUserInfo = styled.div`
img {
margin-top: 30px;
align-self: flex-start;
border: 1px solid #eee;
width: 20%;
height: 50%;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Home/ContentContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function ContentContainer() {
.then((data) => {
dispatch(setBoards(data));
});
}, []);
}, [dispatch]);

const sliced = boards.slice(0, 4);

Expand Down
29 changes: 15 additions & 14 deletions src/components/Home/MainContent.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import React, { useEffect } from 'react';
import { StEditContentBox, StMainContent } from './style';
import {
StEditContentBox,
StMainContent,
StMainImageBox,
StMainInfoBox,
} from './style';
import { useSelector } from 'react-redux';
import { useState } from 'react';
import { useNavigate } from 'react-router';
Expand All @@ -11,12 +16,10 @@ export default function MainContent() {

useEffect(() => {
const randomNum1 = Math.floor(Math.random() * boards.length);

const filtered = boards.filter((item, index) => {
return randomNum1 === index;
});
setRandomData(filtered);
console.log('filtered:', filtered);
}, [boards]);

return (
Expand All @@ -29,17 +32,15 @@ export default function MainContent() {
navigate(`/boards/${item.id}`);
}}
>
<div>
<div>
<img src={item.img} alt="이미지" />
</div>
<div>
<h2>{item.title}</h2>
<StEditContentBox
dangerouslySetInnerHTML={{ __html: item.content }}
></StEditContentBox>
</div>
</div>
<StMainImageBox>
<img src={item.img} alt="이미지" />
</StMainImageBox>
<StMainInfoBox>
<h2>{item.title}</h2>
<StEditContentBox
dangerouslySetInnerHTML={{ __html: item.content }}
></StEditContentBox>
</StMainInfoBox>
</StMainContent>
);
})}
Expand Down
74 changes: 51 additions & 23 deletions src/components/Home/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ export const StHomeContainer = styled.div`
display: flex;
flex-direction: column;
align-items: center;
padding-left: 30px;
padding-right: 30px;
padding: 30px;
height: 100%;
margin-bottom: 200px;
`;

export const StCommentBtnBox = styled.div`
Expand Down Expand Up @@ -41,56 +41,77 @@ export const StGoToListBtn = styled.button`
}
`;
export const StMainContent = styled.div`
position: relative;
display: flex;
flex-wrap: wrap;
justify-content: stretch;
/* position: relative;
width: 100%;
height: 150%;
height: 100%;
background-color: #f9f9f9;
margin-bottom: 200px;
border-radius: 20px;
display: flex;
align-items: center;
padding: 30px;
padding: 30px; */
padding: 2rem;
width: 100%;
background-color: #f9f9f9;
border-radius: 20px;
cursor: pointer;
transition: 0.4s;
margin-bottom: 3rem;
&:hover {
background-color: #edebeb;
}
& > div {
display: flex;
@media screen and (max-width: 1200px) {
display: flex;
flex-direction: column-reverse;
flex-direction: column;
align-items: center;
justify-content: center;
}
h2 {
font-size: 40px;
margin: 30px;
margin: 30px 0;
font-weight: 800;
}
}
img {
width: 600px;
height: 600px;
/* div > img {
width: 400px;
height: 400px;
border-radius: 20px;
}
p {
margin-top: 100px;
margin-left: 30px;
}
} */
@media screen and (max-width: 1200px) {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
margin-bottom: 100px;
justify-content: center;
align-items: center;
flex-direction: column;
align-items: center;
}
`;

export const StMainImageBox = styled.div`
width: 40%;
text-align: center;
img {
width: 350px;
height: 350px;
border-radius: 20px;
}
`;

export const StMainInfoBox = styled.div`
width: 60%;
`;

export const StContentContainer = styled.div`
display: grid;
grid-template-columns: repeat(2, 50%);
Expand All @@ -104,7 +125,7 @@ export const StContentContainer = styled.div`

export const StContentBox = styled.div`
width: 600px;
height: 750px;
height: 800px;
justify-self: center;
align-self: center;
border-radius: 20px;
Expand All @@ -117,7 +138,7 @@ export const StContentBox = styled.div`
cursor: pointer;
transition: 0.4s;
display: flex;
height: 100%;
/* -webkit-line-clamp: 4;
-webkit-box-orient: vertical; */
Expand All @@ -132,6 +153,13 @@ export const StContentBox = styled.div`
padding: 30px;
}
h2 {
font-size: 40px;
color: #333;
margin: 30px;
font-weight: 800;
}
& > div {
color: #333;
margin: 30px;
Expand Down Expand Up @@ -159,14 +187,14 @@ export const StPtag = styled.p`
`;

export const StEditContentBox = styled.div`
word-break: break-all;
/* word-break: break-all;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 7;
text-align: justify;
h2 {
font-size: 1rem !important;
margin: 0 !important;
}
`;

Expand Down
2 changes: 0 additions & 2 deletions src/config/firebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ provider.setCustomParameters({ prompt: 'select_account' });
export const githubLogin = async () => {
return signInWithPopup(auth, provider)
.then((result) => {
console.log('login successful.');
const user = result.user;
return user;
})
Expand All @@ -39,7 +38,6 @@ export const githubLogin = async () => {
export const logout = async () => {
return signOut(auth)
.then(() => {
console.log('Sign-out successful.');
return null;
})
.catch(console.error);
Expand Down

0 comments on commit df01c2f

Please sign in to comment.