Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
sky172839465 committed Mar 3, 2019
1 parent 9054695 commit a55b009
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/Component/Common/AppHeader/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'

const AppHeader = ({name, link}) => {
const AppHeader = ({ name, link }) => {
return (
<nav className='navbar is-primary' role='navigation' aria-label='main navigation'>
<div className='navbar-brand'>
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Common/ResultNotFound/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import clx from 'classnames'

const ResultNotFound = ({className = 'is-primary', onDelete, children}) => (
const ResultNotFound = ({ className = 'is-primary', onDelete, children }) => (
<div className={clx('notification', className)}>
<button className='delete' onClick={onDelete} />
{children}
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Page/NotFound/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'

const NotFound = ({message = 'Oops! Not found page.'}) => {
const NotFound = ({ message = 'Oops! Not found page.' }) => {
return (
<div
data-role='not-found'
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Page/Search/RepoCard/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'

const RepoCard = (props) => {
const {repo = {}} = props
const { repo = {} } = props
const {
name,
description,
Expand Down
6 changes: 3 additions & 3 deletions src/Component/Page/Search/SearchArea/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const SearchArea = (props) => {
name='userName'
className={clx(
'input is-fullwidth',
{'is-primary': !isEmptyUserName},
{'is-danger': isEmptyUserName}
{ 'is-primary': !isEmptyUserName },
{ 'is-danger': isEmptyUserName }
)}
placeholder='Find user'
onChange={onUserNameChange}
Expand All @@ -40,7 +40,7 @@ const SearchArea = (props) => {
type='submit'
className={clx(
'button is-primary is-outlined',
{'is-loading': isLoading}
{ 'is-loading': isLoading }
)}
disabled={isEmptyUserName}
>
Expand Down
20 changes: 10 additions & 10 deletions src/Component/Page/Search/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, {Component} from 'react'
import {withRouter} from 'react-router-dom'
import React, { Component } from 'react'
import { withRouter } from 'react-router-dom'
import clx from 'classnames'
import _ from 'lodash'
import {API_END_POINT} from '../../../constant'
import { API_END_POINT } from '../../../constant'
import SearchArea from './SearchArea'
import RepoCard from './RepoCard'
import ResultNotFound from '../../Common/ResultNotFound'
Expand All @@ -18,23 +18,23 @@ class Search extends Component {
}

componentDidMount () {
const {location} = this.props
const { location } = this.props
const params = new URLSearchParams(_.get(location, 'search', ''))
const defaultUserName = params.get('userName') || ''
this.setState(
() => ({userName: defaultUserName}),
() => ({ userName: defaultUserName }),
() => !_.isEmpty(defaultUserName) && this.submitForm()
)
}

submitForm = (event) => {
const {history, location} = this.props
const {userName} = this.state
const { history, location } = this.props
const { userName } = this.state
if (event) {
event.preventDefault()
history.push({
pathname: _.get(location, 'pathname', ''),
search: `?${_.toString(new URLSearchParams({userName}))}`
search: `?${_.toString(new URLSearchParams({ userName }))}`
})
}
this.setState({
Expand Down Expand Up @@ -62,7 +62,7 @@ class Search extends Component {
})
}

onUserNameChange = e => this.setState({userName: e.target.value})
onUserNameChange = e => this.setState({ userName: e.target.value })

render () {
const {
Expand All @@ -83,7 +83,7 @@ class Search extends Component {
}
const resultNotFoundProps = {
className: '',
onDelete: () => this.setState({message: ''})
onDelete: () => this.setState({ message: '' })
}
return (
<React.Fragment>
Expand Down

0 comments on commit a55b009

Please sign in to comment.