-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #168 from KNU-HAEDAL/develop
변경사항 병합
- Loading branch information
Showing
20 changed files
with
459 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { ChallengeResponse } from './getReview.response'; | ||
import { axiosClient } from '@/apis/AxiosClient'; | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
const getReviewPath = () => '/api/challengeGroups/reviews'; | ||
|
||
const ReviewQueryKey = [getReviewPath()]; | ||
|
||
const getReview = async ( | ||
page: number, | ||
size: number | ||
): Promise<ChallengeResponse> => { | ||
const response = await axiosClient.get(getReviewPath(), { | ||
params: { | ||
page, | ||
size, | ||
}, | ||
}); | ||
return response.data; | ||
}; | ||
|
||
export const useGetReview = (page: number, size: number) => { | ||
return useQuery<ChallengeResponse, Error>({ | ||
queryKey: [ReviewQueryKey, page, size], | ||
queryFn: () => getReview(page, size), | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import ApiResponse from '@/apis/ApiResponse'; | ||
|
||
export type ChallengeUser = { | ||
id: number; | ||
nickname: string; | ||
profileImageUrl: string; | ||
tierInfo: { | ||
tier: string; | ||
totalExp: number; | ||
currentExp: number; | ||
}; | ||
}; | ||
|
||
export type ChallengeData = { | ||
challengeId: number; | ||
challengeTitle: string; | ||
user: ChallengeUser; | ||
content: string; | ||
rating: number; | ||
}; | ||
|
||
export type ChallengeResponseData = { | ||
totalPage: number; | ||
hasNext: boolean; | ||
data: ChallengeData[]; | ||
}; | ||
|
||
export type ChallengeResponse = ApiResponse<ChallengeResponseData>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import styled from '@emotion/styled'; | ||
|
||
type CTAProps = { | ||
label: string; | ||
disabled?: boolean; | ||
onClick: () => void; | ||
}; | ||
|
||
const CTA = ({ label, disabled, onClick }: CTAProps) => { | ||
return ( | ||
<StyledCTA disabled={disabled} onClick={onClick}> | ||
{label} | ||
</StyledCTA> | ||
); | ||
}; | ||
|
||
export default CTA; | ||
|
||
const StyledCTA = styled.button<{ disabled?: boolean }>` | ||
width: calc(100% - 16px); // 부모 요소의 좌우 padding 빼고 | ||
border: none; | ||
border-radius: 10px; | ||
background-color: var(--color-green-01); | ||
color: var(--color-white); | ||
font-size: var(--font-size-md); | ||
font-weight: bold; | ||
outline: none; | ||
padding: 10px 8px; | ||
margin: 0 auto; | ||
&:disabled { | ||
cursor: not-allowed; | ||
color: var(--color-grey-01); | ||
background-color: var(--color-grey-02); | ||
} | ||
/* &:hover와 &:focus는 disabled === false일 때만 적용 */ | ||
&:hover, | ||
&:focus { | ||
${({ disabled }) => | ||
!disabled && | ||
` | ||
opacity: 0.8 !important; | ||
background-color: var(--color-green-01) !important; | ||
color: var(--color-white) !important; | ||
`} | ||
} | ||
`; | ||
|
||
// 컨테이너 필요할 때 따로 임포트하여 사용 | ||
export const CTAContainer = styled.div` | ||
position: sticky; | ||
bottom: 0; | ||
display: flex; | ||
width: 100%; | ||
height: 4rem; | ||
padding: 8px 16px; | ||
background-color: var(--color-white); | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import styled from '@emotion/styled'; | ||
|
||
type TextareaProps = { | ||
placeholder?: string; | ||
value: string; | ||
onChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void; | ||
valid?: boolean; | ||
}; | ||
|
||
const Textarea = ({ placeholder, value, onChange, valid }: TextareaProps) => { | ||
return ( | ||
<StyledTextarea | ||
placeholder={placeholder} | ||
value={value} | ||
onChange={onChange} | ||
valid={valid} | ||
/> | ||
); | ||
}; | ||
|
||
export default Textarea; | ||
|
||
const StyledTextarea = styled.textarea<{ valid?: boolean }>` | ||
font-size: var(--font-size-sm); | ||
color: var(--color-black); | ||
border-radius: 20px; | ||
border: ${({ valid }) => | ||
valid | ||
? 'var(--color-grey-02) 1px solid' | ||
: 'var(--color-class-05) 1px solid'}; | ||
padding: 12px; | ||
width: 100%; | ||
height: 180px; | ||
resize: none; | ||
outline: none; | ||
&::placeholder { | ||
color: var(--color-grey-01); | ||
opacity: 1; /* Firefox에서 placeholder 색상을 명시적으로 설정하기 위해 추가 */ | ||
} | ||
&:focus { | ||
border: ${({ valid }) => | ||
valid | ||
? 'var(--color-green-01) 1px solid' | ||
: 'var(--color-class-05) 1px solid'}; | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import NavBar, { NAVBAR_HEIGHT } from '@/components/features/layout/nav-bar'; | ||
import { Box } from '@chakra-ui/react'; | ||
|
||
type NavBarLayoutTypes = { | ||
children: React.ReactNode; | ||
}; | ||
|
||
const NavBarLayout = ({ children }: NavBarLayoutTypes) => { | ||
return ( | ||
<Box> | ||
<Box minHeight={`calc(100vh - ${NAVBAR_HEIGHT})`}>{children}</Box> | ||
<NavBar /> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default NavBarLayout; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,63 @@ | ||
import NavBarButtons from './buttons.tsx'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
import { navBarData } from '@/constants/nav-bar'; | ||
import { Box } from '@chakra-ui/react'; | ||
import styled from '@emotion/styled'; | ||
|
||
type NavBarTypes = { | ||
children: React.ReactNode; | ||
}; | ||
export const NAVBAR_HEIGHT = '3.44rem'; | ||
|
||
const NavBar = () => { | ||
const navigate = useNavigate(); | ||
|
||
const handleNav = (page: string) => { | ||
navigate(page); | ||
}; | ||
|
||
const Index = ({ children }: NavBarTypes) => { | ||
return ( | ||
<> | ||
<Box | ||
display='flex' | ||
flexDirection='column' | ||
height='100%' | ||
paddingBottom='3.44' | ||
> | ||
<Box flex={1}>{children}</Box> | ||
<NavBarButtons /> | ||
</Box> | ||
</> | ||
<Wrapper> | ||
{navBarData.map((item) => ( | ||
<Tab key={item.title}> | ||
<Icon | ||
src={item.icon} | ||
// alt={item.title} | ||
onClick={() => handleNav(item.path)} | ||
/> | ||
</Tab> | ||
))} | ||
</Wrapper> | ||
); | ||
}; | ||
|
||
export default Index; | ||
export default NavBar; | ||
|
||
const Wrapper = styled(Box)` | ||
display: flex; | ||
flex-direction: row; | ||
width: 100%; | ||
height: ${NAVBAR_HEIGHT}; | ||
position: sticky; | ||
bottom: 0; | ||
left: 0; | ||
border-top: 0.5px solid #bdc5cd; | ||
background-color: #fafafa; | ||
`; | ||
|
||
const Tab = styled.div` | ||
width: 50%; | ||
height: 100%; | ||
display: inline-flex; | ||
justify-content: center; | ||
align-items: center; | ||
`; | ||
|
||
const Icon = styled.button<{ src: string }>` | ||
width: 2rem; | ||
height: 2rem; | ||
outline: none; | ||
background-image: url(${({ src }) => src}); | ||
background-size: cover; | ||
background-position: center; | ||
background-repeat: no-repeat; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.