Skip to content

Commit

Permalink
Merge pull request #1186 from ilyapishchulin/v4
Browse files Browse the repository at this point in the history
Add before prop for Search
  • Loading branch information
NekR committed Dec 19, 2020
2 parents 13b8714 + eec7bb6 commit 14219ab
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/Search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface SearchProps extends InputHTMLAttributes<HTMLInputElement>, HasR
* iOS only. Текст кнопки "отмена", которая чистит текстовое поле и убирает фокус.
*/
after?: ReactNode;
before?: ReactNode;
icon?: ReactNode;
onIconClick?: (e: VKUITouchEvent) => void;
defaultValue?: string;
Expand All @@ -45,6 +46,7 @@ class Search extends Component<SearchProps, SearchState> {
autoComplete: 'off',
placeholder: 'Поиск',
after: 'Отмена',
before: <Icon16SearchOutline />,
};

isControlledOutside: boolean;
Expand Down Expand Up @@ -119,6 +121,7 @@ class Search extends Component<SearchProps, SearchState> {

render() {
const {
before,
className,
onFocus,
onBlur,
Expand Down Expand Up @@ -157,7 +160,7 @@ class Search extends Component<SearchProps, SearchState> {
{platform === IOS && after && <div className="Search__after-width">{after}</div>}
<div className="Search__placeholder">
<div className="Search__placeholder-in">
<Icon16SearchOutline />
{before}
<div className="Search__placeholder-text">
{platform === VKCOM ? <Text weight="regular">{placeholder}</Text> : placeholder}
</div>
Expand Down

0 comments on commit 14219ab

Please sign in to comment.