Skip to content

Commit

Permalink
feat: sideBar 반응형 디자인
Browse files Browse the repository at this point in the history
  • Loading branch information
GihoKo committed Jul 12, 2024
1 parent 52de78a commit d8a6a56
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 25 deletions.
7 changes: 5 additions & 2 deletions src/components/Molcules/SideBar/ChannelContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ import ChannelItem from './ChannelItem';
import useGetMyChannel from '../../../../apis/hooks/useGetMyChannel';
import { useUserStore } from '../../../store/useUserStore';
import { useParams } from 'react-router-dom';
import { UserId } from '../../../types/user';

interface ChannelContainerProps {
isOpen: boolean;
}

export default function ChannelContainer({ isOpen }: ChannelContainerProps) {
const { user } = useUserStore();
const userId = user?.id as UserId;
const userId = user?.id;
const { data: channelList, error, isLoading } = useGetMyChannel(userId);

// channelId
Expand Down Expand Up @@ -43,4 +42,8 @@ const Container = styled.div`
&::-webkit-scrollbar {
display: none;
}
@media (max-width: 1024px) {
margin-top: 8px;
}
`;
17 changes: 11 additions & 6 deletions src/components/Molcules/SideBar/ChannelItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ export default function ChannelItem({ channel, isOpen, isCurrentChannel }: SideB

return (
<Wrapper to={`/main/channel/${channel.id}`} $isCurrentChannel={isCurrentChannel}>
<ChannelImageBox>
<ImageWrapper>
<img src={channel.image === '' ? playListToggle() : channel.image} alt='채널 이미지' />
</ChannelImageBox>
<ChannelName $isOpen={isOpen} $isCurrentChannel={isCurrentChannel}>
</ImageWrapper>
<Name $isOpen={isOpen} $isCurrentChannel={isCurrentChannel}>
{channel.name ? channel.name : ''}
</ChannelName>
</Name>
</Wrapper>
);
}
Expand All @@ -38,6 +38,7 @@ const Wrapper = styled(Link)<{ $isCurrentChannel: boolean }>`
background-color: ${(props) => (props.$isCurrentChannel ? 'var(--mint7)' : 'transparent')};
box-shadow: ${(props) => (props.$isCurrentChannel ? '0 0 5px var(--mint5)' : 'none')};
padding: 8px;
padding-left: 6px;
cursor: pointer;
Expand All @@ -46,7 +47,7 @@ const Wrapper = styled(Link)<{ $isCurrentChannel: boolean }>`
}
`;

const ChannelImageBox = styled.div`
const ImageWrapper = styled.div`
width: 32px;
height: 32px;
border-radius: 50%;
Expand All @@ -62,7 +63,7 @@ const ChannelImageBox = styled.div`
}
`;

const ChannelName = styled.div<{ $isOpen: boolean; $isCurrentChannel: boolean }>`
const Name = styled.div<{ $isOpen: boolean; $isCurrentChannel: boolean }>`
width: 100%;
display: ${(props) => (props.$isOpen ? 'block' : 'none')};
Expand All @@ -73,4 +74,8 @@ const ChannelName = styled.div<{ $isOpen: boolean; $isCurrentChannel: boolean }>
text-overflow: ellipsis;
cursor: pointer;
@media (max-width: 1024px) {
display: none;
}
`;
4 changes: 4 additions & 0 deletions src/components/Molcules/SideBar/NavigatorItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,8 @@ const Name = styled.div<{ $isOpen: boolean; $isFocused: boolean }>`
text-overflow: ellipsis;
cursor: pointer;
@media (max-width: 1024px) {
display: none;
}
`;
4 changes: 4 additions & 0 deletions src/components/Molcules/SideBar/SideBarToggleButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,8 @@ const Button = styled.button`
object-fit: cover;
cursor: pointer;
}
@media (max-width: 1024px) {
display: none;
}
`;
13 changes: 9 additions & 4 deletions src/components/Organisms/Content/ChannelContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,21 @@ const Wrapper = styled.div`

const Container = styled.ul`
display: grid;
grid-template-columns: repeat(5, 25%);
gap: 24px 24px;
grid-template-columns: repeat(5, 1fr);
gap: 16px;
padding: 24px;
@media (max-width: 1440px) {
grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 1024px) {
grid-template-columns: repeat(2, 50%);
grid-template-columns: repeat(2, 1fr);
gap: 8px;
}
@media (max-width: 768px) {
grid-template-columns: repeat(1, 100%);
grid-template-columns: repeat(1, 1fr);
}
`;
8 changes: 8 additions & 0 deletions src/components/Organisms/SiderBar/SideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ const Wrapper = styled.div<{
}
transition: width 0.3s;
@media (max-width: 1024px) {
width: 72px;
}
`;

const Header = styled.div`
Expand All @@ -82,4 +86,8 @@ const CartegoryName = styled.div<{
color: var(--grey-grey600);
cursor: default;
@media (max-width: 1024px) {
display: none;
}
`;
8 changes: 0 additions & 8 deletions src/pages/Landing/LandingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export default function LandingPage() {
<Logo>
<img src={logo} alt='로고 이미지' />
</Logo>
<Description>같이 노래 듣자!</Description>
<StartButton onClick={handleStartButtonClick}>Start!</StartButton>
</Box>
</Wrapper>
Expand Down Expand Up @@ -61,13 +60,6 @@ const Logo = styled.div`
}
`;

const Description = styled.p`
font-size: 16px;
color: var(--grey-grey600);
margin-top: 24px;
`;

const StartButton = styled.button`
border: 2px solid var(--mint7);
border-radius: 16px;
Expand Down
3 changes: 0 additions & 3 deletions src/pages/SignUp/SignUpPage.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions src/router/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Route, Routes } from 'react-router-dom';
import SignInPage from '../pages/Signin/SignInPage';
import SignUpPage from '../pages/SignUp/SignUpPage';
import LandingPage from '../pages/Landing/LandingPage';
import NotFoundPage from '../pages/NotFound/NotFoundPage';
import MainPage from '../pages/Main/MainPage';
Expand All @@ -14,7 +13,6 @@ export default function Router() {
<Routes>
<Route path='/' element={<LandingPage />} />
<Route path='/signIn' element={<SignInPage />} />
<Route path='/signUp' element={<SignUpPage />} />
<Route path='/main' element={<MainPage />}>
<Route path='/main' element={<ChannelContainer />} />
<Route path='/main/channel/:channelId' element={<Channel />} />
Expand Down

0 comments on commit d8a6a56

Please sign in to comment.