-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from tabi-memo/M3_trip_create
M3 Trip Create/Edit
- Loading branch information
Showing
49 changed files
with
3,037 additions
and
304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
import DatePicker from 'react-datepicker' | ||
import { Box, useColorMode } from '@chakra-ui/react' | ||
import { FiCalendar } from 'react-icons/fi' | ||
import 'react-datepicker/dist/react-datepicker.css' | ||
import { InputForm } from '@/components/input' | ||
|
||
type DatePickerProps = { | ||
selectedDate: Date | null | ||
onChange: (date: Date) => void | ||
placeholderText: string | ||
dateFormat?: string | string[] | undefined | ||
} | ||
|
||
export const CustomDatePicker = ({ | ||
selectedDate, | ||
onChange, | ||
placeholderText, | ||
dateFormat | ||
}: DatePickerProps) => { | ||
const { colorMode } = useColorMode() | ||
|
||
const datePickerStyles = { | ||
'.react-datepicker-wrapper': { | ||
width: '100%' | ||
}, | ||
'.react-datepicker-popper': { | ||
right: { base: 0, md: 'unset' } | ||
}, | ||
'.react-datepicker ': { | ||
width: '100%', | ||
border: 'none', | ||
boxShadow: '0px 2px 16px 0px rgba(0,0,0,.25);', | ||
fontSize: 'sm' | ||
}, | ||
'.react-datepicker__month-container': { | ||
backgroundColor: colorMode === 'dark' ? 'gray.700' : 'white', | ||
width: { base: '100%', md: '400px' } | ||
}, | ||
'.react-datepicker__triangle': { | ||
display: 'none' | ||
}, | ||
'.react-datepicker__header': { | ||
backgroundColor: colorMode === 'dark' ? 'gray.700' : 'white', | ||
borderBottomColor: colorMode === 'dark' ? 'gray.500' : 'gray.300' | ||
}, | ||
'.react-datepicker__current-month': { | ||
color: colorMode === 'dark' ? 'primary.700' : 'primary.800', | ||
paddingY: '8px', | ||
fontSize: 'lg' | ||
}, | ||
'.react-datepicker__navigation': { | ||
top: '11px' | ||
}, | ||
'.react-datepicker__navigation--previous': { | ||
left: '32px' | ||
}, | ||
'.react-datepicker__navigation--next': { | ||
right: '32px' | ||
}, | ||
'.react-datepicker__navigation-icon': { | ||
'&::before': { | ||
borderColor: colorMode === 'dark' ? 'gray.500' : 'gray.400' | ||
} | ||
}, | ||
'.react-datepicker__month': { | ||
margin: '1rem' | ||
}, | ||
'.react-datepicker__day-names': { | ||
paddingY: '4px' | ||
}, | ||
'.react-datepicker__day-name': { | ||
width: { base: '2.4rem', md: '2.8rem' }, | ||
lineHeight: { base: '2.4rem', md: '2.8rem' }, | ||
color: colorMode === 'dark' ? 'gray.300' : 'black' | ||
}, | ||
'.react-datepicker__day': { | ||
width: { base: '2.4rem', md: '2.8rem' }, | ||
lineHeight: { base: '2.2rem', md: '2.4rem' }, | ||
':hover': { | ||
backgroundColor: colorMode === 'dark' ? 'gray.600' : 'gray.100' | ||
}, | ||
color: colorMode === 'dark' ? 'gray.300' : 'black' | ||
}, | ||
'.react-datepicker__day--selected': { | ||
fontWeight: 'bold', | ||
color: 'white', | ||
backgroundColor: colorMode === 'dark' ? 'primary.700' : 'primary.500' | ||
}, | ||
'.react-datepicker__day--keyboard-selected': { | ||
background: 'none' | ||
} | ||
} | ||
|
||
return ( | ||
<Box sx={datePickerStyles}> | ||
<DatePicker | ||
selected={selectedDate} | ||
placeholderText={placeholderText} | ||
onChange={onChange} | ||
dateFormat={dateFormat} | ||
popperPlacement="bottom-start" | ||
customInput={<InputForm rightIcon={FiCalendar} />} | ||
/> | ||
</Box> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { CustomDatePicker } from './custom-date-picker' |
20 changes: 20 additions & 0 deletions
20
app/components/date/stories/custom-date-picker.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { useState } from 'react' | ||
import { Meta } from '@storybook/react' | ||
import { CustomDatePicker } from '@/components/date' | ||
|
||
const meta: Meta<typeof CustomDatePicker> = { | ||
title: 'CustomDatePicker', | ||
component: CustomDatePicker | ||
} | ||
export default meta | ||
|
||
export const Default = () => { | ||
const [selectedDate, setSelectedDate] = useState<Date | null>(new Date()) | ||
return ( | ||
<CustomDatePicker | ||
selectedDate={selectedDate} | ||
onChange={(date) => setSelectedDate(date)} | ||
placeholderText="Select Date" | ||
/> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export { InputSearch } from './input-search' | ||
export { InputForm } from './input-form' | ||
export { InputIconButton } from './input-icon-button' | ||
export { TextareaForm } from './textarea-form' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
18 changes: 18 additions & 0 deletions
18
app/components/input/stories/input-icon-button.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Meta, StoryObj } from '@storybook/react' | ||
import { FiSearch } from 'react-icons/fi' | ||
import { InputIconButton } from '@/components/input' | ||
|
||
const meta: Meta<typeof InputIconButton> = { | ||
title: 'Input Icon Button', | ||
component: InputIconButton | ||
} | ||
export default meta | ||
type Story = StoryObj<typeof InputIconButton> | ||
|
||
export const Default: Story = { | ||
args: { | ||
ariaLabel: 'Search', | ||
placeholder: 'Search...', | ||
icon: FiSearch | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.