Skip to content

Commit

Permalink
feat: 부산대 12조 FE 8,9주차 PR (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
cla6shade authored Nov 1, 2024
2 parents 2e5f7b5 + 67be684 commit 73bd7a9
Show file tree
Hide file tree
Showing 51 changed files with 1,062 additions and 137 deletions.
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ module.exports = {
'react/jsx-props-no-spreading': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'react/jsx-boolean-value': 'off',
'react/jsx-no-constructed-context-values': 'off',
'import/prefer-default-export': 'off',
},
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ dist-ssr
*.sln
*.sw?

.env

*storybook.log
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@tanstack/react-query": "^5.59.0",
"axios": "^1.7.7",
"emotion-normalize": "^11.0.1",
"react": "^18.3.1",
"react-datepicker": "^7.5.0",
"react-dom": "^18.3.1",
"react-hook-form": "^7.53.0",
"react-router-dom": "^6.26.2",
Expand Down
8 changes: 8 additions & 0 deletions src/api/auth/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import axios from 'axios';
import endpoints from '@constants/endpoints';
import { TokenReIssueResponse } from '@/types/auth';

export async function reIssueAccessToken() {
const response = await axios.get<TokenReIssueResponse>(endpoints.reIssue);
return response.data.AccessToken;
}
8 changes: 8 additions & 0 deletions src/api/member/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import endpoints from '@constants/endpoints';
import { MyInfoResponse } from '@/types/member';
import axiosInstance from '@/utils/network';

export async function getMyInfo(): Promise<MyInfoResponse> {
const response = await axiosInstance.get<MyInfoResponse>(endpoints.myInfo);
return response.data;
}
22 changes: 22 additions & 0 deletions src/assets/backgroundTest.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions src/assets/logo-inset.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions src/components/button/useButtonStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ function useButtonStyle({ variant = 'default' }: UseButtonStyleProps) {
disabledBackgroundColor: globalTheme.colors.primary.passive,
disabledColor: globalTheme.colors.text.subtle,
},
transparent: {
backgroundColor: 'transparent',
color: globalTheme.colors.primary.main,
border: 'none',
hoverBackgroundColor: 'transparent',
hoverColor: globalTheme.colors.primary.darken,
hoverBorderColor: 'none',
disabledBackgroundColor: 'transparent',
disabledColor: globalTheme.colors.text.subtle,
},
};

const styles = variantStyles[variant];
Expand Down
8 changes: 4 additions & 4 deletions src/components/checkbox/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InputHTMLAttributes } from 'react';
import { forwardRef, InputHTMLAttributes } from 'react';
import { CSSObject } from '@emotion/react';
import useCheckboxStyle from '@components/checkbox/useCheckboxStyle';

Expand All @@ -9,12 +9,12 @@ interface RadioProps extends InputHTMLAttributes<HTMLInputElement> {
checked?: boolean;
}

function Radio({ type = 'checkbox', ...rest }: RadioProps) {
const Radio = forwardRef<HTMLInputElement, RadioProps>(({ type = 'checkbox', ...rest }, ref) => {
const { checkboxStyle } = useCheckboxStyle();

return (
<input type={type} css={checkboxStyle} {...rest} />
<input type={type} css={checkboxStyle} ref={ref} {...rest} />
);
}
});

export default Radio;
2 changes: 2 additions & 0 deletions src/components/container/variants/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Container, { ContainerProps } from '@components/container';
import { css } from '@emotion/react';
import { rootWidth } from '@styles/length';

