Skip to content

Commit

Permalink
feat: Create a SearchInput component
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Jun 18, 2020
1 parent 28c97df commit ac158ad
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/components/SearchInput.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import FeatherIcon from './FeatherIcon';
import styles from './SearchInput.module.scss';

const SearchInput = ({ className, ...props }) => (
<div className={cx(styles.container, className)}>
<input {...props} className={styles.input} type="text" />
<FeatherIcon name="search" className={styles.icon} />
</div>
);

SearchInput.propTypes = {
className: PropTypes.string,
};

export default SearchInput;
19 changes: 19 additions & 0 deletions src/components/SearchInput.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.container {
display: inline-flex;
align-items: center;
width: 100%;
position: relative;
}

.icon {
position: absolute;
right: 0.5rem;
stroke: var(--color-neutrals-700);
}

.input {
width: 100%;
font-size: 0.875rem;
padding: 0.5rem;
padding-right: calc(1rem + 1em);
}

0 comments on commit ac158ad

Please sign in to comment.