Skip to content

Commit

Permalink
fix: toast type 수정 (normal -> warning)
Browse files Browse the repository at this point in the history
  • Loading branch information
gxxrxn committed May 23, 2024
1 parent 2015856 commit 6cf533f
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 17 deletions.
5 changes: 2 additions & 3 deletions src/app/bookshelf/[bookshelfId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,13 @@ const BookShelfInfo = ({ bookshelfId }: { bookshelfId: number }) => {

const handleClickLikeButton = () => {
if (!isAuthenticated) {
showToast({ message: '로그인 후 이용해주세요.', type: 'normal' });
showToast({ message: '로그인 후 이용해주세요' });
return;
}

if (userId === myId) {
showToast({
message: '내 책장에는 좋아요를 누를 수 없어요.',
type: 'normal',
message: '내 책장에는 좋아요를 누를 수 없어요',
});
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/group/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ const GroupPage = () => {
const isAuthenticated = checkAuthentication();

const handleSearchInputClick = () => {
showToast({ message: '아직 준비 중인 기능이에요 🥹', type: 'normal' });
showToast({ message: '아직 준비 중인 기능이에요 🥹' });
};

const handleCreateGroupClick = () => {
if (isAuthenticated) {
router.push('/group/create');
} else {
showToast({ message: '로그인 후에 이용할 수 있어요!', type: 'normal' });
showToast({ message: '로그인 후 이용해주세요' });
}

return;
Expand Down
8 changes: 4 additions & 4 deletions src/stories/base/Toast.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ export default meta;

type Story = StoryObj<typeof ToastItem>;

const NormalToast = () => {
const WarningToast = () => {
const toast = useToast();
const handleButtonClick = () =>
toast.show({
type: 'normal',
type: 'warning',
message: '5초 동안 보여지는 토스트 메세지에요.',
duration: 5000,
});
Expand Down Expand Up @@ -48,15 +48,15 @@ export const Default: Story = {
},
render: args => (
<div className="flex flex-col gap-[1rem]">
<ToastItem type="normal" {...args} />
<ToastItem type="warning" {...args} />
<ToastItem type="error" {...args} />
<ToastItem type="success" {...args} />
</div>
),
};

export const Normal: Story = {
render: NormalToast,
render: WarningToast,
};

export const Success: Story = {
Expand Down
2 changes: 1 addition & 1 deletion src/v1/base/ShareButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const ShareButton = () => {
navigator.clipboard
.writeText(url)
.then(() => {
showToast({ message: '링크를 복사했어요.', type: 'success' });
showToast({ message: '링크를 복사했어요', type: 'success' });
})
.catch(() => {
showToast({ message: '잠시 후 다시 시도해주세요', type: 'error' });
Expand Down
4 changes: 2 additions & 2 deletions src/v1/base/Toast/ToastItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { ToastOption } from './types';
const ICONS = {
success: <IconSuccess />,
error: <IconError />,
normal: <IconWarning />,
warning: <IconWarning />,
} as const;

const ToastItem = ({ type = 'normal', message }: ToastOption) => {
const ToastItem = ({ type = 'warning', message }: ToastOption) => {
const icon = ICONS[type];

return (
Expand Down
2 changes: 1 addition & 1 deletion src/v1/base/Toast/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type ToastType = 'normal' | 'success' | 'error';
export type ToastType = 'warning' | 'success' | 'error';

export type ToastOption = {
type?: ToastType;
Expand Down
2 changes: 1 addition & 1 deletion src/v1/book/detail/BookInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const BookmarkButton = ({ bookId }: { bookId: APIBook['bookId'] }) => {
const handleButtonClick = () => {
if (!isAuthenticated) {
// TODO: 로그인 유도 모달로 변경
showToast({ type: 'normal', message: '로그인 후에 책을 꽂을 수 있어요' });
showToast({ message: '로그인 후에 책을 꽂을 수 있어요' });
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/v1/profile/AddJobProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const AddJobProfile = ({ jobCategories }: AddJobProfileProps) => {
const showToastEditFailed = () =>
toast.show({
type: 'error',
message: '잠시 후 다시 시도해 주세요.',
message: '잠시 후 다시 시도해 주세요',
duration: 3000,
});

Expand Down
4 changes: 2 additions & 2 deletions src/v1/profile/EditProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ const EditProfile = ({ profile, jobGroups }: UserProfileProps) => {
const showToastEditSuccess = () =>
toast.show({
type: 'success',
message: '프로필 수정 완료!',
message: '프로필을 수정했어요',
duration: 3000,
});

const showToastEditFailed = () =>
toast.show({
type: 'error',
message: '알 수 없는 에러가 발생했어요.',
message: '잠시 후 다시 시도해주세요',
duration: 3000,
});

Expand Down

0 comments on commit 6cf533f

Please sign in to comment.