interface DefaultPaddedContainerProps extends ContainerProps {
}
Expand All @@ -13,6 +14,7 @@ export function DefaultPaddedContainer(
flex-direction: column;
align-items: center;
padding: 0 20px;
max-width: ${rootWidth};
`;

return (
Expand Down
32 changes: 19 additions & 13 deletions src/components/footer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
import Container from '@components/container';
import { css } from '@emotion/react';
import logo from '@assets/logo.svg';
import logo from '@assets/logo-inset.svg';
import { rootWidth } from '@styles/length';

function Footer() {
const dividerStyle = css`
color: black;
color: #d3d3d3;
font-size: 15px;
`;
return (
<Container
justify="space-between"
padding="30px 70px"
height="150px"
cssOverride={css`background-color: #f8f8f8;`}
cssOverride={css`background-color: #2c2c2c;`}
>
<img src={logo} alt="logo" css={css`width: 50px;`} />
<Container width="auto" gap="30px">
<div css={dividerStyle}>
kakaotechcampus
</div>
<div css={dividerStyle}>
Team 12
</div>
<Container
width={rootWidth}
justify="flex-end"
padding="20px"
gap="15px"
>
<Container width="auto" direction="column" gap="8px" align="flex-end">
<div css={dividerStyle}>
&copy; 2024, Kakao Tech campus
</div>
<div css={dividerStyle}>
Team 12
</div>
</Container>
<img src={logo} alt="logo" css={css`width: 80px;`} />
</Container>
</Container>
);
Expand Down
80 changes: 42 additions & 38 deletions src/components/header/index.tsx
Original file line number Diff line number Diff line change
@@ -1,65 +1,69 @@
import Container from '@components/container';
import Button from '@components/button';
import Avatar from '@components/avatar';
import { css } from '@emotion/react';
import { css, useTheme } from '@emotion/react';
import logo from '@assets/logo.svg';
import alarm from '@assets/icons/alarm.svg';
import dropDown from '@assets/icons/dropdown.svg';
import { useState } from 'react';
import { rootWidth } from '@styles/length';

