) => {
+ if (event.key === 'Enter') {
+ searchResult.map((data) => {
+ if (data === keyword) {
+ setShowDropDown(false);
+ event.currentTarget.blur();
+ setGiftReqData({
+ ownerId: data,
+ });
+ }
+ });
+ }
+ };
+
return (
{
- const setModal = useSetRecoilState(modalState);
- const setError = useSetRecoilState(errorState);
- const updateCoin = useSetRecoilState(updateCoinState);
-
- const onPurchase = async () => {
- try {
- await instance.post(
- `/pingpong/items/purchases/${purchasedItem.itemId}`,
- null
- );
- alert(`구매 성공!`);
- updateCoin(true);
- } catch (error) {
- setError('HB03');
- }
- setModal({ modalName: null });
- };
-
- const onCancel = () => {
- setModal({ modalName: null });
- };
-
- return { onPurchase, onCancel };
-};
-
-export default useBuyModal;
diff --git a/hooks/modal/store/purchase/useGiftModal.ts b/hooks/modal/store/purchase/useGiftModal.ts
deleted file mode 100644
index 781b9039e..000000000
--- a/hooks/modal/store/purchase/useGiftModal.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import { useSetRecoilState } from 'recoil';
-import { Gift, GiftRequest } from 'types/itemTypes';
-import { instance } from 'utils/axios';
-import { errorState } from 'utils/recoil/error';
-import { modalState } from 'utils/recoil/modal';
-import { updateCoinState } from 'utils/recoil/updateCoin';
-
-const useGiftModal = (gift: Gift) => {
- const setModal = useSetRecoilState(modalState);
- const setError = useSetRecoilState(errorState);
- const updateCoin = useSetRecoilState(updateCoinState);
- const data: GiftRequest = {
- ownerId: gift.ownerId,
- };
-
- const onPurchase = async () => {
- if (gift.ownerId === '') {
- alert('선물할 유저를 선택해주세요.');
- return;
- }
- try {
- const res = await instance.post(
- `/pingpong/items/gift/${gift.itemId}`,
- data
- );
- if (res.status === 201) {
- alert(`${gift.ownerId}님께 선물이 전달되었습니다.`);
- updateCoin(true);
- }
- } catch (error) {
- setError('HB02');
- }
- setModal({ modalName: null });
- };
-
- const onCancel = () => {
- setModal({ modalName: null });
- };
-
- return { onPurchase, onCancel };
-};
-
-export default useGiftModal;
diff --git a/stories/store/BuyModal.stories.tsx b/stories/store/BuyModal.stories.tsx
new file mode 100644
index 000000000..9ca980606
--- /dev/null
+++ b/stories/store/BuyModal.stories.tsx
@@ -0,0 +1,20 @@
+import type { Meta, StoryObj } from '@storybook/react';
+import BuyModal from 'components/modal/store/purchase/BuyModal';
+
+const meta: Meta = {
+ title: 'Modal/BuyModal',
+ component: BuyModal,
+ tags: ['autodocs'],
+ argTypes: {},
+};
+
+export default meta;
+type Story = StoryObj;
+
+export const Default: Story = {
+ args: {
+ itemId: 1,
+ product: '프사 변경',
+ price: 84,
+ },
+};
diff --git a/stories/store/CoinHistoryModal.stories.tsx b/stories/store/CoinHistoryModal.stories.tsx
new file mode 100644
index 000000000..62de03ab7
--- /dev/null
+++ b/stories/store/CoinHistoryModal.stories.tsx
@@ -0,0 +1,18 @@
+import type { Meta, StoryObj } from '@storybook/react';
+import UserCoinHistoryModal from 'components/modal/store/UserCoinHistoryModal';
+
+const meta: Meta = {
+ title: 'Modal/UserCoinHistoryModal',
+ component: UserCoinHistoryModal,
+ tags: ['autodocs'],
+ argTypes: {},
+};
+
+export default meta;
+type Story = StoryObj;
+
+export const Default: Story = {
+ args: {
+ coin: 100,
+ },
+};
diff --git a/stories/store/GiftModal.stories.tsx b/stories/store/GiftModal.stories.tsx
new file mode 100644
index 000000000..a2622b9ef
--- /dev/null
+++ b/stories/store/GiftModal.stories.tsx
@@ -0,0 +1,20 @@
+import type { Meta, StoryObj } from '@storybook/react';
+import GiftModal from 'components/modal/store/purchase/GiftModal';
+
+const meta: Meta = {
+ title: 'Modal/GiftModal',
+ component: GiftModal,
+ tags: ['autodocs'],
+ argTypes: {},
+};
+
+export default meta;
+type Story = StoryObj;
+
+export const Default: Story = {
+ args: {
+ itemId: 1,
+ product: '프사 변경',
+ price: 84,
+ },
+};
diff --git a/styles/common.scss b/styles/common.scss
index d8b04153c..2281da97a 100644
--- a/styles/common.scss
+++ b/styles/common.scss
@@ -339,6 +339,13 @@ $text-shadow-blue: 2px 2px 0px $pp-blue;
}
}
+@mixin waitAnimation($delay) {
+ @include spanUpDownAnimation(0.2rem, 0.2rem);
+ position: relative;
+ display: inline-block;
+ animation-delay: $delay;
+}
+
@mixin modalButton {
display: flex;
justify-content: center;
diff --git a/styles/modal/LoadingButton.module.scss b/styles/modal/LoadingButton.module.scss
new file mode 100644
index 000000000..89b2648ea
--- /dev/null
+++ b/styles/modal/LoadingButton.module.scss
@@ -0,0 +1,25 @@
+@import 'styles/common.scss';
+
+.loadingButton {
+ display: flex;
+ width: 8rem;
+ height: 2.5rem;
+ font-size: 0.9rem;
+ color: rgba(255, 255, 255, 1);
+ background: linear-gradient(180deg, #c66bf2 0%, rgba(96, 6, 138, 0.52) 100%);
+ border: 0;
+ border-radius: 0.625rem;
+ justify-content: center;
+ align-items: center;
+ .loading {
+ .span1 {
+ @include waitAnimation(0.3s);
+ }
+ .span2 {
+ @include waitAnimation(0.5s);
+ }
+ .span3 {
+ @include waitAnimation(0.7s);
+ }
+ }
+}
diff --git a/styles/modal/store/CoinHistoryContainer.module.scss b/styles/modal/store/CoinHistoryContainer.module.scss
index 45bfd67be..f941720fa 100644
--- a/styles/modal/store/CoinHistoryContainer.module.scss
+++ b/styles/modal/store/CoinHistoryContainer.module.scss
@@ -7,11 +7,16 @@
flex-direction: column;
padding-top: 1rem;
overflow-y: scroll;
- border-top: 1px solid #3b363b36;
.empty {
display: flex;
- justify-content: center;
+ flex-direction: column;
font-size: 1.2rem;
color: $gray;
+ div {
+ margin: 2rem auto;
+ }
+ svg {
+ margin: 1.5rem auto;
+ }
}
}
diff --git a/styles/modal/store/UserCoinHistoryModal.module.scss b/styles/modal/store/UserCoinHistoryModal.module.scss
index 4815d651a..c619a94f2 100644
--- a/styles/modal/store/UserCoinHistoryModal.module.scss
+++ b/styles/modal/store/UserCoinHistoryModal.module.scss
@@ -16,12 +16,31 @@
.balance {
display: flex;
width: 80%;
+ padding-bottom: 0.5rem;
margin-bottom: 0.5rem;
font-size: 1.3rem;
color: #ffffff;
+ border-bottom: 1px solid #3b363b36;
justify-content: space-between;
.current {
padding-top: 0.35rem;
}
}
+
+ .loading {
+ margin: 5rem 0;
+ color: #ffffff;
+ .span1 {
+ @include waitAnimation(0.3s);
+ font-size: 1.8rem;
+ }
+ .span2 {
+ @include waitAnimation(0.5s);
+ font-size: 1.8rem;
+ }
+ .span3 {
+ @include waitAnimation(0.7s);
+ font-size: 1.8rem;
+ }
+ }
}