-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fe-dev' into feature/#855
- Loading branch information
Showing
31 changed files
with
389 additions
and
37 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
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,11 @@ | ||
import {User} from 'types/serviceType'; | ||
|
||
import {BASE_URL} from '@apis/baseUrl'; | ||
import {requestGet} from '@apis/fetcher'; | ||
|
||
export const requestGetUserInfo = async () => { | ||
return await requestGet<User>({ | ||
baseUrl: BASE_URL.HD, | ||
endpoint: `/api/users/mine`, | ||
}); | ||
}; |
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
19 changes: 19 additions & 0 deletions
19
client/src/components/Design/components/CreatedEvent/CreatedEvent.style.ts
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,19 @@ | ||
import {css} from '@emotion/react'; | ||
|
||
import {WithTheme} from '@components/Design/type/withTheme'; | ||
|
||
export const inProgressCheckStyle = ({inProgress, theme}: WithTheme<{inProgress: boolean}>) => | ||
css({ | ||
display: 'flex', | ||
alignItems: 'center', | ||
gap: '0.125rem', | ||
border: `1px solid ${inProgress ? theme.colors.primary : theme.colors.gray}`, | ||
borderRadius: '0.5rem', | ||
padding: '0.25rem 0.375rem', | ||
height: '1.25rem', | ||
|
||
'.in-progress-check-text': { | ||
color: inProgress ? theme.colors.primary : theme.colors.gray, | ||
paddingTop: '0.0625rem', | ||
}, | ||
}); |
70 changes: 70 additions & 0 deletions
70
client/src/components/Design/components/CreatedEvent/CreatedEvent.tsx
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,70 @@ | ||
/** @jsxImportSource @emotion/react */ | ||
import {useNavigate} from 'react-router-dom'; | ||
|
||
import Text from '@HDcomponents/Text/Text'; | ||
|
||
import {useTheme} from '@components/Design'; | ||
|
||
import Flex from '../Flex/Flex'; | ||
import Input from '../Input/Input'; | ||
|
||
import {CreatedEventItemProps, CreatedEventListProps} from './CreatedEvent.type'; | ||
import {inProgressCheckStyle} from './CreatedEvent.style'; | ||
|
||
function InProgressCheck({inProgress}: {inProgress: boolean}) { | ||
const {theme} = useTheme(); | ||
|
||
return ( | ||
<div css={inProgressCheckStyle({theme, inProgress})}> | ||
<Text size="tiny" className="in-progress-check-text"> | ||
{inProgress ? 'μ§ν' : 'μλ£'} | ||
</Text> | ||
</div> | ||
); | ||
} | ||
|
||
function CreatedEventItem({createdEvent}: CreatedEventItemProps) { | ||
const navigate = useNavigate(); | ||
const onClick = () => { | ||
navigate(`/event/${createdEvent.eventId}/admin`); | ||
}; | ||
|
||
return ( | ||
<Flex | ||
justifyContent="spaceBetween" | ||
alignItems="center" | ||
height="2.5rem" | ||
padding="0.5rem 1rem" | ||
paddingInline="0.5rem" | ||
onClick={onClick} | ||
> | ||
<Flex gap="0.5rem" alignItems="center"> | ||
<InProgressCheck inProgress={createdEvent.isFinished} /> | ||
<Text size="bodyBold" color="onTertiary"> | ||
{createdEvent.eventName} | ||
</Text> | ||
</Flex> | ||
</Flex> | ||
); | ||
} | ||
|
||
function CreatedEventList({createdEvents, eventName, onSearch, placeholder}: CreatedEventListProps) { | ||
return ( | ||
<Flex | ||
flexDirection="column" | ||
width="100%" | ||
backgroundColor="white" | ||
padding="0.5rem 1rem" | ||
paddingInline="0.5rem" | ||
gap="0.5rem" | ||
height="100%" | ||
cssProp={{borderRadius: '1rem'}} | ||
> | ||
<Input inputType="search" value={eventName} onChange={onSearch} placeholder={placeholder} /> | ||
{createdEvents.length !== 0 && | ||
createdEvents.map(createdEvent => <CreatedEventItem key={createdEvent.eventId} createdEvent={createdEvent} />)} | ||
</Flex> | ||
); | ||
} | ||
|
||
export default CreatedEventList; |
12 changes: 12 additions & 0 deletions
12
client/src/components/Design/components/CreatedEvent/CreatedEvent.type.ts
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,12 @@ | ||
import {CreatedEvent} from './../../../../types/serviceType'; | ||
|
||
export interface CreatedEventItemProps { | ||
createdEvent: CreatedEvent; | ||
} | ||
|
||
export interface CreatedEventListProps { | ||
eventName: string; | ||
onSearch: ({target}: React.ChangeEvent<HTMLInputElement>) => void; | ||
placeholder: string; | ||
createdEvents: CreatedEvent[]; | ||
} |
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
31 changes: 31 additions & 0 deletions
31
client/src/components/Design/components/Profile/Profile.stories.tsx
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,31 @@ | ||
/** @jsxImportSource @emotion/react */ | ||
import type {Meta, StoryObj} from '@storybook/react'; | ||
|
||
import {Profile} from './Profile'; | ||
|
||
const meta: Meta<typeof Profile> = { | ||
title: 'Components/Profile', | ||
component: Profile, | ||
tags: ['autodocs'], | ||
parameters: { | ||
layout: 'centered', | ||
}, | ||
decorators: [ | ||
Story => ( | ||
<div style={{width: '200px', height: '200px', padding: '1rem'}}> | ||
<Story /> | ||
</div> | ||
), | ||
], | ||
args: { | ||
src: 'https://wooteco-crew-wiki.s3.ap-northeast-2.amazonaws.com/%EC%9B%A8%EB%94%94%286%EA%B8%B0%29/g583lirp8yg.jpg', | ||
size: 'large', | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
// Playground μ€ν 리 | ||
export const Playground: Story = {}; |
26 changes: 26 additions & 0 deletions
26
client/src/components/Design/components/Profile/Profile.style.ts
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,26 @@ | ||
import {css} from '@emotion/react'; | ||
|
||
import {Theme} from '@components/Design/theme/theme.type'; | ||
|
||
import {ProfileSize} from './Profile.type'; | ||
|
||
const SEMANTIC_SIZE: Record<ProfileSize, string> = { | ||
small: '1rem', | ||
medium: '1.75rem', | ||
large: '3rem', | ||
}; | ||
|
||
export const profileContainerStyle = (theme: Theme, size: ProfileSize) => { | ||
return css({ | ||
display: 'flex', | ||
|
||
width: SEMANTIC_SIZE[size], | ||
height: SEMANTIC_SIZE[size], | ||
|
||
borderRadius: '50%', | ||
|
||
backgroundColor: theme.colors.white, | ||
|
||
objectFit: 'cover', | ||
}); | ||
}; |
13 changes: 13 additions & 0 deletions
13
client/src/components/Design/components/Profile/Profile.tsx
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,13 @@ | ||
/** @jsxImportSource @emotion/react */ | ||
import {useTheme} from '@components/Design/theme/HDesignProvider'; | ||
|
||
import Image from '../Image/Image'; | ||
|
||
import {profileContainerStyle} from './Profile.style'; | ||
import {ProfileProps} from './Profile.type'; | ||
|
||
export const Profile = ({size = 'medium', ...profileProps}: ProfileProps) => { | ||
const {theme} = useTheme(); | ||
|
||
return <Image aria-label="νλ‘ν μ΄λ―Έμ§" {...profileProps} css={profileContainerStyle(theme, size)} />; | ||
}; |
7 changes: 7 additions & 0 deletions
7
client/src/components/Design/components/Profile/Profile.type.ts
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,7 @@ | ||
import {ImageProps} from '../Image/Image'; | ||
|
||
export type ProfileSize = 'small' | 'medium' | 'large'; | ||
|
||
export type ProfileProps = ImageProps & { | ||
size?: ProfileSize; | ||
}; |
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
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
23 changes: 23 additions & 0 deletions
23
client/src/hooks/queries/event/useRequestGetCreatedEvents.ts
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,23 @@ | ||
import {useQuery} from '@tanstack/react-query'; | ||
|
||
import {requestGetCreatedEvents} from '@apis/request/event'; | ||
|
||
import QUERY_KEYS from '@constants/queryKeys'; | ||
|
||
const useRequestGetCreatedEvents = () => { | ||
const {data, ...rest} = useQuery({ | ||
queryKey: [QUERY_KEYS.createdEvents], | ||
queryFn: () => requestGetCreatedEvents(), | ||
select: data => ({ | ||
...data, | ||
events: data.events.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()), | ||
}), | ||
}); | ||
|
||
return { | ||
events: data?.events, | ||
...rest, | ||
}; | ||
}; | ||
|
||
export default useRequestGetCreatedEvents; |
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.