From c54584493eac7a24672f1262f3560e37ea2e149e Mon Sep 17 00:00:00 2001 From: Kana Taguchi Date: Wed, 17 Jan 2024 21:32:33 +0900 Subject: [PATCH 01/13] Add Trip edit/create UI --- app/components/input/index.ts | 2 +- app/components/input/input-icon.tsx | 47 ++++++++++++++++ app/components/input/input-search.tsx | 45 ---------------- app/trip/[id]/edit/page.tsx | 34 ++++++++++++ app/trip/[id]/page.tsx | 2 +- app/trip/components/index.ts | 2 + app/trip/components/trip-form-tag.tsx | 77 +++++++++++++++++++++++++++ app/trip/components/trip-form.tsx | 67 +++++++++++++++++++++++ app/trip/components/trip-search.tsx | 6 ++- app/trip/create/page.tsx | 11 +++- 10 files changed, 242 insertions(+), 51 deletions(-) create mode 100644 app/components/input/input-icon.tsx delete mode 100644 app/components/input/input-search.tsx create mode 100644 app/trip/[id]/edit/page.tsx create mode 100644 app/trip/components/trip-form-tag.tsx create mode 100644 app/trip/components/trip-form.tsx diff --git a/app/components/input/index.ts b/app/components/input/index.ts index 9ce8684..d4f1b9c 100644 --- a/app/components/input/index.ts +++ b/app/components/input/index.ts @@ -1,3 +1,3 @@ -export { InputSearch } from './input-search' export { InputForm } from './input-form' +export { InputIcon } from './input-icon' export { TextareaForm } from './textarea-form' diff --git a/app/components/input/input-icon.tsx b/app/components/input/input-icon.tsx new file mode 100644 index 0000000..78f5c1a --- /dev/null +++ b/app/components/input/input-icon.tsx @@ -0,0 +1,47 @@ +import { IconType } from 'react-icons' +import { + Input as ChakraInput, + InputProps as ChakraInputProps, + InputGroup, + InputRightElement, + IconButton, + forwardRef, + useColorModeValue +} from '@chakra-ui/react' + +type InputIconProps = { + ariaLabel: string + icon: IconType + onClick?: () => void +} + +export const InputIcon = forwardRef( + ({ ariaLabel, icon: Icon, onClick, ...props }, ref) => { + const bgColor = useColorModeValue('white', 'gray.700') + const borderColor = useColorModeValue('primary.700', 'gray.500') + + return ( + + + + + + + + + ) + } +) diff --git a/app/components/input/input-search.tsx b/app/components/input/input-search.tsx deleted file mode 100644 index 11c1462..0000000 --- a/app/components/input/input-search.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import { - Input as ChakraInput, - InputProps as ChakraInputProps, - InputGroup, - InputRightElement, - IconButton, - forwardRef, - useColorModeValue -} from '@chakra-ui/react' -import { FiSearch } from 'react-icons/fi' - -type InputSearchProps = { - ariaLabel: string -} - -export const InputSearch = forwardRef< - ChakraInputProps & InputSearchProps, - 'input' ->(({ ariaLabel, ...props }, ref) => { - const bgColor = useColorModeValue('white', 'gray.700') - const borderColor = useColorModeValue('primary.700', 'gray.500') - - return ( - - - - - - - - - ) -}) diff --git a/app/trip/[id]/edit/page.tsx b/app/trip/[id]/edit/page.tsx new file mode 100644 index 0000000..7e491ea --- /dev/null +++ b/app/trip/[id]/edit/page.tsx @@ -0,0 +1,34 @@ +'use client' + +import { Box, Container, Heading, useColorModeValue } from '@chakra-ui/react' +// import { Loading } from '@/components/loading' +import { Header, Footer } from '@/components/navigation' +import { TripForm } from '../../components' + +export default function TripEditPage({ params }: { params: { id: string } }) { + const bg = useColorModeValue('white', 'gray.800') + const color = useColorModeValue('black', 'gray.300') + + console.log(params) + + return ( + <> +
+ + + + Edit Trip + + + + + + +