From b1eac18f3f1f332edf8fa5bce395137ed6490a09 Mon Sep 17 00:00:00 2001 From: ibuki <64850924+eve00@users.noreply.github.com> Date: Fri, 16 Sep 2022 17:40:56 +0900 Subject: [PATCH 01/14] =?UTF-8?q?=E3=82=A2=E3=82=A4=E3=82=B3=E3=83=B3MenuB?= =?UTF-8?q?utton=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/components/Icons/IconMenuButton.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 front/src/components/Icons/IconMenuButton.tsx diff --git a/front/src/components/Icons/IconMenuButton.tsx b/front/src/components/Icons/IconMenuButton.tsx new file mode 100644 index 00000000..28584f40 --- /dev/null +++ b/front/src/components/Icons/IconMenuButton.tsx @@ -0,0 +1,16 @@ +import { Box } from '@chakra-ui/react' + +export const IconMenuButton = ({ ...props }) => { + return ( + + + + + + ) +} From 6b83a307b440df8e0798047d7f6cb53d8b3bc1b6 Mon Sep 17 00:00:00 2001 From: ibuki <64850924+eve00@users.noreply.github.com> Date: Fri, 16 Sep 2022 17:41:21 +0900 Subject: [PATCH 02/14] =?UTF-8?q?IconMenuButton=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/components/Icons/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/front/src/components/Icons/index.ts b/front/src/components/Icons/index.ts index cab5c819..48a444ca 100644 --- a/front/src/components/Icons/index.ts +++ b/front/src/components/Icons/index.ts @@ -13,3 +13,4 @@ export { IconUser } from '@/components/Icons/IconUser' export { IconViewGrid } from '@/components/Icons/IconViewGrid' export { IconViewList } from '@/components/Icons/IconViewList' export { IconCheck } from '@/components/Icons/IconCheck' +export { IconMenuButton } from '@/components/Icons/IconMenuButton' From 2ce9a63863eee25938821334d7cea4b60afabd9b Mon Sep 17 00:00:00 2001 From: ibuki <64850924+eve00@users.noreply.github.com> Date: Fri, 16 Sep 2022 17:45:11 +0900 Subject: [PATCH 03/14] =?UTF-8?q?=E3=83=88=E3=83=A9=E3=83=99=E3=83=AA?= =?UTF-8?q?=E3=83=B3=E3=82=AF=E5=89=8A=E9=99=A4=E3=83=A2=E3=83=BC=E3=83=80?= =?UTF-8?q?=E3=83=AB=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B=E3=83=9C?= =?UTF-8?q?=E3=82=BF=E3=83=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Menus/MenuOpenDeleteTravelink.tsx | 56 +++++++++++++++++++ front/src/components/Menus/index.ts | 1 + 2 files changed, 57 insertions(+) create mode 100644 front/src/components/Menus/MenuOpenDeleteTravelink.tsx diff --git a/front/src/components/Menus/MenuOpenDeleteTravelink.tsx b/front/src/components/Menus/MenuOpenDeleteTravelink.tsx new file mode 100644 index 00000000..dc313295 --- /dev/null +++ b/front/src/components/Menus/MenuOpenDeleteTravelink.tsx @@ -0,0 +1,56 @@ +import { + Box, + ButtonProps, + Flex, + Menu, + MenuButton, + MenuItem, + MenuList, + Spacer +} from '@chakra-ui/react' +import { IconMenuButton } from '@/components/Icons' + +type MenuOpenDeleteTravelinkProps = { + onOpen: () => void +} + +export const MenuOpenDeleteTravelink = ( + { onOpen }: MenuOpenDeleteTravelinkProps +) => { + return ( + + + + + + + + + { + onOpen() + }} + > + + + 削除する + + + + + ) +} diff --git a/front/src/components/Menus/index.ts b/front/src/components/Menus/index.ts index d01a849c..c53b0662 100644 --- a/front/src/components/Menus/index.ts +++ b/front/src/components/Menus/index.ts @@ -1 +1,2 @@ export { MenuCardLinkEdit } from '@/components/Menus/MenuCardLinkEdit' +export { MenuOpenDeleteTravelink } from '@/components/Menus/MenuOpenDeleteTravelink' From 891e613566bc7aab654d0af8c4ac843d9d7dc673 Mon Sep 17 00:00:00 2001 From: ibuki <64850924+eve00@users.noreply.github.com> Date: Fri, 16 Sep 2022 23:00:05 +0900 Subject: [PATCH 04/14] =?UTF-8?q?=E3=83=88=E3=83=A9=E3=83=99=E3=83=AA?= =?UTF-8?q?=E3=83=B3=E3=82=AF=E3=82=92=E5=89=8A=E9=99=A4=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=83=A2=E3=83=BC=E3=83=80=E3=83=AB=E3=82=92=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E3=81=99=E3=82=8B=E6=A9=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/components/Cards/CardHome.tsx | 68 +++++++++++------- .../Menus/MenuOpenDeleteTravelink.tsx | 70 +++++++++---------- front/src/components/Modals/index.ts | 1 + front/src/theme/colors.ts | 4 ++ 4 files changed, 83 insertions(+), 60 deletions(-) diff --git a/front/src/components/Cards/CardHome.tsx b/front/src/components/Cards/CardHome.tsx index 014a3434..c6e8e551 100644 --- a/front/src/components/Cards/CardHome.tsx +++ b/front/src/components/Cards/CardHome.tsx @@ -1,17 +1,37 @@ import NextLink from 'next/link' -import { Avatar, Box, Flex, Heading, Link } from '@chakra-ui/react' +import { + Avatar, + Box, + Flex, + Heading, + Link, + useDisclosure +} from '@chakra-ui/react' import { BookmarkType, TravelinkRequestType } from '@/types/db' import { format } from 'date-fns' -import { Button } from '@/components/Buttons' +import { ModalDeleteTravelknk } from '@/components/Modals' +import { MenuOpenDeleteTravelink } from '@/components/Menus' type CardHomeProps = { data: BookmarkType | TravelinkRequestType } export const CardHome = ({ data }: CardHomeProps) => { + const { + isOpen: isOpenDeleteTravelinkModal, + onOpen: onOpenDeleteTravelinkModal, + onClose: onCloseDeleteTravelinkModal + } = useDisclosure() return ( - - + + {/* TODO:タイトル、画像をaタグにする */} + {/* TODO:削除処理Hook書く */} + {/* */} + { bgColor={'white'} marginTop={'2.2rem'} > - + + + { paddingBottom={'1.4rem'} fontSize={'lg'} > - {data.title} + {data.title} @@ -62,17 +84,13 @@ export const CardHome = ({ data }: CardHomeProps) => { - + + + + - - + + {/* */} + ) } diff --git a/front/src/components/Menus/MenuOpenDeleteTravelink.tsx b/front/src/components/Menus/MenuOpenDeleteTravelink.tsx index dc313295..7458555b 100644 --- a/front/src/components/Menus/MenuOpenDeleteTravelink.tsx +++ b/front/src/components/Menus/MenuOpenDeleteTravelink.tsx @@ -14,43 +14,43 @@ type MenuOpenDeleteTravelinkProps = { onOpen: () => void } -export const MenuOpenDeleteTravelink = ( - { onOpen }: MenuOpenDeleteTravelinkProps -) => { +export const MenuOpenDeleteTravelink = ({ + onOpen +}: MenuOpenDeleteTravelinkProps) => { return ( - - - - - - + + + + + + - + { + onOpen() + }} > - { - onOpen() - }} - > - - - 削除する - - - - + + + 削除する + + + + ) } diff --git a/front/src/components/Modals/index.ts b/front/src/components/Modals/index.ts index a88560fe..d65babaa 100644 --- a/front/src/components/Modals/index.ts +++ b/front/src/components/Modals/index.ts @@ -1,2 +1,3 @@ export { ModalQrCode } from '@/components/Modals/ModalQrCode' export { ModalSignIn } from '@/components/Modals/ModalSignIn' +export { ModalDeleteTravelknk } from '@/components/Modals/ModalDeleteTravelink' diff --git a/front/src/theme/colors.ts b/front/src/theme/colors.ts index 85e7c8a7..305ea415 100644 --- a/front/src/theme/colors.ts +++ b/front/src/theme/colors.ts @@ -9,6 +9,10 @@ export const colors = { }, gray: '#7E7E7E', black: '#252525', + alertRed: { + 500: '#F65A5A', + 600: '#F65A5A' + }, brandPink: { 50: '#ffdde5', 100: '#ffccd8', From a5f9e399f27d2a1a132d22905d081dfa82c722c6 Mon Sep 17 00:00:00 2001 From: ibuki <64850924+eve00@users.noreply.github.com> Date: Sat, 17 Sep 2022 00:07:17 +0900 Subject: [PATCH 05/14] =?UTF-8?q?=E3=83=88=E3=83=A9=E3=83=99=E3=83=AA?= =?UTF-8?q?=E3=83=B3=E3=82=AF=E3=82=92=E5=89=8A=E9=99=A4=E3=81=99=E3=82=8B?= =?UTF-8?q?=E6=A9=9F=E8=83=BD=E3=82=92=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/components/Cards/CardHome.tsx | 4 +- .../Modals/ModalDeleteTravelink.tsx | 69 +++++++++++++++++++ .../firestore/travelink/useDeleteTravelink.ts | 19 +++++ 3 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 front/src/components/Modals/ModalDeleteTravelink.tsx create mode 100644 front/src/hooks/firestore/travelink/useDeleteTravelink.ts diff --git a/front/src/components/Cards/CardHome.tsx b/front/src/components/Cards/CardHome.tsx index c6e8e551..163a2d7a 100644 --- a/front/src/components/Cards/CardHome.tsx +++ b/front/src/components/Cards/CardHome.tsx @@ -27,6 +27,7 @@ export const CardHome = ({ data }: CardHomeProps) => { {/* TODO:タイトル、画像をaタグにする */} {/* TODO:削除処理Hook書く */} @@ -85,8 +86,7 @@ export const CardHome = ({ data }: CardHomeProps) => { - - + diff --git a/front/src/components/Modals/ModalDeleteTravelink.tsx b/front/src/components/Modals/ModalDeleteTravelink.tsx new file mode 100644 index 00000000..4fdfc8fd --- /dev/null +++ b/front/src/components/Modals/ModalDeleteTravelink.tsx @@ -0,0 +1,69 @@ +import { + Modal, + Button, + ModalOverlay, + ModalContent, + ModalHeader, + ModalFooter, + ModalBody, + Text, + UnorderedList, + ListItem, + Box +} from '@chakra-ui/react' +import { useDeleteTravelink } from '@/hooks/firestore' + +type Props = { + isOpen: boolean + onClose: () => void + id: string +} + +export const ModalDeleteTravelknk = ({ isOpen, onClose, id }: Props) => { + const { onClickDeleteTravelink } = useDeleteTravelink() + return ( + + + + トラベリンク削除 + {/* */} + + 削除すると以下の情報がすべて失われます + + + とらべりんく削除 + + + + + + + + + + ) +} diff --git a/front/src/hooks/firestore/travelink/useDeleteTravelink.ts b/front/src/hooks/firestore/travelink/useDeleteTravelink.ts new file mode 100644 index 00000000..52e90eed --- /dev/null +++ b/front/src/hooks/firestore/travelink/useDeleteTravelink.ts @@ -0,0 +1,19 @@ +import { collection, deleteDoc, doc, getFirestore } from 'firebase/firestore' +import { useRouter } from 'next/router' + +export const useDeleteTravelink = () => { + const router = useRouter() + + const onClickDeleteTravelink = async (id: string) => { + const db = getFirestore() + + const travelinkRef = doc(collection(db, 'travelinks'), id) + try { + await deleteDoc(travelinkRef) + } catch (e) { + console.error(e) + } + router.reload() + } + return { onClickDeleteTravelink } +} From 28c456743c4990cdd1250e2bf4f8fefe43eab4a2 Mon Sep 17 00:00:00 2001 From: ibuki <64850924+eve00@users.noreply.github.com> Date: Sat, 17 Sep 2022 00:07:34 +0900 Subject: [PATCH 06/14] run formatter --- front/src/components/Icons/IconMenuButton.tsx | 32 +++++++++---------- front/src/hooks/firestore/index.ts | 1 + 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/front/src/components/Icons/IconMenuButton.tsx b/front/src/components/Icons/IconMenuButton.tsx index 28584f40..8524b290 100644 --- a/front/src/components/Icons/IconMenuButton.tsx +++ b/front/src/components/Icons/IconMenuButton.tsx @@ -1,16 +1,16 @@ -import { Box } from '@chakra-ui/react' - -export const IconMenuButton = ({ ...props }) => { - return ( - - - - - - ) -} +import { Box } from '@chakra-ui/react' + +export const IconMenuButton = ({ ...props }) => { + return ( + + + + + + ) +} diff --git a/front/src/hooks/firestore/index.ts b/front/src/hooks/firestore/index.ts index c54c6794..b590b49e 100644 --- a/front/src/hooks/firestore/index.ts +++ b/front/src/hooks/firestore/index.ts @@ -8,6 +8,7 @@ export { useGetTravelink } from '@/hooks/firestore/travelink/useGetTravelink' export { useGetTravelinkList } from '@/hooks/firestore/travelink/useGetTravelinkList' export { useCreateTravelink } from '@/hooks/firestore/travelink/useCreateTravelink' export { useUpdateTravelink } from '@/hooks/firestore/travelink/useUpdateTravelink' +export { useDeleteTravelink } from '@/hooks/firestore/travelink/useDeleteTravelink' // bookmark export { useCreateBookmark } from '@/hooks/firestore/bookmark/useCreateBookmark' From 35695e77cfc26aaba6db1b69755def3849f884e6 Mon Sep 17 00:00:00 2001 From: ibuki <64850924+eve00@users.noreply.github.com> Date: Sat, 17 Sep 2022 00:14:23 +0900 Subject: [PATCH 07/14] =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/components/Cards/CardHome.tsx | 1 - front/src/components/Menus/MenuOpenDeleteTravelink.tsx | 2 -- front/src/components/Modals/ModalDeleteTravelink.tsx | 1 - 3 files changed, 4 deletions(-) diff --git a/front/src/components/Cards/CardHome.tsx b/front/src/components/Cards/CardHome.tsx index 163a2d7a..f329c906 100644 --- a/front/src/components/Cards/CardHome.tsx +++ b/front/src/components/Cards/CardHome.tsx @@ -1,4 +1,3 @@ -import NextLink from 'next/link' import { Avatar, Box, diff --git a/front/src/components/Menus/MenuOpenDeleteTravelink.tsx b/front/src/components/Menus/MenuOpenDeleteTravelink.tsx index 7458555b..a5b2c511 100644 --- a/front/src/components/Menus/MenuOpenDeleteTravelink.tsx +++ b/front/src/components/Menus/MenuOpenDeleteTravelink.tsx @@ -1,12 +1,10 @@ import { Box, - ButtonProps, Flex, Menu, MenuButton, MenuItem, MenuList, - Spacer } from '@chakra-ui/react' import { IconMenuButton } from '@/components/Icons' diff --git a/front/src/components/Modals/ModalDeleteTravelink.tsx b/front/src/components/Modals/ModalDeleteTravelink.tsx index 4fdfc8fd..835fbc16 100644 --- a/front/src/components/Modals/ModalDeleteTravelink.tsx +++ b/front/src/components/Modals/ModalDeleteTravelink.tsx @@ -33,7 +33,6 @@ export const ModalDeleteTravelknk = ({ isOpen, onClose, id }: Props) => { padding={'1.5rem'} > トラベリンク削除 - {/* */} 削除すると以下の情報がすべて失われます Date: Sat, 17 Sep 2022 00:14:39 +0900 Subject: [PATCH 08/14] run formatter --- front/src/components/Menus/MenuOpenDeleteTravelink.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/src/components/Menus/MenuOpenDeleteTravelink.tsx b/front/src/components/Menus/MenuOpenDeleteTravelink.tsx index a5b2c511..1426bc6b 100644 --- a/front/src/components/Menus/MenuOpenDeleteTravelink.tsx +++ b/front/src/components/Menus/MenuOpenDeleteTravelink.tsx @@ -4,7 +4,7 @@ import { Menu, MenuButton, MenuItem, - MenuList, + MenuList } from '@chakra-ui/react' import { IconMenuButton } from '@/components/Icons' From b33dfe0b998c28cf9d8605d99b10bc2d70269629 Mon Sep 17 00:00:00 2001 From: ibuki <64850924+eve00@users.noreply.github.com> Date: Sat, 17 Sep 2022 00:19:32 +0900 Subject: [PATCH 09/14] SHUSEI --- front/src/components/Cards/CardHome.tsx | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/front/src/components/Cards/CardHome.tsx b/front/src/components/Cards/CardHome.tsx index f329c906..cd08d4eb 100644 --- a/front/src/components/Cards/CardHome.tsx +++ b/front/src/components/Cards/CardHome.tsx @@ -1,11 +1,4 @@ -import { - Avatar, - Box, - Flex, - Heading, - Link, - useDisclosure -} from '@chakra-ui/react' +import { Avatar, Box, Flex, Heading, useDisclosure } from '@chakra-ui/react' import { BookmarkType, TravelinkRequestType } from '@/types/db' import { format } from 'date-fns' import { ModalDeleteTravelknk } from '@/components/Modals' @@ -28,9 +21,6 @@ export const CardHome = ({ data }: CardHomeProps) => { onClose={onCloseDeleteTravelinkModal} id={data.id} /> - {/* TODO:タイトル、画像をaタグにする */} - {/* TODO:削除処理Hook書く */} - {/* */} { - {/* */} ) } From 4d17b5f383303fe77f5f3a4b6de6b34d9e595f43 Mon Sep 17 00:00:00 2001 From: ibuki <64850924+eve00@users.noreply.github.com> Date: Sat, 17 Sep 2022 07:54:48 +0900 Subject: [PATCH 10/14] =?UTF-8?q?TODO=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/components/Cards/CardHome.tsx | 1 + front/src/hooks/firestore/travelink/useDeleteTravelink.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/front/src/components/Cards/CardHome.tsx b/front/src/components/Cards/CardHome.tsx index cd08d4eb..8d1123fa 100644 --- a/front/src/components/Cards/CardHome.tsx +++ b/front/src/components/Cards/CardHome.tsx @@ -74,6 +74,7 @@ export const CardHome = ({ data }: CardHomeProps) => { + {/* TODO: 一番下のCardHomeが+ボタンで隠れてるのをどうにかする */} diff --git a/front/src/hooks/firestore/travelink/useDeleteTravelink.ts b/front/src/hooks/firestore/travelink/useDeleteTravelink.ts index 52e90eed..03e581ab 100644 --- a/front/src/hooks/firestore/travelink/useDeleteTravelink.ts +++ b/front/src/hooks/firestore/travelink/useDeleteTravelink.ts @@ -13,6 +13,7 @@ export const useDeleteTravelink = () => { } catch (e) { console.error(e) } + // TODO: リロード→ぐるぐるにしてDBから再フェッチ router.reload() } return { onClickDeleteTravelink } From 186d90c49ff89d8c6f8d4eb0ee4bc8139d90e009 Mon Sep 17 00:00:00 2001 From: ibuki <64850924+eve00@users.noreply.github.com> Date: Sat, 17 Sep 2022 08:06:16 +0900 Subject: [PATCH 11/14] =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/components/Modals/ModalDeleteTravelink.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/front/src/components/Modals/ModalDeleteTravelink.tsx b/front/src/components/Modals/ModalDeleteTravelink.tsx index 835fbc16..9aeafa1d 100644 --- a/front/src/components/Modals/ModalDeleteTravelink.tsx +++ b/front/src/components/Modals/ModalDeleteTravelink.tsx @@ -47,12 +47,12 @@ export const ModalDeleteTravelknk = ({ isOpen, onClose, id }: Props) => { - - - - - , - , -] -`; - -exports[`Storyshots components/Cards/CardLink Food 1`] = ` -[ -
-
-
-
- -
-

- リンク -

-
-
-
, - , -] -`; - -exports[`Storyshots components/Cards/CardLink Others 1`] = ` -[ -
-
-
-
- -
-

- リンク -

-
-
-
, - , -] -`; - -exports[`Storyshots components/Cards/CardLink Place 1`] = ` -[ -
-
-
-
- -
-

- リンク -

-
-
-
, - , -] -`; - -exports[`Storyshots components/Cards/CardLinkEdit Default 1`] = ` -[ -
-
-
-
-
- -
-
- -
-
- -
-
- - -
-
- - -
-
- - -
-
-
-
- - -
-
- -
- -
-
-
-
-
, - , -] -`; - exports[`Storyshots components/Inputs/Input Default 1`] = ` [
-
-
-
- - -
-
- -
-
, - , -] -`; - exports[`Storyshots utility/ColorPalette Default 1`] = ` [