Commit 850d7b56 authored by Vinh's avatar Vinh

create detail profile page

parent 75165956
...@@ -29,6 +29,8 @@ import Login from "views/examples/Login.js"; ...@@ -29,6 +29,8 @@ import Login from "views/examples/Login.js";
import Profile from "views/examples/Profile.js"; import Profile from "views/examples/Profile.js";
import Register from "views/examples/Register.js"; import Register from "views/examples/Register.js";
import Tracecode from "views/examples/Tracecode.js" import Tracecode from "views/examples/Tracecode.js"
import DetailProfile from "views/examples/DetailProfile.js"
import { Routes } from "./reoutes";
ReactDOM.render( ReactDOM.render(
<BrowserRouter> <BrowserRouter>
...@@ -39,6 +41,11 @@ ReactDOM.render( ...@@ -39,6 +41,11 @@ ReactDOM.render(
exact exact
render={props => <Tracecode {...props} />} render={props => <Tracecode {...props} />}
/> />
<Route
path={'/profile/detail'}
exact
render={props => <DetailProfile {...props} />}
/>
<Route <Route
path="/landing-page" path="/landing-page"
exact exact
......
export const Routes = {
SearchDetail: { path: "./profile"},
TraceCode: { path: "./trace-code"}
}
\ No newline at end of file
...@@ -60,6 +60,7 @@ class Index extends React.Component { ...@@ -60,6 +60,7 @@ class Index extends React.Component {
<Hero /> <Hero />
<section className="section"> <section className="section">
<Container> <Container>
<Inputs />
</Container> </Container>
</section> </section>
</main> </main>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/ */
import React from "react"; import React, { useState, useEffect } from "react";
// nodejs library that concatenates classes // nodejs library that concatenates classes
import classnames from "classnames"; import classnames from "classnames";
// reactstrap components // reactstrap components
...@@ -27,49 +27,85 @@ import { ...@@ -27,49 +27,85 @@ import {
InputGroup, InputGroup,
Container, Container,
Row, Row,
Col Col,
Button,
Form
} from "reactstrap"; } from "reactstrap";
import { useHistory } from 'react-router-dom';
import dummyData from "../../data/index.json";
import { Routes } from "../../reoutes";
class Inputs extends React.Component { const Inputs = () => {
state = {}; const [searchProfile, setSearchProfile] = useState();
render() { const history = useHistory();
const handleChangeSearch = (event) => {
console.log("change change");
setSearchProfile(event.target.value);
}
const onHandleSearch = () => {
console.log("dummyData.data", dummyData.data);
const nameCode = dummyData.data.map(item => item.code);
console.log("nameCode", nameCode);
if(searchProfile === nameCode){
history.push({
pathname: Routes.SearchProfile.path + `${searchProfile}`,
state: { code_name: searchProfile }
});
}else {
history.push("");
}
console.log("this.state.searchProfile", searchProfile);
}
return ( return (
<> <>
<section className="section pb-0 section-components"> <section className="section pb-0 section-components">
<Container className="mb-5"> <Container className="mb-5">
{/* Inputs */} {/* Inputs */}
<h3 className="h4 text-success font-weight-bold mb-4">Inputs</h3> <h3 className="h4 text-success font-weight-bold mb-4">Search profile</h3>
<div className="mb-3"> {/* <div className="mb-3">
<small className="text-uppercase font-weight-bold"> <small className="text-uppercase font-weight-bold">
Form controls Form controls
</small> </small>
</div> </div> */}
<Row> <Row>
<Col lg="4" sm="6"> <Col lg="4" sm="6">
<FormGroup> {/* <FormGroup>
<Input placeholder="Regular" type="text" /> <Input placeholder="Regular" type="text" />
</FormGroup> </FormGroup> */}
<FormGroup
className={classnames({ <FormGroup
focused: this.state.searchFocused // className={classnames({
})} // focused: this.state.searchFocused
> // })}
<InputGroup className="mb-4"> >
<InputGroupAddon addonType="prepend"> <InputGroup className="mb-4">
<InputGroupText> <InputGroupAddon addonType="prepend">
<i className="ni ni-zoom-split-in" /> <InputGroupText>
</InputGroupText> <i className="ni ni-zoom-split-in" />
</InputGroupAddon> </InputGroupText>
<Input </InputGroupAddon>
placeholder="Search" <Input
type="text" placeholder="Search"
onFocus={e => this.setState({ searchFocused: true })} type="text"
onBlur={e => this.setState({ searchFocused: false })} // onFocus={e => this.setState({ searchFocused: true })}
/> // onBlur={e => this.setState({ searchFocused: false })}
</InputGroup> value={searchProfile}
</FormGroup> onChange={handleChangeSearch}
/>
</InputGroup>
</FormGroup>
<Button className="btn-1" color="primary" type="button" onClick={onHandleSearch} >
Search
</Button>
</Col> </Col>
<Col lg="4" sm="6">
{/* <Col lg="4" sm="6">
<FormGroup> <FormGroup>
<Input disabled placeholder="Regular" type="text" /> <Input disabled placeholder="Regular" type="text" />
</FormGroup> </FormGroup>
...@@ -108,12 +144,12 @@ class Inputs extends React.Component { ...@@ -108,12 +144,12 @@ class Inputs extends React.Component {
type="email" type="email"
/> />
</FormGroup> </FormGroup>
</Col> </Col> */}
</Row> </Row>
</Container> </Container>
<div className="py-5 bg-secondary"> {/* <div className="py-5 bg-secondary">
<Container> <Container>
{/* Inputs (alternative) */} Inputs (alternative)
<div className="mb-3"> <div className="mb-3">
<small className="text-uppercase font-weight-bold"> <small className="text-uppercase font-weight-bold">
Form controls (alternative) Form controls (alternative)
...@@ -199,11 +235,10 @@ class Inputs extends React.Component { ...@@ -199,11 +235,10 @@ class Inputs extends React.Component {
</Col> </Col>
</Row> </Row>
</Container> </Container>
</div> </div> */}
</section> </section>
</> </>
); );
}
} }
export default Inputs; export default Inputs;
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment