-
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.
* chore: react-datepicker 추가 #205 * feat: DatePicker 구현 #205 * refactor: 폴더 이름 변경 #205 * fix: _focus 대신 _groupFocusWithin 사용 #205 * feat: wrapperClassName 추가하여 부모 너비 따라가도록 설정 #205
- Loading branch information
Showing
6 changed files
with
146 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,36 @@ | ||
import { Input, InputGroup, Icon, InputRightElement, Box } from '@chakra-ui/react'; | ||
import DatePicker from 'react-datepicker'; | ||
import { BiCalendar } from 'react-icons/bi'; | ||
import 'react-datepicker/dist/react-datepicker.css'; | ||
|
||
import './style.css'; | ||
import { StyledDatePickerProps } from './types'; | ||
|
||
const StyledDatePicker = ({ label, selectedDate, onChange }: StyledDatePickerProps) => { | ||
return ( | ||
<Box w="100%" role="group"> | ||
<DatePicker | ||
selected={selectedDate} | ||
onChange={onChange} | ||
wrapperClassName="styled_date_picker" | ||
customInput={ | ||
<InputGroup w="100%"> | ||
<Input | ||
textStyle="bold_xl" | ||
_hover={{ cursor: 'pointer' }} | ||
_placeholder={{ color: 'white' }} | ||
placeholder={label} | ||
readOnly | ||
value={selectedDate ? selectedDate.toLocaleDateString() : ''} | ||
/> | ||
<InputRightElement _hover={{ cursor: 'pointer' }}> | ||
<Icon as={BiCalendar} textStyle="bold_xl" mr="5" color="gray.50" /> | ||
</InputRightElement> | ||
</InputGroup> | ||
} | ||
/> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default StyledDatePicker; |
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,3 @@ | ||
.styled_date_picker { | ||
width: 100%; | ||
} |
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,5 @@ | ||
export interface StyledDatePickerProps { | ||
label: string; | ||
selectedDate: Date | null; | ||
onChange: (date: Date | null) => void; | ||
} |
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