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

Feat: 푸터 설정, 페이지 이동 시 최상단으로 나타나게 설정, 반응형 #21

Merged
merged 5 commits into from
Nov 27, 2024
Merged
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
25 changes: 25 additions & 0 deletions src/components/common/Footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';
import styled from 'styled-components';

const Footer: React.FC = () => (
<FooterWrapper>
<FooterText>© 2024 LinkUp. All Rights Reserved.</FooterText>
</FooterWrapper>
);

const FooterWrapper = styled.footer`
width: 100%;

color: white;
background-color: black;
text-align: center;
padding: 1rem 0;
margin-top: auto;
`;

const FooterText = styled.p`
margin: 0;
font-size: 1rem;
`;

export default Footer;
5 changes: 3 additions & 2 deletions src/components/common/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import Header from './Header';
import styled from 'styled-components';
import { Outlet } from 'react-router-dom';
import Footer from './Footer';

const Layout: React.FC = () => {
return (
Expand All @@ -10,15 +11,15 @@ const Layout: React.FC = () => {
<MainContent>
<Outlet />
</MainContent>
{/* Footer */}
<Footer />
</LayoutContainer>
);
};

const LayoutContainer = styled.div`
display: flex;
flex-direction: column;
min-height: 100vh; /* 화면 전체를 채우기 위해 설정 */
min-height: 100vh;
`;

const MainContent = styled.main`
Expand Down
15 changes: 15 additions & 0 deletions src/components/common/ScrollToTop.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { useEffect } from 'react';
import { useLocation } from 'react-router-dom';

// 페이지 이동 시 자동으로 최상단을 보도록 하는 컴포넌트

const ScrollToTop = () => {
const { pathname } = useLocation();

useEffect(() => {
window.scrollTo(0, 0);
}, [pathname]);
return null;
};

export default ScrollToTop;
3 changes: 3 additions & 0 deletions src/components/pages/HomePage/CategoryProduct.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ const Card = styled.div`
box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.4);
transform: translateY(-5px);
}
@media (min-width: 768px) and (max-width: 1024px) {
width: 130px;
}
`;
const StyledLink = styled(Link)`
text-decoration: none;
Expand Down
1 change: 1 addition & 0 deletions src/components/pages/HomePage/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ const ContainerBox = styled.div`
margin-left: auto;
margin-right: auto;
`;

const Container = styled.div`
display: flex;
align-items: center;
Expand Down
85 changes: 65 additions & 20 deletions src/components/pages/HomePage/PopularProduct.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import styled from 'styled-components';
import { Product } from './model/productSchema';
import StarRating from '../../common/StarRating';
import { Link } from 'react-router-dom';
// import { Link } from 'react-router-dom';

interface PopularProductProps {
Expand All @@ -10,37 +11,67 @@ interface PopularProductProps {

const PopularProduct: React.FC<PopularProductProps> = ({ product }) => {
return (
<BannerContainer>
<ImageWrapper>
<ProductImage src={product.image} alt={product.name} />
</ImageWrapper>
<ProductInfoSection>
<Star>
<StarRating rating={product.stars} />
</Star>
<ProductHeader>
<TitleArea>
<ProductName>{product.name}</ProductName>
<StyledLink to={`/products/${product.id}`}>
<BannerContainer>
<ImageWrapper>
<ProductImage src={product.image} alt={product.name} />
</ImageWrapper>
<ProductInfoSection>
<Star>
<StarRating rating={product.stars} />
</Star>
<ProductHeader>
<TitleArea>
<ProductName>{product.name}</ProductName>

<ProductCategory>{product.category}</ProductCategory>
</TitleArea>
<ProductDescription> 상품설명- 추후 추가 예정</ProductDescription>
{/* {product.description} */}
</ProductHeader>
</ProductInfoSection>
</BannerContainer>
<ProductCategory>{product.category}</ProductCategory>
</TitleArea>
<ProductDescription>
{' '}
상품설명- 추후 추가 예정 상품설명- 추후 추가 예정 상품설명- 추후
추가 예정 상품설명- 추후 추가 예정 상품설명- 추후 추가 예정
상품설명- 추후 추가 예정 상품설명- 추후 추가 예정 상품설명- 추후
추가 예정 상품설명- 추후 추가 예정 상품설명- 추후 추가 예정
상품설명- 추후 추가 예정 상품설명- 추후 추가 예정 상품설명- 추후
추가 예정 상품설명- 추후 추가 예정 상품설명- 추후 추가 예정
상품설명- 추후 추가 예정 상품설명- 추후 추가 예정 상품설명- 추후
추가 예정 상품설명- 추후 추가 예정
</ProductDescription>
{/* {product.description} */}
</ProductHeader>
</ProductInfoSection>
</BannerContainer>
</StyledLink>
);
};

const BannerContainer = styled.div`
const StyledLink = styled(Link)`
width: 80%;
height: 300px;
margin: 0 auto;
display: block;
text-decoration: none;
color: inherit;

&:link,
&:visited,
&:hover,
&:active {
color: inherit;
text-decoration: none;
}
`;

