results page first commit.
This commit is contained in:
parent
ff519477ac
commit
fde16110cc
|
@ -26,6 +26,7 @@ class App extends Component {
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route exact={true} path="/" component={Home}/>
|
<Route exact={true} path="/" component={Home}/>
|
||||||
<Route path="/topics" component={TopicsListContainer}/>
|
<Route path="/topics" component={TopicsListContainer}/>
|
||||||
|
<Route path="/results/:categoryKey/:searchValue" component={Results}/>
|
||||||
<Route path="/videos/:videoId" component={Video}/>
|
<Route path="/videos/:videoId" component={Video}/>
|
||||||
</Switch>
|
</Switch>
|
||||||
<Nav/>
|
<Nav/>
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
// Topics Action Types
|
// Topics Action Types
|
||||||
export const START_LOADING_ALL_TOPICS = 'START_LOADING_ALL_TOPICS';
|
export const START_LOADING_ALL_TOPICS = 'START_LOADING_ALL_TOPICS';
|
||||||
export const LOADED_ALL_TOPICS = 'LOADED_ALL_TOPICS';
|
export const LOADED_ALL_TOPICS = 'LOADED_ALL_TOPICS';
|
||||||
|
@ -9,3 +8,8 @@ export const LOADED_RANDOM_TOPIC = 'LOADED_RANDOM_TOPIC';
|
||||||
export const ADD_VIDEOS_TO_STATE = 'ADD_VIDEOS_TO_STATE';
|
export const ADD_VIDEOS_TO_STATE = 'ADD_VIDEOS_TO_STATE';
|
||||||
export const START_LOADING_VIDEO = 'START_LOADING_VIDEO';
|
export const START_LOADING_VIDEO = 'START_LOADING_VIDEO';
|
||||||
export const LOADED_VIDEO = 'LOADED_VIDEO';
|
export const LOADED_VIDEO = 'LOADED_VIDEO';
|
||||||
|
|
||||||
|
|
||||||
|
// Search Results Action Types
|
||||||
|
export const START_LOADING_ALL_RESULTS = 'START_LOADING_ALL_RESULTS';
|
||||||
|
export const LOADED_ALL_RESULTS = 'LOADED_ALL_RESULTS';
|
12
src/actions/search.js
Normal file
12
src/actions/search.js
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import {LOADED_ALL_RESULTS,START_LOADING_ALL_RESULTS} from "./action_types";
|
||||||
|
|
||||||
|
export function getAllResuts(categoryKey, searchValue){
|
||||||
|
// get the stuff from the api
|
||||||
|
// dispatch loaded
|
||||||
|
return dispatch => {
|
||||||
|
dispatch(loadingAllResults())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function loadingAllResults() {
|
||||||
|
|
||||||
|
}
|
|
@ -39,7 +39,6 @@ class TopicsList extends React.Component {
|
||||||
|
|
||||||
{this.state.filteredTopics.map(topic => {
|
{this.state.filteredTopics.map(topic => {
|
||||||
return (
|
return (
|
||||||
|
|
||||||
<section className="topic-item" key={topic.name}>
|
<section className="topic-item" key={topic.name}>
|
||||||
<Link to={"/topic/" + topic.name}>
|
<Link to={"/topic/" + topic.name}>
|
||||||
<h3>{topic.name} ({topic.items} videos)</h3>
|
<h3>{topic.name} ({topic.items} videos)</h3>
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {connect} from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
import { getAllTopics, getRandomTopicVideos } from '../actions/topics';
|
import { getAllTopics, getRandomTopicVideos } from '../actions/topics';
|
||||||
import Search from '../components/Search';
|
|
||||||
import Footer from '../components/Footer';
|
|
||||||
import RandomLocation from "../components/RandomLocation";
|
import RandomLocation from "../components/RandomLocation";
|
||||||
import RandomDate from "../components/RandomDate";
|
import RandomDate from "../components/RandomDate";
|
||||||
import RandomTopic from "../components/RandomTopic";
|
import RandomTopic from "../components/RandomTopic";
|
||||||
import Header from "../components/Header";
|
|
||||||
|
|
||||||
class Home extends React.Component {
|
class Home extends React.Component {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
|
26
src/containers/Results.js
Normal file
26
src/containers/Results.js
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
class Results extends React.Component {
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
const categoryKey = this.props.match.params.categoryKey;
|
||||||
|
const searchValue = this.props.match.params.searchValue;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const mapStateToProps = state => ({
|
||||||
|
searchResults: this.state.results.currentItems,
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = dispatch => ({
|
||||||
|
searchResults: (categoryKey, searchValue) => dispatch(getSearchResults(categoryKey, searchValue)),
|
||||||
|
});
|
||||||
|
|
||||||
|
export default;
|
Loading…
Reference in New Issue
Block a user