-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
468 additions
and
338 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"siteId": "d17b7f4e-b594-4503-b1be-d45e20b435c1" | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
object-assign | ||
(c) Sindre Sorhus | ||
@license MIT | ||
*/ | ||
|
||
/** @license React v0.20.2 | ||
* scheduler.production.min.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
/** @license React v16.13.1 | ||
* react-is.production.min.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
/** @license React v17.0.2 | ||
* react-dom.production.min.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
/** @license React v17.0.2 | ||
* react.production.min.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[build] | ||
publish="dist" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,39 @@ | ||
import React, { Component, Fragment } from 'react' | ||
import React from 'react' | ||
import { BrowserRouter, Route, Switch, Link, NavLink } from 'react-router-dom' | ||
|
||
import Navbar from './Navbar' | ||
import Search from './Search' | ||
import Users from './Users' | ||
import Home from './Home' | ||
import Alert from './Alert' | ||
import UserDetails from './UserDetails' | ||
import axios from 'axios' | ||
|
||
|
||
export class App extends Component { | ||
constructor(props){ | ||
super(props) | ||
|
||
this.searchUser = this.searchUser.bind(this); | ||
this.cleanResults = this.cleanResults.bind(this); | ||
this.setAlert = this.setAlert.bind(this); | ||
this.getUser = this.getUser.bind(this); | ||
|
||
this.state={ | ||
loading :false, | ||
users:[], | ||
user: {}, | ||
alert: null | ||
|
||
} | ||
} | ||
|
||
searchUser(keyword){ | ||
this.setState({loading: true}); | ||
|
||
axios.get(`https://api.github.com/search/users?q=${keyword}`).then(res=> | ||
this.setState({users:res.data.items, loading:false})); | ||
} | ||
|
||
getUser(username) { | ||
this.setState({loading: true}); | ||
setTimeout(() => { | ||
axios | ||
.get(`https://api.github.com/users/${username}`) | ||
.then(res => this.setState({user: res.data, loading: false})); | ||
}, 1000); | ||
} | ||
|
||
|
||
cleanResults(keyword){ | ||
this.setState({users: []}) | ||
} | ||
|
||
setAlert(msg, type){ | ||
this.setState({ | ||
alert:{msg, type} | ||
}) | ||
|
||
setTimeout(() => { | ||
this.setState({ | ||
alert:null | ||
}) | ||
}, 3000); | ||
} | ||
|
||
|
||
render() { | ||
return ( | ||
<BrowserRouter> | ||
<Navbar /> | ||
<Alert alert= {this.state.alert}/> | ||
<Switch> | ||
<Route exact path="/" render={ props=> ( | ||
<> | ||
<Search | ||
searchUserq={this.searchUser} | ||
cleanResults={this.cleanResults} | ||
clearButtonStatus = {this.state.users.length > 0 ? true : false} | ||
setAlert={this.setAlert} | ||
/> | ||
<Users users={this.state.users} loading={this.state.loading}/> | ||
</> | ||
) | ||
} /> | ||
|
||
<Route path="/user/:login" render= {props => ( | ||
<UserDetails {...props} getUser= {this.getUser} user={this.state.user} loading={this.state.loading}/> | ||
)} /> | ||
</Switch> | ||
</BrowserRouter> | ||
) | ||
} | ||
import NotFound from './NotFound' | ||
|
||
import State from "../context/github/State" | ||
import AState from "../context/alert/AState" | ||
|
||
const App=()=> { | ||
return ( | ||
<State> {/*State.js de tanımlanan Context.provider value larına diğer componentlerin ulaşması için gerekiyor.*/} | ||
<AState> | ||
<BrowserRouter> | ||
<Navbar /> | ||
<Alert/> | ||
<Switch> | ||
{/* <Route exact path="/" render={props=> ( | ||
<> | ||
<Search/> | ||
<Users/> | ||
</> | ||
)}/> */ | ||
} | ||
<Route exact path="/" component={Home}/> | ||
|
||
<Route path="/user/:login" component={UserDetails}/> | ||
<Route component={NotFound}/> | ||
</Switch> | ||
</BrowserRouter> | ||
</AState> | ||
</State> | ||
) | ||
} | ||
|
||
export default App | ||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from "react"; | ||
import Search from './Search' | ||
import Users from './Users' | ||
|
||
const Home=()=>{ | ||
return( | ||
<> | ||
<Search/> | ||
<Users/> | ||
</> | ||
) | ||
} | ||
|
||
export default Home; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from "react"; | ||
|
||
const NotFound= ()=>{ | ||
return( | ||
<div className="container pt-3"> | ||
<h1>404 Not Found</h1> | ||
</div> | ||
) | ||
} | ||
|
||
export default NotFound; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.