diff --git a/.pnp.cjs b/.pnp.cjs index 0ed6e791..af6faab2 100755 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -28,6 +28,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@hookform/devtools", "virtual:74868250102727df59d0c08f1ddb6630e6cd48640d8ad9d1ed80f220eee5d95c37bdc80e67cbbd686a520d72c8276bea707c0a77572e4e760d1051e7254c23b3#npm:4.3.1"],\ ["@radix-ui/react-icons", "virtual:74868250102727df59d0c08f1ddb6630e6cd48640d8ad9d1ed80f220eee5d95c37bdc80e67cbbd686a520d72c8276bea707c0a77572e4e760d1051e7254c23b3#npm:1.3.0"],\ + ["@radix-ui/react-portal", "virtual:74868250102727df59d0c08f1ddb6630e6cd48640d8ad9d1ed80f220eee5d95c37bdc80e67cbbd686a520d72c8276bea707c0a77572e4e760d1051e7254c23b3#npm:1.0.4"],\ ["@radix-ui/react-tabs", "virtual:74868250102727df59d0c08f1ddb6630e6cd48640d8ad9d1ed80f220eee5d95c37bdc80e67cbbd686a520d72c8276bea707c0a77572e4e760d1051e7254c23b3#npm:1.0.4"],\ ["@sentry/nextjs", "virtual:74868250102727df59d0c08f1ddb6630e6cd48640d8ad9d1ed80f220eee5d95c37bdc80e67cbbd686a520d72c8276bea707c0a77572e4e760d1051e7254c23b3#npm:7.91.0"],\ ["@sentry/utils", "npm:7.91.0"],\ @@ -5915,7 +5916,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@radix-ui/react-arrow", "virtual:69770189d9e91adf1e2cac02abe339958e8b08e5b59aec6b226955e1a9b141bcf5facf290e3dc02c88c9102190575c83d61bcb5d32a525a5be32a4f9f5df32f7#npm:1.0.3"],\ ["@babel/runtime", "npm:7.23.4"],\ - ["@radix-ui/react-primitive", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.3"],\ + ["@radix-ui/react-primitive", "virtual:63796dde4d35fa6a36aa1ca5dac46228f7e1ca443177d9cf89a8139812dd271d8d26ea1fdd1b294bc8a8d40291eb4ff194e82b382e9caf4b8f03a6bad0151e7a#npm:1.0.3"],\ ["@types/react", "npm:18.2.37"],\ ["@types/react-dom", "npm:18.2.15"],\ ["react", "npm:18.2.0"],\ @@ -5943,10 +5944,10 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@radix-ui/react-collection", "virtual:85876a5d6296666ae7a86a407a1bc1132ad4356094bd396f920afd220f67b0f434f195dcae24ca0598af27a0153db02c5ceab2b57c587b511096bfe9aef91660#npm:1.0.3"],\ ["@babel/runtime", "npm:7.23.4"],\ - ["@radix-ui/react-compose-refs", "virtual:e7789d651dfd1851f2b426e285cfe7e57b9f2ab5ce27abef8f38dc98f0935f73268c2428d150b58c015f098f1c638a5712234411891b079a705a2085a55240fa#npm:1.0.1"],\ + ["@radix-ui/react-compose-refs", "virtual:f2d8f8743469d83163f71f8b2230a298b16a1e7c8e66453fedf61c46f937f123e8eb5bbdbbc0e0726eedbc62ea2a19b1bfe875ad55818ec32abac19959357e09#npm:1.0.1"],\ ["@radix-ui/react-context", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.1"],\ - ["@radix-ui/react-primitive", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.3"],\ - ["@radix-ui/react-slot", "virtual:077b407c90001b73813b3e73d3504c0b0a6e865cc0a1514c15ecdf8ca2c969293f71408963df9eab2c2ad0f6fc5345246293dfd58b6ed05be7ff4b5b41a7d9d2#npm:1.0.2"],\ + ["@radix-ui/react-primitive", "virtual:63796dde4d35fa6a36aa1ca5dac46228f7e1ca443177d9cf89a8139812dd271d8d26ea1fdd1b294bc8a8d40291eb4ff194e82b382e9caf4b8f03a6bad0151e7a#npm:1.0.3"],\ + ["@radix-ui/react-slot", "virtual:90ab930ccab92e3a39a298b50266285b96cd528144bf5bc1be5558c0117a148075649eb27ff3f52a5a6a78444d701355c13c01a30646f03812f315f8693ef5a9#npm:1.0.2"],\ ["@types/react", "npm:18.2.37"],\ ["@types/react-dom", "npm:18.2.15"],\ ["react", "npm:18.2.0"],\ @@ -5969,10 +5970,10 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "SOFT"\ }],\ - ["virtual:e7789d651dfd1851f2b426e285cfe7e57b9f2ab5ce27abef8f38dc98f0935f73268c2428d150b58c015f098f1c638a5712234411891b079a705a2085a55240fa#npm:1.0.1", {\ - "packageLocation": "./.yarn/__virtual__/@radix-ui-react-compose-refs-virtual-283ea3c6e1/0/cache/@radix-ui-react-compose-refs-npm-1.0.1-02d1046f7d-10c0.zip/node_modules/@radix-ui/react-compose-refs/",\ + ["virtual:f2d8f8743469d83163f71f8b2230a298b16a1e7c8e66453fedf61c46f937f123e8eb5bbdbbc0e0726eedbc62ea2a19b1bfe875ad55818ec32abac19959357e09#npm:1.0.1", {\ + "packageLocation": "./.yarn/__virtual__/@radix-ui-react-compose-refs-virtual-0f1b1030ce/0/cache/@radix-ui-react-compose-refs-npm-1.0.1-02d1046f7d-10c0.zip/node_modules/@radix-ui/react-compose-refs/",\ "packageDependencies": [\ - ["@radix-ui/react-compose-refs", "virtual:e7789d651dfd1851f2b426e285cfe7e57b9f2ab5ce27abef8f38dc98f0935f73268c2428d150b58c015f098f1c638a5712234411891b079a705a2085a55240fa#npm:1.0.1"],\ + ["@radix-ui/react-compose-refs", "virtual:f2d8f8743469d83163f71f8b2230a298b16a1e7c8e66453fedf61c46f937f123e8eb5bbdbbc0e0726eedbc62ea2a19b1bfe875ad55818ec32abac19959357e09#npm:1.0.1"],\ ["@babel/runtime", "npm:7.23.4"],\ ["@types/react", "npm:18.2.37"],\ ["react", "npm:18.2.0"]\ @@ -6044,8 +6045,8 @@ const RAW_RUNTIME_STATE = ["@radix-ui/react-dismissable-layer", "virtual:1912b8abc724f76d62b3958334c9dbc4c679732064572ab5528cd01bacac6018e0db2a6e8ab39764b438ed1e2f61d83b8a839ee8ef5cd78828aede0046ceadc0#npm:1.0.4"],\ ["@babel/runtime", "npm:7.23.4"],\ ["@radix-ui/primitive", "npm:1.0.1"],\ - ["@radix-ui/react-compose-refs", "virtual:e7789d651dfd1851f2b426e285cfe7e57b9f2ab5ce27abef8f38dc98f0935f73268c2428d150b58c015f098f1c638a5712234411891b079a705a2085a55240fa#npm:1.0.1"],\ - ["@radix-ui/react-primitive", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.3"],\ + ["@radix-ui/react-compose-refs", "virtual:f2d8f8743469d83163f71f8b2230a298b16a1e7c8e66453fedf61c46f937f123e8eb5bbdbbc0e0726eedbc62ea2a19b1bfe875ad55818ec32abac19959357e09#npm:1.0.1"],\ + ["@radix-ui/react-primitive", "virtual:63796dde4d35fa6a36aa1ca5dac46228f7e1ca443177d9cf89a8139812dd271d8d26ea1fdd1b294bc8a8d40291eb4ff194e82b382e9caf4b8f03a6bad0151e7a#npm:1.0.3"],\ ["@radix-ui/react-use-callback-ref", "virtual:85876a5d6296666ae7a86a407a1bc1132ad4356094bd396f920afd220f67b0f434f195dcae24ca0598af27a0153db02c5ceab2b57c587b511096bfe9aef91660#npm:1.0.1"],\ ["@radix-ui/react-use-escape-keydown", "virtual:2adfb1a81a54f3ec70ccaa1339be74207a9ae33de34f3c7d3099ea423d617c1c73b6328af02379368e8c2b3ede38c375118c3abfc1f2d68b187becffe2afe332#npm:1.0.3"],\ ["@types/react", "npm:18.2.37"],\ @@ -6098,8 +6099,8 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@radix-ui/react-focus-scope", "virtual:1912b8abc724f76d62b3958334c9dbc4c679732064572ab5528cd01bacac6018e0db2a6e8ab39764b438ed1e2f61d83b8a839ee8ef5cd78828aede0046ceadc0#npm:1.0.3"],\ ["@babel/runtime", "npm:7.23.4"],\ - ["@radix-ui/react-compose-refs", "virtual:e7789d651dfd1851f2b426e285cfe7e57b9f2ab5ce27abef8f38dc98f0935f73268c2428d150b58c015f098f1c638a5712234411891b079a705a2085a55240fa#npm:1.0.1"],\ - ["@radix-ui/react-primitive", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.3"],\ + ["@radix-ui/react-compose-refs", "virtual:f2d8f8743469d83163f71f8b2230a298b16a1e7c8e66453fedf61c46f937f123e8eb5bbdbbc0e0726eedbc62ea2a19b1bfe875ad55818ec32abac19959357e09#npm:1.0.1"],\ + ["@radix-ui/react-primitive", "virtual:63796dde4d35fa6a36aa1ca5dac46228f7e1ca443177d9cf89a8139812dd271d8d26ea1fdd1b294bc8a8d40291eb4ff194e82b382e9caf4b8f03a6bad0151e7a#npm:1.0.3"],\ ["@radix-ui/react-use-callback-ref", "virtual:85876a5d6296666ae7a86a407a1bc1132ad4356094bd396f920afd220f67b0f434f195dcae24ca0598af27a0153db02c5ceab2b57c587b511096bfe9aef91660#npm:1.0.1"],\ ["@types/react", "npm:18.2.37"],\ ["@types/react-dom", "npm:18.2.15"],\ @@ -6176,9 +6177,9 @@ const RAW_RUNTIME_STATE = ["@babel/runtime", "npm:7.23.4"],\ ["@floating-ui/react-dom", "virtual:69770189d9e91adf1e2cac02abe339958e8b08e5b59aec6b226955e1a9b141bcf5facf290e3dc02c88c9102190575c83d61bcb5d32a525a5be32a4f9f5df32f7#npm:2.0.4"],\ ["@radix-ui/react-arrow", "virtual:69770189d9e91adf1e2cac02abe339958e8b08e5b59aec6b226955e1a9b141bcf5facf290e3dc02c88c9102190575c83d61bcb5d32a525a5be32a4f9f5df32f7#npm:1.0.3"],\ - ["@radix-ui/react-compose-refs", "virtual:e7789d651dfd1851f2b426e285cfe7e57b9f2ab5ce27abef8f38dc98f0935f73268c2428d150b58c015f098f1c638a5712234411891b079a705a2085a55240fa#npm:1.0.1"],\ + ["@radix-ui/react-compose-refs", "virtual:f2d8f8743469d83163f71f8b2230a298b16a1e7c8e66453fedf61c46f937f123e8eb5bbdbbc0e0726eedbc62ea2a19b1bfe875ad55818ec32abac19959357e09#npm:1.0.1"],\ ["@radix-ui/react-context", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.1"],\ - ["@radix-ui/react-primitive", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.3"],\ + ["@radix-ui/react-primitive", "virtual:63796dde4d35fa6a36aa1ca5dac46228f7e1ca443177d9cf89a8139812dd271d8d26ea1fdd1b294bc8a8d40291eb4ff194e82b382e9caf4b8f03a6bad0151e7a#npm:1.0.3"],\ ["@radix-ui/react-use-callback-ref", "virtual:85876a5d6296666ae7a86a407a1bc1132ad4356094bd396f920afd220f67b0f434f195dcae24ca0598af27a0153db02c5ceab2b57c587b511096bfe9aef91660#npm:1.0.1"],\ ["@radix-ui/react-use-layout-effect", "virtual:c1cdfbcfb0754cffde491f3d979f44e9565e6fd10c4a2425d4299c8a3b46e31357efdc2a1d1e9ac1a97c5013652de8a178015cf78f241274fd2663833c5b12d3#npm:1.0.1"],\ ["@radix-ui/react-use-rect", "virtual:69770189d9e91adf1e2cac02abe339958e8b08e5b59aec6b226955e1a9b141bcf5facf290e3dc02c88c9102190575c83d61bcb5d32a525a5be32a4f9f5df32f7#npm:1.0.1"],\ @@ -6206,12 +6207,38 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "SOFT"\ }],\ + ["npm:1.0.4", {\ + "packageLocation": "./.yarn/cache/@radix-ui-react-portal-npm-1.0.4-e4c93f6e90-10c0.zip/node_modules/@radix-ui/react-portal/",\ + "packageDependencies": [\ + ["@radix-ui/react-portal", "npm:1.0.4"]\ + ],\ + "linkType": "SOFT"\ + }],\ ["virtual:1912b8abc724f76d62b3958334c9dbc4c679732064572ab5528cd01bacac6018e0db2a6e8ab39764b438ed1e2f61d83b8a839ee8ef5cd78828aede0046ceadc0#npm:1.0.3", {\ "packageLocation": "./.yarn/__virtual__/@radix-ui-react-portal-virtual-e1a19b7c4e/0/cache/@radix-ui-react-portal-npm-1.0.3-4c59d6f96d-10c0.zip/node_modules/@radix-ui/react-portal/",\ "packageDependencies": [\ ["@radix-ui/react-portal", "virtual:1912b8abc724f76d62b3958334c9dbc4c679732064572ab5528cd01bacac6018e0db2a6e8ab39764b438ed1e2f61d83b8a839ee8ef5cd78828aede0046ceadc0#npm:1.0.3"],\ ["@babel/runtime", "npm:7.23.4"],\ - ["@radix-ui/react-primitive", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.3"],\ + ["@radix-ui/react-primitive", "virtual:63796dde4d35fa6a36aa1ca5dac46228f7e1ca443177d9cf89a8139812dd271d8d26ea1fdd1b294bc8a8d40291eb4ff194e82b382e9caf4b8f03a6bad0151e7a#npm:1.0.3"],\ + ["@types/react", "npm:18.2.37"],\ + ["@types/react-dom", "npm:18.2.15"],\ + ["react", "npm:18.2.0"],\ + ["react-dom", "virtual:74868250102727df59d0c08f1ddb6630e6cd48640d8ad9d1ed80f220eee5d95c37bdc80e67cbbd686a520d72c8276bea707c0a77572e4e760d1051e7254c23b3#npm:18.2.0"]\ + ],\ + "packagePeers": [\ + "@types/react-dom",\ + "@types/react",\ + "react-dom",\ + "react"\ + ],\ + "linkType": "HARD"\ + }],\ + ["virtual:74868250102727df59d0c08f1ddb6630e6cd48640d8ad9d1ed80f220eee5d95c37bdc80e67cbbd686a520d72c8276bea707c0a77572e4e760d1051e7254c23b3#npm:1.0.4", {\ + "packageLocation": "./.yarn/__virtual__/@radix-ui-react-portal-virtual-63796dde4d/0/cache/@radix-ui-react-portal-npm-1.0.4-e4c93f6e90-10c0.zip/node_modules/@radix-ui/react-portal/",\ + "packageDependencies": [\ + ["@radix-ui/react-portal", "virtual:74868250102727df59d0c08f1ddb6630e6cd48640d8ad9d1ed80f220eee5d95c37bdc80e67cbbd686a520d72c8276bea707c0a77572e4e760d1051e7254c23b3#npm:1.0.4"],\ + ["@babel/runtime", "npm:7.23.4"],\ + ["@radix-ui/react-primitive", "virtual:63796dde4d35fa6a36aa1ca5dac46228f7e1ca443177d9cf89a8139812dd271d8d26ea1fdd1b294bc8a8d40291eb4ff194e82b382e9caf4b8f03a6bad0151e7a#npm:1.0.3"],\ ["@types/react", "npm:18.2.37"],\ ["@types/react-dom", "npm:18.2.15"],\ ["react", "npm:18.2.0"],\ @@ -6239,7 +6266,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@radix-ui/react-presence", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.1"],\ ["@babel/runtime", "npm:7.23.4"],\ - ["@radix-ui/react-compose-refs", "virtual:e7789d651dfd1851f2b426e285cfe7e57b9f2ab5ce27abef8f38dc98f0935f73268c2428d150b58c015f098f1c638a5712234411891b079a705a2085a55240fa#npm:1.0.1"],\ + ["@radix-ui/react-compose-refs", "virtual:f2d8f8743469d83163f71f8b2230a298b16a1e7c8e66453fedf61c46f937f123e8eb5bbdbbc0e0726eedbc62ea2a19b1bfe875ad55818ec32abac19959357e09#npm:1.0.1"],\ ["@radix-ui/react-use-layout-effect", "virtual:c1cdfbcfb0754cffde491f3d979f44e9565e6fd10c4a2425d4299c8a3b46e31357efdc2a1d1e9ac1a97c5013652de8a178015cf78f241274fd2663833c5b12d3#npm:1.0.1"],\ ["@types/react", "npm:18.2.37"],\ ["@types/react-dom", "npm:18.2.15"],\ @@ -6263,12 +6290,12 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "SOFT"\ }],\ - ["virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.3", {\ - "packageLocation": "./.yarn/__virtual__/@radix-ui-react-primitive-virtual-077b407c90/0/cache/@radix-ui-react-primitive-npm-1.0.3-1983a5adc0-10c0.zip/node_modules/@radix-ui/react-primitive/",\ + ["virtual:63796dde4d35fa6a36aa1ca5dac46228f7e1ca443177d9cf89a8139812dd271d8d26ea1fdd1b294bc8a8d40291eb4ff194e82b382e9caf4b8f03a6bad0151e7a#npm:1.0.3", {\ + "packageLocation": "./.yarn/__virtual__/@radix-ui-react-primitive-virtual-90ab930cca/0/cache/@radix-ui-react-primitive-npm-1.0.3-1983a5adc0-10c0.zip/node_modules/@radix-ui/react-primitive/",\ "packageDependencies": [\ - ["@radix-ui/react-primitive", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.3"],\ + ["@radix-ui/react-primitive", "virtual:63796dde4d35fa6a36aa1ca5dac46228f7e1ca443177d9cf89a8139812dd271d8d26ea1fdd1b294bc8a8d40291eb4ff194e82b382e9caf4b8f03a6bad0151e7a#npm:1.0.3"],\ ["@babel/runtime", "npm:7.23.4"],\ - ["@radix-ui/react-slot", "virtual:077b407c90001b73813b3e73d3504c0b0a6e865cc0a1514c15ecdf8ca2c969293f71408963df9eab2c2ad0f6fc5345246293dfd58b6ed05be7ff4b5b41a7d9d2#npm:1.0.2"],\ + ["@radix-ui/react-slot", "virtual:90ab930ccab92e3a39a298b50266285b96cd528144bf5bc1be5558c0117a148075649eb27ff3f52a5a6a78444d701355c13c01a30646f03812f315f8693ef5a9#npm:1.0.2"],\ ["@types/react", "npm:18.2.37"],\ ["@types/react-dom", "npm:18.2.15"],\ ["react", "npm:18.2.0"],\ @@ -6298,11 +6325,11 @@ const RAW_RUNTIME_STATE = ["@babel/runtime", "npm:7.23.4"],\ ["@radix-ui/primitive", "npm:1.0.1"],\ ["@radix-ui/react-collection", "virtual:85876a5d6296666ae7a86a407a1bc1132ad4356094bd396f920afd220f67b0f434f195dcae24ca0598af27a0153db02c5ceab2b57c587b511096bfe9aef91660#npm:1.0.3"],\ - ["@radix-ui/react-compose-refs", "virtual:e7789d651dfd1851f2b426e285cfe7e57b9f2ab5ce27abef8f38dc98f0935f73268c2428d150b58c015f098f1c638a5712234411891b079a705a2085a55240fa#npm:1.0.1"],\ + ["@radix-ui/react-compose-refs", "virtual:f2d8f8743469d83163f71f8b2230a298b16a1e7c8e66453fedf61c46f937f123e8eb5bbdbbc0e0726eedbc62ea2a19b1bfe875ad55818ec32abac19959357e09#npm:1.0.1"],\ ["@radix-ui/react-context", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.1"],\ ["@radix-ui/react-direction", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.1"],\ ["@radix-ui/react-id", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.1"],\ - ["@radix-ui/react-primitive", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.3"],\ + ["@radix-ui/react-primitive", "virtual:63796dde4d35fa6a36aa1ca5dac46228f7e1ca443177d9cf89a8139812dd271d8d26ea1fdd1b294bc8a8d40291eb4ff194e82b382e9caf4b8f03a6bad0151e7a#npm:1.0.3"],\ ["@radix-ui/react-use-callback-ref", "virtual:85876a5d6296666ae7a86a407a1bc1132ad4356094bd396f920afd220f67b0f434f195dcae24ca0598af27a0153db02c5ceab2b57c587b511096bfe9aef91660#npm:1.0.1"],\ ["@radix-ui/react-use-controllable-state", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.1"],\ ["@types/react", "npm:18.2.37"],\ @@ -6335,7 +6362,7 @@ const RAW_RUNTIME_STATE = ["@radix-ui/number", "npm:1.0.1"],\ ["@radix-ui/primitive", "npm:1.0.1"],\ ["@radix-ui/react-collection", "virtual:85876a5d6296666ae7a86a407a1bc1132ad4356094bd396f920afd220f67b0f434f195dcae24ca0598af27a0153db02c5ceab2b57c587b511096bfe9aef91660#npm:1.0.3"],\ - ["@radix-ui/react-compose-refs", "virtual:e7789d651dfd1851f2b426e285cfe7e57b9f2ab5ce27abef8f38dc98f0935f73268c2428d150b58c015f098f1c638a5712234411891b079a705a2085a55240fa#npm:1.0.1"],\ + ["@radix-ui/react-compose-refs", "virtual:f2d8f8743469d83163f71f8b2230a298b16a1e7c8e66453fedf61c46f937f123e8eb5bbdbbc0e0726eedbc62ea2a19b1bfe875ad55818ec32abac19959357e09#npm:1.0.1"],\ ["@radix-ui/react-context", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.1"],\ ["@radix-ui/react-direction", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.1"],\ ["@radix-ui/react-dismissable-layer", "virtual:1912b8abc724f76d62b3958334c9dbc4c679732064572ab5528cd01bacac6018e0db2a6e8ab39764b438ed1e2f61d83b8a839ee8ef5cd78828aede0046ceadc0#npm:1.0.4"],\ @@ -6344,8 +6371,8 @@ const RAW_RUNTIME_STATE = ["@radix-ui/react-id", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.1"],\ ["@radix-ui/react-popper", "virtual:1912b8abc724f76d62b3958334c9dbc4c679732064572ab5528cd01bacac6018e0db2a6e8ab39764b438ed1e2f61d83b8a839ee8ef5cd78828aede0046ceadc0#npm:1.1.2"],\ ["@radix-ui/react-portal", "virtual:1912b8abc724f76d62b3958334c9dbc4c679732064572ab5528cd01bacac6018e0db2a6e8ab39764b438ed1e2f61d83b8a839ee8ef5cd78828aede0046ceadc0#npm:1.0.3"],\ - ["@radix-ui/react-primitive", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.3"],\ - ["@radix-ui/react-slot", "virtual:077b407c90001b73813b3e73d3504c0b0a6e865cc0a1514c15ecdf8ca2c969293f71408963df9eab2c2ad0f6fc5345246293dfd58b6ed05be7ff4b5b41a7d9d2#npm:1.0.2"],\ + ["@radix-ui/react-primitive", "virtual:63796dde4d35fa6a36aa1ca5dac46228f7e1ca443177d9cf89a8139812dd271d8d26ea1fdd1b294bc8a8d40291eb4ff194e82b382e9caf4b8f03a6bad0151e7a#npm:1.0.3"],\ + ["@radix-ui/react-slot", "virtual:90ab930ccab92e3a39a298b50266285b96cd528144bf5bc1be5558c0117a148075649eb27ff3f52a5a6a78444d701355c13c01a30646f03812f315f8693ef5a9#npm:1.0.2"],\ ["@radix-ui/react-use-callback-ref", "virtual:85876a5d6296666ae7a86a407a1bc1132ad4356094bd396f920afd220f67b0f434f195dcae24ca0598af27a0153db02c5ceab2b57c587b511096bfe9aef91660#npm:1.0.1"],\ ["@radix-ui/react-use-controllable-state", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.1"],\ ["@radix-ui/react-use-layout-effect", "virtual:c1cdfbcfb0754cffde491f3d979f44e9565e6fd10c4a2425d4299c8a3b46e31357efdc2a1d1e9ac1a97c5013652de8a178015cf78f241274fd2663833c5b12d3#npm:1.0.1"],\ @@ -6380,7 +6407,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@radix-ui/react-separator", "virtual:fdf3c6948199b9b9eca9ef29cf1fb552bc53d9fe228685c5610f1a0b48a348d2337ff331f295e9cb105309813a8d9fc6dfcab9f6f5350896d079fe3eca28e45f#npm:1.0.3"],\ ["@babel/runtime", "npm:7.23.4"],\ - ["@radix-ui/react-primitive", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.3"],\ + ["@radix-ui/react-primitive", "virtual:63796dde4d35fa6a36aa1ca5dac46228f7e1ca443177d9cf89a8139812dd271d8d26ea1fdd1b294bc8a8d40291eb4ff194e82b382e9caf4b8f03a6bad0151e7a#npm:1.0.3"],\ ["@types/react", "npm:18.2.37"],\ ["@types/react-dom", "npm:18.2.15"],\ ["react", "npm:18.2.0"],\ @@ -6403,12 +6430,12 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "SOFT"\ }],\ - ["virtual:077b407c90001b73813b3e73d3504c0b0a6e865cc0a1514c15ecdf8ca2c969293f71408963df9eab2c2ad0f6fc5345246293dfd58b6ed05be7ff4b5b41a7d9d2#npm:1.0.2", {\ - "packageLocation": "./.yarn/__virtual__/@radix-ui-react-slot-virtual-7b0652c201/0/cache/@radix-ui-react-slot-npm-1.0.2-b9078e9a0b-10c0.zip/node_modules/@radix-ui/react-slot/",\ + ["virtual:90ab930ccab92e3a39a298b50266285b96cd528144bf5bc1be5558c0117a148075649eb27ff3f52a5a6a78444d701355c13c01a30646f03812f315f8693ef5a9#npm:1.0.2", {\ + "packageLocation": "./.yarn/__virtual__/@radix-ui-react-slot-virtual-f2d8f87434/0/cache/@radix-ui-react-slot-npm-1.0.2-b9078e9a0b-10c0.zip/node_modules/@radix-ui/react-slot/",\ "packageDependencies": [\ - ["@radix-ui/react-slot", "virtual:077b407c90001b73813b3e73d3504c0b0a6e865cc0a1514c15ecdf8ca2c969293f71408963df9eab2c2ad0f6fc5345246293dfd58b6ed05be7ff4b5b41a7d9d2#npm:1.0.2"],\ + ["@radix-ui/react-slot", "virtual:90ab930ccab92e3a39a298b50266285b96cd528144bf5bc1be5558c0117a148075649eb27ff3f52a5a6a78444d701355c13c01a30646f03812f315f8693ef5a9#npm:1.0.2"],\ ["@babel/runtime", "npm:7.23.4"],\ - ["@radix-ui/react-compose-refs", "virtual:e7789d651dfd1851f2b426e285cfe7e57b9f2ab5ce27abef8f38dc98f0935f73268c2428d150b58c015f098f1c638a5712234411891b079a705a2085a55240fa#npm:1.0.1"],\ + ["@radix-ui/react-compose-refs", "virtual:f2d8f8743469d83163f71f8b2230a298b16a1e7c8e66453fedf61c46f937f123e8eb5bbdbbc0e0726eedbc62ea2a19b1bfe875ad55818ec32abac19959357e09#npm:1.0.1"],\ ["@types/react", "npm:18.2.37"],\ ["react", "npm:18.2.0"]\ ],\ @@ -6437,7 +6464,7 @@ const RAW_RUNTIME_STATE = ["@radix-ui/react-direction", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.1"],\ ["@radix-ui/react-id", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.1"],\ ["@radix-ui/react-presence", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.1"],\ - ["@radix-ui/react-primitive", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.3"],\ + ["@radix-ui/react-primitive", "virtual:63796dde4d35fa6a36aa1ca5dac46228f7e1ca443177d9cf89a8139812dd271d8d26ea1fdd1b294bc8a8d40291eb4ff194e82b382e9caf4b8f03a6bad0151e7a#npm:1.0.3"],\ ["@radix-ui/react-roving-focus", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.4"],\ ["@radix-ui/react-use-controllable-state", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.1"],\ ["@types/react", "npm:18.2.37"],\ @@ -6468,7 +6495,7 @@ const RAW_RUNTIME_STATE = ["@radix-ui/react-toggle", "virtual:26e7add37626443864d7558baa77099ec863b6d65f48d37f190543d8cddd4c0891146ee16a5fce5dfb56917297a2c6afde5849d0279938e693673f70601375cf#npm:1.0.3"],\ ["@babel/runtime", "npm:7.23.4"],\ ["@radix-ui/primitive", "npm:1.0.1"],\ - ["@radix-ui/react-primitive", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.3"],\ + ["@radix-ui/react-primitive", "virtual:63796dde4d35fa6a36aa1ca5dac46228f7e1ca443177d9cf89a8139812dd271d8d26ea1fdd1b294bc8a8d40291eb4ff194e82b382e9caf4b8f03a6bad0151e7a#npm:1.0.3"],\ ["@radix-ui/react-use-controllable-state", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.1"],\ ["@types/react", "npm:18.2.37"],\ ["@types/react-dom", "npm:18.2.15"],\ @@ -6500,7 +6527,7 @@ const RAW_RUNTIME_STATE = ["@radix-ui/primitive", "npm:1.0.1"],\ ["@radix-ui/react-context", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.1"],\ ["@radix-ui/react-direction", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.1"],\ - ["@radix-ui/react-primitive", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.3"],\ + ["@radix-ui/react-primitive", "virtual:63796dde4d35fa6a36aa1ca5dac46228f7e1ca443177d9cf89a8139812dd271d8d26ea1fdd1b294bc8a8d40291eb4ff194e82b382e9caf4b8f03a6bad0151e7a#npm:1.0.3"],\ ["@radix-ui/react-roving-focus", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.4"],\ ["@radix-ui/react-toggle", "virtual:26e7add37626443864d7558baa77099ec863b6d65f48d37f190543d8cddd4c0891146ee16a5fce5dfb56917297a2c6afde5849d0279938e693673f70601375cf#npm:1.0.3"],\ ["@radix-ui/react-use-controllable-state", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.1"],\ @@ -6534,7 +6561,7 @@ const RAW_RUNTIME_STATE = ["@radix-ui/primitive", "npm:1.0.1"],\ ["@radix-ui/react-context", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.1"],\ ["@radix-ui/react-direction", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.1"],\ - ["@radix-ui/react-primitive", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.3"],\ + ["@radix-ui/react-primitive", "virtual:63796dde4d35fa6a36aa1ca5dac46228f7e1ca443177d9cf89a8139812dd271d8d26ea1fdd1b294bc8a8d40291eb4ff194e82b382e9caf4b8f03a6bad0151e7a#npm:1.0.3"],\ ["@radix-ui/react-roving-focus", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.4"],\ ["@radix-ui/react-separator", "virtual:fdf3c6948199b9b9eca9ef29cf1fb552bc53d9fe228685c5610f1a0b48a348d2337ff331f295e9cb105309813a8d9fc6dfcab9f6f5350896d079fe3eca28e45f#npm:1.0.3"],\ ["@radix-ui/react-toggle-group", "virtual:fdf3c6948199b9b9eca9ef29cf1fb552bc53d9fe228685c5610f1a0b48a348d2337ff331f295e9cb105309813a8d9fc6dfcab9f6f5350896d079fe3eca28e45f#npm:1.0.4"],\ @@ -6730,7 +6757,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["@radix-ui/react-visually-hidden", "virtual:1912b8abc724f76d62b3958334c9dbc4c679732064572ab5528cd01bacac6018e0db2a6e8ab39764b438ed1e2f61d83b8a839ee8ef5cd78828aede0046ceadc0#npm:1.0.3"],\ ["@babel/runtime", "npm:7.23.4"],\ - ["@radix-ui/react-primitive", "virtual:6ae0fb4b808e6eafd7034a3cc554d5ed4c8bc756dcd267d74736485c0714ada193c65147d612d7c5d5d695d8fa1c1857b25c1dc562bd4c6deafbf9701334a361#npm:1.0.3"],\ + ["@radix-ui/react-primitive", "virtual:63796dde4d35fa6a36aa1ca5dac46228f7e1ca443177d9cf89a8139812dd271d8d26ea1fdd1b294bc8a8d40291eb4ff194e82b382e9caf4b8f03a6bad0151e7a#npm:1.0.3"],\ ["@types/react", "npm:18.2.37"],\ ["@types/react-dom", "npm:18.2.15"],\ ["react", "npm:18.2.0"],\ @@ -10774,6 +10801,7 @@ const RAW_RUNTIME_STATE = ["amazing3-fe", "workspace:."],\ ["@hookform/devtools", "virtual:74868250102727df59d0c08f1ddb6630e6cd48640d8ad9d1ed80f220eee5d95c37bdc80e67cbbd686a520d72c8276bea707c0a77572e4e760d1051e7254c23b3#npm:4.3.1"],\ ["@radix-ui/react-icons", "virtual:74868250102727df59d0c08f1ddb6630e6cd48640d8ad9d1ed80f220eee5d95c37bdc80e67cbbd686a520d72c8276bea707c0a77572e4e760d1051e7254c23b3#npm:1.3.0"],\ + ["@radix-ui/react-portal", "virtual:74868250102727df59d0c08f1ddb6630e6cd48640d8ad9d1ed80f220eee5d95c37bdc80e67cbbd686a520d72c8276bea707c0a77572e4e760d1051e7254c23b3#npm:1.0.4"],\ ["@radix-ui/react-tabs", "virtual:74868250102727df59d0c08f1ddb6630e6cd48640d8ad9d1ed80f220eee5d95c37bdc80e67cbbd686a520d72c8276bea707c0a77572e4e760d1051e7254c23b3#npm:1.0.4"],\ ["@sentry/nextjs", "virtual:74868250102727df59d0c08f1ddb6630e6cd48640d8ad9d1ed80f220eee5d95c37bdc80e67cbbd686a520d72c8276bea707c0a77572e4e760d1051e7254c23b3#npm:7.91.0"],\ ["@sentry/utils", "npm:7.91.0"],\ diff --git a/.yarn/cache/@radix-ui-react-portal-npm-1.0.4-e4c93f6e90-10c0.zip b/.yarn/cache/@radix-ui-react-portal-npm-1.0.4-e4c93f6e90-10c0.zip new file mode 100644 index 00000000..5f25d35b Binary files /dev/null and b/.yarn/cache/@radix-ui-react-portal-npm-1.0.4-e4c93f6e90-10c0.zip differ diff --git a/package.json b/package.json index db81f322..9d99e0cf 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ }, "dependencies": { "@radix-ui/react-icons": "^1.3.0", + "@radix-ui/react-portal": "^1.0.4", "@radix-ui/react-tabs": "^1.0.4", "@sentry/nextjs": "^7.91.0", "@sentry/utils": "^7.91.0", diff --git a/src/assets/icons/toast-success.svg b/src/assets/icons/toast-success.svg new file mode 100644 index 00000000..9ae6097e --- /dev/null +++ b/src/assets/icons/toast-success.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/assets/icons/toast-warning.svg b/src/assets/icons/toast-warning.svg new file mode 100644 index 00000000..c00c1a35 --- /dev/null +++ b/src/assets/icons/toast-warning.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/components/atoms/toast/Toast.atom.ts b/src/components/atoms/toast/Toast.atom.ts new file mode 100644 index 00000000..d8a4d3e4 --- /dev/null +++ b/src/components/atoms/toast/Toast.atom.ts @@ -0,0 +1,41 @@ +import { atom } from 'jotai'; + +import type { ToastProps } from './Toast'; + +type ToastsProps = ToastProps[]; + +export interface ToastOptionProps { + position?: string; +} + +export const toastsAtom = atom([]); + +export const toastOptionAtom = atom({ + position: 'bottom-[84px]', +}); + +export const removeToastAtom = atom(null, (get, set, id: number) => { + const prev = get(toastsAtom); + set( + toastsAtom, + prev.filter((toast) => toast.id !== id), + ); +}); + +export const toastAtom = atom( + (get) => get(toastsAtom), + (get, set, type: ToastProps['type']) => (title: string) => () => { + const prev = get(toastsAtom); + const newToast = { type, title, id: prev.length }; + set(toastsAtom, [...prev, newToast]); + }, +); + +export const toastOptionChangeAtom = atom( + (get) => get(toastOptionAtom), + (get, set, changeOption: ToastOptionProps) => { + const prev = get(toastOptionAtom); + const updatedOption = { ...prev, ...changeOption }; + set(toastOptionAtom, updatedOption); + }, +); diff --git a/src/components/atoms/toast/Toast.stories.tsx b/src/components/atoms/toast/Toast.stories.tsx new file mode 100644 index 00000000..ebf83d76 --- /dev/null +++ b/src/components/atoms/toast/Toast.stories.tsx @@ -0,0 +1,38 @@ +import type { Meta, StoryObj } from '@storybook/react'; + +import { useToast } from '@/hooks/useToast'; + +import { Button } from '..'; + +import { Toast } from './Toast'; +import { ToastProvider } from './ToastProvider'; + +const meta: Meta = { + title: 'components/atoms/toast', + component: Toast, + decorators: [ + (Story) => ( +
+ + +
+ ), + ], +}; + +export default meta; + +type Story = StoryObj; + +export const Basic: Story = { + args: { + title: '세부 목표를 삭제했어요.', + type: 'success', + }, +}; + +export const ClickToToast = () => { + const toast = useToast(); + + return ; +}; diff --git a/src/components/atoms/toast/Toast.tsx b/src/components/atoms/toast/Toast.tsx new file mode 100644 index 00000000..a3531b9d --- /dev/null +++ b/src/components/atoms/toast/Toast.tsx @@ -0,0 +1,57 @@ +'use client'; + +import { useEffect, useState } from 'react'; +import { useSetAtom } from 'jotai'; + +import SuccessIcon from '@/assets/icons/toast-success.svg'; +import WarningIcon from '@/assets/icons/toast-warning.svg'; + +import { Typography } from '../typography'; + +import { removeToastAtom } from './Toast.atom'; + +export interface ToastProps { + id: number; + title: string; + type?: 'success' | 'warning'; +} + +const toastIcon = { + success: , + warning: , +}; + +const TOAST_DURATION = 3000; +const ANIMATION_DURATION = 350; + +export const Toast = ({ id, title, type = 'success' }: ToastProps) => { + const [opacity, setOpacity] = useState('opacity-[0.2]'); + const removeToastItem = useSetAtom(removeToastAtom); + + useEffect(() => { + setOpacity('opacity-[0.8]'); + const timeoutForRemove = setTimeout(() => { + removeToastItem(id); + }, TOAST_DURATION); + + const timeoutForVisible = setTimeout(() => { + setOpacity('opacity-0'); + }, TOAST_DURATION - ANIMATION_DURATION); + + return () => { + clearTimeout(timeoutForRemove); + clearTimeout(timeoutForVisible); + }; + }, [id, removeToastItem]); + + return ( +
+ {toastIcon[type]} + + {title} + +
+ ); +}; diff --git a/src/components/atoms/toast/ToastProvider.tsx b/src/components/atoms/toast/ToastProvider.tsx new file mode 100644 index 00000000..4b59cec9 --- /dev/null +++ b/src/components/atoms/toast/ToastProvider.tsx @@ -0,0 +1,20 @@ +import * as Portal from '@radix-ui/react-portal'; +import { useAtomValue } from 'jotai'; + +import { Toast } from './Toast'; +import { toastOptionAtom, toastsAtom } from './Toast.atom'; + +export const ToastProvider = () => { + const toasts = useAtomValue(toastsAtom); + const { position } = useAtomValue(toastOptionAtom); + + return ( + +
+ {toasts.map((toast) => ( + + ))} +
+
+ ); +}; diff --git a/src/hooks/useToast.ts b/src/hooks/useToast.ts new file mode 100644 index 00000000..7f61beed --- /dev/null +++ b/src/hooks/useToast.ts @@ -0,0 +1,19 @@ +import { useEffect } from 'react'; +import { useSetAtom } from 'jotai'; + +import type { ToastOptionProps } from '@/components/atoms/toast/Toast.atom'; +import { toastAtom, toastOptionChangeAtom } from '@/components/atoms/toast/Toast.atom'; + +export const useToast = (option?: ToastOptionProps) => { + const addToast = useSetAtom(toastAtom); + const setOption = useSetAtom(toastOptionChangeAtom); + + useEffect(() => { + if (option) setOption(option); + }, [option, setOption]); + + return { + success: addToast('success'), + warning: addToast('warning'), + }; +}; diff --git a/yarn.lock b/yarn.lock index f8629693..672f9174 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3109,6 +3109,26 @@ __metadata: languageName: node linkType: hard +"@radix-ui/react-portal@npm:^1.0.4": + version: 1.0.4 + resolution: "@radix-ui/react-portal@npm:1.0.4" + dependencies: + "@babel/runtime": "npm:^7.13.10" + "@radix-ui/react-primitive": "npm:1.0.3" + peerDependencies: + "@types/react": "*" + "@types/react-dom": "*" + react: ^16.8 || ^17.0 || ^18.0 + react-dom: ^16.8 || ^17.0 || ^18.0 + peerDependenciesMeta: + "@types/react": + optional: true + "@types/react-dom": + optional: true + checksum: fed32f8148b833fe852fb5e2f859979ffdf2fb9a9ef46583b9b52915d764ad36ba5c958a64e61d23395628ccc09d678229ee94cd112941e8fe2575021f820c29 + languageName: node + linkType: hard + "@radix-ui/react-presence@npm:1.0.1": version: 1.0.1 resolution: "@radix-ui/react-presence@npm:1.0.1" @@ -6420,6 +6440,7 @@ __metadata: dependencies: "@hookform/devtools": "npm:^4.3.1" "@radix-ui/react-icons": "npm:^1.3.0" + "@radix-ui/react-portal": "npm:^1.0.4" "@radix-ui/react-tabs": "npm:^1.0.4" "@sentry/nextjs": "npm:^7.91.0" "@sentry/utils": "npm:^7.91.0"