const BannerContainer = styled.div`
height: 300px;
display: flex;
background-color: #f5f5f5;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
&:hover {
cursor: pointer;
transform: translateY(-5px);
}
`;

const ImageWrapper = styled.div`
Expand All @@ -59,6 +90,7 @@ const ProductImage = styled.img`
`;

const ProductInfoSection = styled.div`
background: linear-gradient(to top, rgba(155, 155, 155, 0.7), transparent);
flex-grow: 1;
display: flex;
flex-direction: column;
Expand All @@ -83,6 +115,9 @@ const TitleArea = styled.div`
display: flex;
align-items: baseline;
margin-bottom: 15px;
@media (min-width: 768px) and (max-width: 1024px) {
flex-direction: column;
}
`;

const ProductName = styled.h3`
Expand All @@ -95,6 +130,9 @@ const ProductName = styled.h3`
const ProductCategory = styled.p`
font-size: 16px;
color: #666;
@media (min-width: 768px) and (max-width: 1024px) {
margin-top: -10px;
}
`;

const ProductDescription = styled.p`
Expand All @@ -106,5 +144,12 @@ const ProductDescription = styled.p`
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
@media (min-width: 768px) and (max-width: 1024px) {
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
`;
export default PopularProduct;
4 changes: 4 additions & 0 deletions src/components/pages/HomePage/RecommendProduct.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ const Card = styled.div`
box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.4);
transform: translateY(-5px);
}

@media (min-width: 768px) and (max-width: 1024px) {
width: 130px;
}
`;
const StyledLink = styled(Link)`
text-decoration: none;
Expand Down
26 changes: 24 additions & 2 deletions src/components/pages/ProductDetailPage/ProductDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ const ProductDetail: React.FC = () => {
};

const Container = styled.div`
width: 100%;
width: 90%;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
Expand Down Expand Up @@ -417,8 +417,12 @@ const Stars = styled.div`
position: absolute;
font-size: 20px;
color: #ffaa00;
bottom: 20%;
bottom: 21%;
right: 2%;

@media (min-width: 768px) and (max-width: 1024px) {
bottom: 23%;
}
`;

const PriceWrapper = styled.div`
Expand All @@ -435,6 +439,9 @@ const DiscountWrapper = styled.div`
const DiscountInfo = styled.div`
font-size: 14px;
color: #888;
@media (min-width: 768px) and (max-width: 1024px) {
margin-left: -50%;
}
`;
const OriginalPrice = styled.div`
text-decoration: line-through;
Expand Down Expand Up @@ -462,12 +469,27 @@ const RemainingCount = styled.div`
margin-right: 8px;
font-size: 16px;
}
@media (min-width: 768px) and (max-width: 1024px) {
width: 220px;
}
`;

const Description = styled.p`
margin-bottom: 30px;
line-height: 1.6;
color: #666;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
@media (min-width: 768px) and (max-width: 1024px) {
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
`;
const DeadlineLabel = styled.div`
font-size: 16px;
Expand Down
3 changes: 3 additions & 0 deletions src/components/pages/ProductPage/ProductComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ const Card = styled.div`
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
align-items: center;
position: relative;
@media (min-width: 768px) and (max-width: 1024px) {
width: 130px;
}
`;
const StyledLink = styled(Link)`
text-decoration: none;
Expand Down
8 changes: 7 additions & 1 deletion src/routes/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,17 @@ import SetProfilePage from '../components/pages/login/SetProfilePage';
import LoginCompletePage from '../components/pages/login/LoginCompletePage';
import PaymentForm from '../components/pages/Payment/PaymentForm';
import PaymentSuccessPage from '../components/pages/Payment/PaymentSuccessPage';
import ScrollToTop from '../components/common/ScrollToTop';

const router = createBrowserRouter([
{
path: '/',
element: <Layout />,
element: (
<>
<Layout />
<ScrollToTop />
</>
),
errorElement: <ErrorPage />,
children: [
{
Expand Down