Skip to content
This repository has been archived by the owner on Jun 7, 2021. It is now read-only.

Commit

Permalink
UPDATE
Browse files Browse the repository at this point in the history
- Links and routes for searching
  • Loading branch information
snwolak committed Sep 12, 2018
1 parent 74b37ed commit 1b43bb2
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/App.js
Expand Up @@ -174,7 +174,7 @@ class App extends Component {

<Route path="/redirect" component={RedirectLoginToken} />
<Route
path="/search"
path="/search/:tag/:category"
render={props => <Search {...props} login={this.state.login} />}
/>
<Route path="/@:username" render={props => <Blog {...props} />} />
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Post/index.js
Expand Up @@ -223,7 +223,7 @@ class Post extends Component {
<Link
key={this.props.post.category}
style={tagStyles}
to={`/search/tag/?${this.props.post.category}`}
to={`/search/${this.props.post.category}/new`}
>
#{this.props.post.category}
</Link>
Expand All @@ -238,7 +238,7 @@ class Post extends Component {
<Link
key={tag}
style={tagStyles}
to={`/search/tag/?${tag}`}
to={`/search/${tag}/new`}
>
#{tag}
</Link>
Expand Down
2 changes: 1 addition & 1 deletion src/Header/SearchInput.js
Expand Up @@ -51,7 +51,7 @@ class SearchInput extends Component {
return (
<Form onSubmit={this.handleSubmit}>
{this.state.isSubmitted ? (
<Redirect to={`/search/tag/?${this.state.search}`} />
<Redirect to={`/search/${this.state.search}/new`} />
) : (
void 0
)}
Expand Down
2 changes: 1 addition & 1 deletion src/Header/SearchInputMobile.js
Expand Up @@ -67,7 +67,7 @@ export default class SearchInput extends Component {
return (
<Container>
{this.state.isSubmitted ? (
<Redirect to={`/search/tag/?${this.state.search}`} />
<Redirect to={`/search/${this.state.search}/new`} />
) : (
void 0
)}
Expand Down
10 changes: 7 additions & 3 deletions src/Search/HeaderTabs.js
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import styled from "styled-components";
import colors from "../styles/colors";
import { hot } from "react-hot-loader";
import { Link } from "react-router-dom";
import { NavLink } from "react-router-dom";
const NavBar = styled.div`
display: inline-flex;
background-color: ${colors.background};
Expand Down Expand Up @@ -58,9 +58,13 @@ const HeaderTabs = ({ match }) => {
{content.map(name => {
const treatedName = name[0].toUpperCase() + name.slice(1);
return (
<Link key={name} activeClassName="selected" to={`/explore/${name}`}>
<NavLink
key={name}
activeClassName="selected"
to={`/search/${match.params.tag}/${name}`}
>
{treatedName.replace("-", " ")}
</Link>
</NavLink>
);
})}
</NavBar>
Expand Down

0 comments on commit 1b43bb2

Please sign in to comment.