Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add before prop for Search #1186

Merged
merged 1 commit into from
Dec 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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