-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
706 additions
and
731 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { InputGroup, InputLeftElement } from '@chakra-ui/input' | ||
import { Select } from '@chakra-ui/select' | ||
import { LayoutProps } from '@chakra-ui/styled-system' | ||
import React from 'react' | ||
import styled from 'styled-components' | ||
|
||
const StyledSelect = styled(Select)<{ 'with-icon'?: string }>` | ||
${props => | ||
props['with-icon'] === 'leftIcon' && | ||
` | ||
padding-left: 35px !important; | ||
`} | ||
` | ||
|
||
const CustomChakraSelect: React.FC<{ | ||
options: { className?: string; value: string; name: string }[] | ||
onChange: (event: React.ChangeEvent<HTMLSelectElement>) => void | ||
defaultValue: string | ||
className?: string | ||
width?: LayoutProps['width'] | ||
leftIcon?: React.ReactNode | ||
disabled?: boolean | ||
}> = ({ className, width, options, leftIcon, onChange, defaultValue, disabled }) => { | ||
return ( | ||
<InputGroup className={className} width={width} backgroundColor="white"> | ||
{leftIcon && <InputLeftElement>{leftIcon}</InputLeftElement>} | ||
<StyledSelect | ||
onChange={onChange} | ||
defaultValue={defaultValue} | ||
disabled={disabled} | ||
with-icon={leftIcon ? 'leftIcon' : ''} | ||
> | ||
{options.map(option => ( | ||
<option key={option.value} className={option.className} value={option.value}> | ||
{option.name} | ||
</option> | ||
))} | ||
</StyledSelect> | ||
</InputGroup> | ||
) | ||
} | ||
|
||
export default CustomChakraSelect |
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,24 @@ | ||
import { Menu, MenuButton, MenuItem, MenuList } from '@chakra-ui/menu' | ||
import React from 'react' | ||
|
||
const CustomMenuButton: React.FC<{ | ||
buttonElement: React.ReactNode | string | ||
options: { className?: string; value: string; name: string }[] | ||
onClick: (value: string) => void | ||
className?: string | ||
}> = ({ className, buttonElement, options, onClick }) => { | ||
return ( | ||
<Menu> | ||
<MenuButton className={className}>{buttonElement}</MenuButton> | ||
<MenuList> | ||
{options.map((option, index) => ( | ||
<MenuItem key={index} className={option.className} onClick={() => onClick(option.value)}> | ||
{option.name} | ||
</MenuItem> | ||
))} | ||
</MenuList> | ||
</Menu> | ||
) | ||
} | ||
|
||
export default CustomMenuButton |
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 { Input, InputGroup, InputRightElement } from '@chakra-ui/input' | ||
import { LayoutProps } from '@chakra-ui/styled-system' | ||
import React from 'react' | ||
const CustomSearchInput: React.FC<{ | ||
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void | ||
rightIcon?: React.ReactNode | ||
width?: LayoutProps['width'] | ||
display?: LayoutProps['display'] | ||
placeholder?: string | ||
className?: string | ||
}> = ({ className, width, placeholder, onChange, rightIcon, display }) => { | ||
return ( | ||
<InputGroup className={className} display={display} width={width} backgroundColor="white"> | ||
<Input placeholder={placeholder} onChange={onChange} /> | ||
{rightIcon && <InputRightElement>{rightIcon}</InputRightElement>} | ||
</InputGroup> | ||
) | ||
} | ||
|
||
export default CustomSearchInput |
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
Oops, something went wrong.