Skip to content

Commit

Permalink
Merge pull request #78 from donga-it-club/develop
Browse files Browse the repository at this point in the history
20240324
  • Loading branch information
yanggak12 authored Mar 24, 2024
2 parents 5891036 + faf7c98 commit 6bdc0c6
Show file tree
Hide file tree
Showing 149 changed files with 18,933 additions and 7,664 deletions.
Empty file added .env
Empty file.
3 changes: 1 addition & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ module.exports = {
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:promise/recommended',
'next',
'plugin:prettier/recommended',
'prettier',
],
Expand Down Expand Up @@ -70,7 +69,7 @@ module.exports = {
groups: ['builtin', 'external', 'internal', ['parent', 'sibling', 'index'], 'unknown'],
pathGroups: [
{
pattern: '{next*,next*/**,react*,react*/**}',
pattern: '{react*,react*/**}',
group: 'external',
position: 'before',
},
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,7 @@ sketch
# and uncomment the following lines
# .pnp.*

# build
/dist

# End of https://www.toptal.com/developers/gitignore/api/react,yarn,visualstudiocode
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lint-staged
10 changes: 9 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,13 @@
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "avoid",
"printWidth": 120
"printWidth": 120,
"overrides": [
{
"files": "*.svg",
"options": {
"parser": "html"
}
}
]
}
10 changes: 10 additions & 0 deletions env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// //인터페이스를 통한 타입 추론
// interface ImportMeta {
// env: {
// DEV: boolean;
// MODE: string; //개발모드, 운영모드여부
// SERVER_URL: string; //이런식으로 env 파일에 정의한 내용을 기술~
// HELLO_URL: number; //이런식으로 env 파일에 정의한 내용을 기술~
// WORLD_URL: array; //이런식으로 env 파일에 정의한 내용을 기술~
// };
// }
51 changes: 51 additions & 0 deletions hooks/useCustomToast.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { ReactNode, useMemo } from 'react';
import { useToast, UseToastOptions } from '@chakra-ui/react';
import { getErrorMessage } from '@/api/helper';

export function useCustomToast() {
const toast = useToast({
position: 'top',
duration: 4000,
isClosable: true,
containerStyle: { minWidth: 'unset' },
});

return useMemo(
() => ({
...toast,

info: (description: string) => {
toast({
status: 'info',
colorScheme: 'brand',
description,
});
},
success: (description: string) => {
toast({
status: 'success',
colorScheme: 'success',
description,
});
},
warning: (description: ReactNode, options?: Omit<UseToastOptions, 'status' | 'colorScheme' | 'description'>) => {
return toast({
status: 'warning',
colorScheme: 'accent',
description: description,
...options,
});
},
error: (e: unknown, options?: Omit<UseToastOptions, 'status' | 'colorScheme' | 'title' | 'description'>) => {
return toast({
status: 'error',
colorScheme: 'error',
title: 'Error',
description: getErrorMessage(e),
...options,
});
},
}),
[toast],
);
}
Loading

0 comments on commit 6bdc0c6

Please sign in to comment.