From 6656e25aaf9c1a00e997bf147e1f96ec49309c57 Mon Sep 17 00:00:00 2001 From: Sharyn Date: Mon, 9 Jul 2018 10:22:48 +0200 Subject: [PATCH] Extracting searchBar into its own component --- components/browseArchives/index.js | 19 +++++------------- components/browseArchives/style.scss | 28 --------------------------- components/searchBar/index.js | 25 ++++++++++++++++++++++++ components/searchBar/style.scss | 29 ++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+), 42 deletions(-) create mode 100644 components/searchBar/index.js create mode 100644 components/searchBar/style.scss diff --git a/components/browseArchives/index.js b/components/browseArchives/index.js index 678d6ef..48d0f44 100644 --- a/components/browseArchives/index.js +++ b/components/browseArchives/index.js @@ -4,11 +4,12 @@ import InterviewsList from '../interviews/interviewsList'; import SingleInterview from '../interviews/singleInterview'; import TopicsList from '../topicsList'; import ProjectsList from '../projectsList'; +import SearchBar from '../searchBar'; import SearchResults from '../searchResults'; import Data from '../../data/archives/interviews'; import './style.scss'; -class Search extends React.Component { +class BrowseArchives extends React.Component { constructor(props) { super(props); @@ -67,22 +68,12 @@ class Search extends React.Component { isInterviewsListModalOpen, isSearchActive, activeSingleInterviewId, + term, } = this.state; return (
-
-
-

Browse Archives

- -
-
+
{isSearchActive && @@ -121,4 +112,4 @@ class Search extends React.Component { } } -export default Search; +export default BrowseArchives; diff --git a/components/browseArchives/style.scss b/components/browseArchives/style.scss index 35bf5ab..74be8da 100644 --- a/components/browseArchives/style.scss +++ b/components/browseArchives/style.scss @@ -1,33 +1,5 @@ @import './assets/styles/global.scss'; -.search-bar { - background-color: #efefef; - margin-bottom: calculateRem(56); - - h3 { - padding: calculateRem(32) 0 0; - text-align: center; - text-transform: uppercase; - font-family: $secondary-font; - font-size: calculateRem(36); - } -} - -.search-input { - width: 100%; - height: calculateRem(48); - border: 5px solid #efefef; - padding: calculateRem(12); - font-size: calculateRem(16); - position: relative; - bottom: calculateRem(-24); - - &:focus, - &:active { - outline: none; - } -} - .browse-content-wrap.container { margin-bottom: calculateRem(48); diff --git a/components/searchBar/index.js b/components/searchBar/index.js new file mode 100644 index 0000000..c76cae8 --- /dev/null +++ b/components/searchBar/index.js @@ -0,0 +1,25 @@ +import React from 'react'; +import { PropTypes } from 'prop-types'; +import './style.scss'; + +const SearchBar = props => ( +
+
+

Browse Archives

+ +
+
+); + +SearchBar.propTypes = { + term: PropTypes.string.isRequired, + onInputChange: PropTypes.func.isRequired, +} + +export default SearchBar; diff --git a/components/searchBar/style.scss b/components/searchBar/style.scss new file mode 100644 index 0000000..951caf9 --- /dev/null +++ b/components/searchBar/style.scss @@ -0,0 +1,29 @@ +@import './assets/styles/global.scss'; + +.search-bar { + background-color: #efefef; + margin-bottom: calculateRem(56); + + h3 { + padding: calculateRem(32) 0 0; + text-align: center; + text-transform: uppercase; + font-family: $secondary-font; + font-size: calculateRem(36); + } +} + +.search-input { + width: 100%; + height: calculateRem(48); + border: 5px solid #efefef; + padding: calculateRem(12); + font-size: calculateRem(16); + position: relative; + bottom: calculateRem(-24); + + &:focus, + &:active { + outline: none; + } +}