mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
SearchBar component implemented
This commit is contained in:
parent
3b05b6af08
commit
55bacef0a1
4 changed files with 79 additions and 0 deletions
33
src/common/SearchBar/SearchBar.js
Normal file
33
src/common/SearchBar/SearchBar.js
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
const React = require('react');
|
||||
const PropTypes = require('prop-types');
|
||||
const classnames = require('classnames');
|
||||
const Icon = require('stremio-icons/dom');
|
||||
const TextInput = require('stremio/common/TextInput');
|
||||
const SearchBarPlaceholder = require('./SearchBarPlaceholder');
|
||||
const styles = require('./styles');
|
||||
|
||||
const SearchBar = ({ className, title, search, searchInputOnChange }) => {
|
||||
return (
|
||||
<label title={title} className={classnames(className, styles['search-bar-container'])}>
|
||||
<TextInput
|
||||
className={styles['search-input']}
|
||||
type={'text'}
|
||||
placeholder={title}
|
||||
value={search}
|
||||
onChange={searchInputOnChange}
|
||||
/>
|
||||
<Icon className={styles['icon']} icon={'ic_search'} />
|
||||
</label>
|
||||
);
|
||||
};
|
||||
|
||||
SearchBar.Placeholder = SearchBarPlaceholder;
|
||||
|
||||
SearchBar.propTypes = {
|
||||
className: PropTypes.string,
|
||||
title: PropTypes.string,
|
||||
search: PropTypes.string,
|
||||
searchInputOnChange: PropTypes.func
|
||||
};
|
||||
|
||||
module.exports = SearchBar;
|
||||
3
src/common/SearchBar/index.js
Normal file
3
src/common/SearchBar/index.js
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
const SearchBar = require('./SearchBar');
|
||||
|
||||
module.exports = SearchBar;
|
||||
41
src/common/SearchBar/styles.less
Normal file
41
src/common/SearchBar/styles.less
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
@import (reference) '~stremio-colors/dist/less/stremio-colors.less';
|
||||
|
||||
.search-bar-container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
height: 3.5rem;
|
||||
padding: 0 1rem;
|
||||
border-radius: 3.5rem;
|
||||
border: var(--focus-outline-size) solid transparent;
|
||||
background-color: @color-background;
|
||||
cursor: text;
|
||||
|
||||
&:hover, &:focus-within {
|
||||
background-color: @color-background-light1;
|
||||
}
|
||||
|
||||
&:focus-within {
|
||||
border: var(--focus-outline-size) solid @color-surface-light5;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
flex: 1;
|
||||
margin-right: 1rem;
|
||||
font-size: 1.1rem;
|
||||
color: @color-surface-light5;
|
||||
|
||||
&::placeholder {
|
||||
max-height: 1.2em;
|
||||
opacity: 1;
|
||||
color: @color-secondaryvariant1-light1-90;
|
||||
}
|
||||
}
|
||||
|
||||
.icon {
|
||||
flex: none;
|
||||
width: 1.5rem;
|
||||
height: 1.5rem;
|
||||
fill: @color-secondaryvariant1-90;
|
||||
}
|
||||
}
|
||||
|
|
@ -14,6 +14,7 @@ const { HorizontalNavBar, VerticalNavBar } = require('./NavBar');
|
|||
const PaginationInput = require('./PaginationInput');
|
||||
const PlayIconCircleCentered = require('./PlayIconCircleCentered');
|
||||
const Popup = require('./Popup');
|
||||
const SearchBar = require('./SearchBar');
|
||||
const SharePrompt = require('./SharePrompt');
|
||||
const Slider = require('./Slider');
|
||||
const TextInput = require('./TextInput');
|
||||
|
|
@ -51,6 +52,7 @@ module.exports = {
|
|||
PaginationInput,
|
||||
PlayIconCircleCentered,
|
||||
Popup,
|
||||
SearchBar,
|
||||
SharePrompt,
|
||||
Slider,
|
||||
TextInput,
|
||||
|
|
|
|||
Loading…
Reference in a new issue