-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
35 changed files
with
1,604 additions
and
200 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,28 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es2021": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:react/recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"overrides": [], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
"sourceType": "module" | ||
}, | ||
"plugins": ["react", "@typescript-eslint"], | ||
"rules": { | ||
"no-unused-vars": "off", | ||
"@typescript-eslint/no-unused-vars": "warn", | ||
"@typescript-eslint/no-explicit-any": "off" | ||
}, | ||
"settings": { | ||
"react": { | ||
"version": "detect" | ||
} | ||
} | ||
} |
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,5 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npx lint-staged | ||
npx lint-staged |
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,8 @@ | ||
{ | ||
"singleQuote": true, | ||
"semi": true, | ||
"useTabs": false, | ||
"tabWidth": 2, | ||
"trailingComma": "all", | ||
"printWidth": 100 | ||
} |
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 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
File renamed without changes.
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,10 +1,10 @@ | ||
import React from 'react'; | ||
import Login from './auth/login/page'; | ||
import Welcome from '@/components/layout/Welcome'; | ||
|
||
export default async function HomePage() { | ||
return ( | ||
<section> | ||
<Login /> | ||
<Welcome /> | ||
</section> | ||
); | ||
} |
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 React from 'react'; | ||
|
||
const Signup = () => { | ||
return <div>Signup</div>; | ||
}; | ||
|
||
export default Signup; |
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 @@ | ||
'use client'; | ||
import Image from 'next/image'; | ||
import Link from 'next/link'; | ||
import React from 'react'; | ||
import { styled } from 'styled-components'; | ||
import logo from '@/public/static/images/logo.png'; | ||
|
||
const Header = () => { | ||
return ( | ||
<Container> | ||
<Link href={'/'}> | ||
<Image src={logo} alt="logo" width={141} height={49} /> | ||
</Link> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default Header; | ||
|
||
const Container = styled.header` | ||
width: 100vw; | ||
height: 80px; | ||
display: flex; | ||
padding: 16px 30px 16px 40px; | ||
box-sizing: border-box; | ||
box-shadow: 0 4px 20px 0 rgba(178, 178, 178, 0.15); | ||
`; |
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,25 @@ | ||
'use client'; | ||
import React, { FC } from 'react'; | ||
import { styled } from 'styled-components'; | ||
|
||
type Props = { | ||
children: React.ReactNode; | ||
}; | ||
|
||
/** | ||
* 메인 레이아웃 | ||
* @param children: 자식 컴포넌트 | ||
*/ | ||
const Main: FC<Props> = ({ children }) => { | ||
return <Container>{children}</Container>; | ||
}; | ||
|
||
export default Main; | ||
|
||
const Container = styled.main` | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
width: 100vw; | ||
height: calc(100vh - 80px); | ||
`; |
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,37 @@ | ||
'use client'; | ||
import Image from 'next/image'; | ||
import React from 'react'; | ||
import logo from '@/public/static/images/logo_big.png'; | ||
import styled from 'styled-components'; | ||
import Button from '../ui/Button'; | ||
import { useRouter } from 'next/navigation'; | ||
|
||
/** | ||
* 시작하기 페이지 | ||
*/ | ||
const Welcome = () => { | ||
const router = useRouter(); | ||
|
||
/** | ||
* 시작하기 버튼 클릭 시 로그인 페이지로 이동 | ||
*/ | ||
const handleStart = () => { | ||
router.push('/login'); | ||
}; | ||
|
||
return ( | ||
<Container> | ||
<Image src={logo} alt="logo" width={442} height={88} /> | ||
<Button text="시작하기" onClick={handleStart} theme={'white'} /> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default Welcome; | ||
|
||
const Container = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
gap: 40px; | ||
`; |
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,13 +1,76 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
interface IButtonProps { | ||
text: string; | ||
onClick: () => void; | ||
disabled?: boolean; | ||
theme?: string; | ||
} | ||
|
||
export default function Button({ text, onClick, disabled = false }: IButtonProps) { | ||
export default function Button({ text, onClick, disabled = false, theme = '' }: IButtonProps) { | ||
return ( | ||
<button onClick={() => onClick()} disabled={disabled}> | ||
<StyledButton onClick={() => onClick()} disabled={disabled} theme={theme}> | ||
{text} | ||
</button> | ||
</StyledButton> | ||
); | ||
} | ||
|
||
const StyledButton = styled.button<{ theme: string }>` | ||
width: 350px; | ||
height: 55px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
border-radius: 5px; | ||
border-width: 2px; | ||
border-style: solid; | ||
cursor: pointer; | ||
font-size: 17px; | ||
font-weight: 500; | ||
${(props) => { | ||
switch (props.theme) { | ||
case 'white': | ||
return ` | ||
border-color: #FF9048; | ||
background-color: #ffffff; | ||
color: #FF9048; | ||
&:hover { | ||
border-color: #FF9048; | ||
background-color: #FF9048; | ||
color: #ffffff; | ||
} | ||
`; | ||
case 'orange': | ||
return ` | ||
border-color: #FF9048; | ||
background-color: #FF9048; | ||
color: #ffffff; | ||
&:hover { | ||
border-color: #FF9048; | ||
background-color: #ffffff; | ||
color: #FF9048; | ||
} | ||
`; | ||
case 'google': | ||
return ` | ||
border-color: #FFFFFF; | ||
background-color: #00ff00; | ||
color: #3C3C3C; | ||
`; | ||
case 'text': | ||
return ` | ||
border: none; | ||
background-color: transparent; | ||
color: #A99F9F; | ||
width: fit-content; | ||
height: fit-content; | ||
`; | ||
default: | ||
return ` | ||
background-color: #cccccc; | ||
color: #000000; | ||
`; | ||
} | ||
}} | ||
`; |
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,38 @@ | ||
import axios, { AxiosError, AxiosRequestConfig } from 'axios'; | ||
import { useEffect, useRef, useState } from 'react'; | ||
|
||
const API_BASE_URL = `${process.env.NEXT_PUBLIC_API_BASE_URL}`; | ||
axios.defaults.baseURL = API_BASE_URL; | ||
|
||
/** | ||
* axios 커스텀 훅 | ||
* @param axiosParams: axios 요청 데이터 | ||
* @author 안가을 | ||
*/ | ||
export const useAxios = <T, D = any>(axiosParams: AxiosRequestConfig<D>) => { | ||
const [response, setResponse] = useState<T | null>(null); | ||
const [error, setError] = useState<AxiosError | unknown>(); | ||
const [loading, setLoading] = useState(true); | ||
const controllerRef = useRef(new AbortController()); | ||
const cancelRequest = () => controllerRef.current.abort(); | ||
|
||
const fetchData = async (params: AxiosRequestConfig<D>) => { | ||
try { | ||
const result = await axios.request<T>({ | ||
...params, | ||
signal: controllerRef.current.signal, | ||
}); | ||
setResponse(result.data); | ||
} catch (err: AxiosError | unknown) { | ||
setError(err); | ||
} finally { | ||
setLoading(false); | ||
} | ||
}; | ||
|
||
useEffect(() => { | ||
fetchData(axiosParams); | ||
}, [axiosParams]); | ||
|
||
return { cancelRequest, response, error, loading }; | ||
}; |
Oops, something went wrong.