function Header() {
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
const theme = useTheme();

const toggleDropdown = () => {
setIsDropdownOpen((prev) => !prev);
};

return (
<Container
justify="space-between"
padding="20px 40px"
height="60px"
cssOverride={css`box-shadow: 0 4px 7px rgba(0, 0, 0, 0.2); position: relative;`}
>
<img
src={logo}
alt="logo"
css={{ width: '75px' }}
/>
<Container cssOverride={css`background-color: ${theme.colors.background.main}; box-shadow: 0 4px 7px rgba(0, 0, 0, 0.1); position: relative;`}>
<Container
width="auto"
gap="20px"
justify="space-between"
padding="20px"
height="60px"
width={rootWidth}
>
<Button css={css`
<img
src={logo}
alt="logo"
css={{ width: '75px' }}
/>
<Container
width="auto"
gap="20px"
>
<Button css={css`
width: 140px;
height: 35px;
font-size:14px;
border-color: #ECEDEE;
`}
>
스터디 생성하기
</Button>
<img src={alarm} alt="alarm" css={{ width: '25px' }} />
<Container
width="auto"
padding="0"
gap="10px"
>
<Avatar
size="small"
css={{ borderRadius: '15px' }}
onClick={toggleDropdown}
/>
<img
src={dropDown}
alt="dropDown"
css={{ width: '10px' }}
onClick={toggleDropdown}
role="presentation"
/>
{isDropdownOpen && (
>
스터디 생성하기
</Button>
<img src={alarm} alt="alarm" css={{ width: '25px' }} />
<Container
width="auto"
padding="0"
gap="10px"
>
<Avatar
size="small"
css={{ borderRadius: '15px' }}
onClick={toggleDropdown}
/>
<img
src={dropDown}
alt="dropDown"
css={{ width: '10px' }}
onClick={toggleDropdown}
role="presentation"
/>
{isDropdownOpen && (
<Dropdown />
)}
)}
</Container>
</Container>
</Container>
</Container>
Expand Down
2 changes: 1 addition & 1 deletion src/components/input/useInputStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function useInputStyle({ enableToggleShow, icon }: UseInputStyleProps) {
css`
padding: 10px ${enableToggleShow ? '34px' : '10px'} 10px ${icon ? '34px' : '10px'};
border-radius: ${theme.corners.small};
border: 1px solid ${theme.colors.border.subtle};
border: 1px solid ${theme.colors.border.prominent};
width: 100%;
box-sizing: border-box;
font-size: 15px;
Expand Down
5 changes: 1 addition & 4 deletions src/components/select/useSelectStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,10 @@ function useSelectStyle() {
const selectStyle = (
css`
outline: none;
border: 1px solid ${theme.colors.border.subtle};
border: 1px solid ${theme.colors.border.prominent};
border-radius: ${theme.corners.small};
height: 30px;
padding: 5px;
&::after {
color: ${theme.colors.text.subtle};
}
`
);

Expand Down
29 changes: 29 additions & 0 deletions src/components/template/Page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import Header from '@components/header';
import Footer from '@components/footer';
import { ReactNode } from 'react';
import Container from '@components/container';
import { useTheme } from '@emotion/react';

interface PageProps {
hideHeader?: boolean;
hideFooter?: boolean;
children?: ReactNode;
}
function Page({ hideHeader, hideFooter, children }: PageProps) {
const theme = useTheme();
return (
<div css={{ backgroundColor: theme.colors.background.darken }}>
{ !hideHeader && (
<Header />
)}
<Container direction="column" justify="flex-start">
{children}
</Container>
{ !hideFooter && (
<Footer />
)}
</div>
);
}

export default Page;
4 changes: 3 additions & 1 deletion src/components/textarea/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ export interface TextareaProps extends HTMLAttributes<HTMLTextAreaElement> {
cols?: number;
maxLength?: number;
resize?: 'vertical' | 'horizontal' | 'none' | 'both';
placeholder?: string;
}

const TextArea = forwardRef<HTMLTextAreaElement, TextareaProps>(({
onChange, label, css, rows = 4, cols = 50, maxLength, resize = 'both', ...rest
onChange, label, css, rows = 4, cols = 50, maxLength, resize = 'both', placeholder = '', ...rest
}, ref) => {
const textareaId = useRef(generateRandomId());
const { textAreaStyle } = useTextAreaStyle({ resize });
Expand All @@ -42,6 +43,7 @@ const TextArea = forwardRef<HTMLTextAreaElement, TextareaProps>(({
maxLength={maxLength}
ref={ref}
onChange={onChange}
placeholder={placeholder}
{...rest}
/>
</>
Expand Down
16 changes: 16 additions & 0 deletions src/constants/endpoints.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const prefix = '/api';

const endpoints = {
myInfo: `${prefix}/users`,
reIssue: `${prefix}/reissue`,
};

const authRequiredEndpoints = {
[endpoints.myInfo]: true,
};

export function isAuthRequired(endpoint?: string) {
return endpoint && endpoint in authRequiredEndpoints;
}

export default endpoints;
9 changes: 5 additions & 4 deletions src/features/main/studyList/StudyItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ function StudyItem(
...singleEllipsis,
whiteSpace: 'normal',
wordBreak: 'break-all',
lineHeight: '16px',
};

return (
Expand All @@ -37,9 +38,9 @@ function StudyItem(
<Container
padding="8px 0"
align="flex-start"
width="175px"
width="150px"
direction="column"
gap="3px"
gap="8px"
cssOverride={singleEllipsis}
>
<Paragraph variant="large" weight="bold" css={{ ...singleEllipsis, width: '100%' }}>{study.name}</Paragraph>
Expand All @@ -50,11 +51,11 @@ function StudyItem(
</Container>
<Tag variant={study.isOpen ? 'primary' : 'default'}>
<Paragraph variant="small">
{study.isOpen ? '모집중' : '모집마감'}
{study.isOpen ? '모집중' : '마감'}
</Paragraph>
</Tag>
</Container>
<Container justify="flex-start" align="flex-start" height="42px" cssOverride={doubleEllipsis}>
<Container justify="flex-start" align="flex-start" height="56px" padding="8px 0 0 0" cssOverride={doubleEllipsis}>
<Paragraph variant="small" css={doubleEllipsis}>{study.description}</Paragraph>
</Container>
<Container padding="12px 0 0 0">
Expand Down
Loading

0 comments on commit 73bd7a9

Please sign in to comment.