-
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.
[DELETE] toolbar and buttoms components
- Loading branch information
Hanner Enrique De La Hoz Barraza
committed
Apr 30, 2023
1 parent
e91ffc5
commit 0b249c5
Showing
11 changed files
with
123 additions
and
72 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
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import {useState, useEffect} from "react"; | ||
|
||
export function getEditorials() { | ||
const [data, setData] = useState(null); | ||
const [loading, setLoading] = useState(true); | ||
const [error, setError] = useState(null); | ||
useEffect(() => { | ||
setLoading(true); | ||
fetch(`http://localhost:4444/api/v1/book-reserve/editorials`) | ||
.then((response) => response.json()) | ||
.then((data) => setData(data)) | ||
.catch((error) => setError(error.message)) | ||
.finally(() => setLoading(false)); | ||
}, []); | ||
return {data, loading, error}; | ||
} | ||
|
||
export function getEditorialById(editorialId) { | ||
const [data, setData] = useState(null); | ||
const [loading, setLoading] = useState(true); | ||
const [error, setError] = useState(null); | ||
useEffect(() => { | ||
setLoading(true); | ||
fetch(`http://localhost:4444/api/v1/book-reserve/editorials/${editorialId}`) | ||
.then((response) => response.json()) | ||
.then((data) => setData(data)) | ||
.catch((error) => setError(error.message)) | ||
.finally(() => setLoading(false)); | ||
}, []); | ||
return {data, loading, error}; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
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,46 @@ | ||
import React from "react"; | ||
|
||
import Error from "../Handle/Error"; | ||
import Loading from "../Handle/Loading"; | ||
import {getEditorials} from "../API/EditorialAPI"; | ||
|
||
export default function Editorial() { | ||
const {data, loading, error} = getEditorials(); | ||
return ( | ||
<> | ||
{/* start-toolbar */} | ||
<div className="row"> | ||
<div className="col-12 mb-4 text-center"> | ||
<button className="btn btn-dark"> | ||
<i className="fa-solid fa-circle-plus"></i> Añadir | ||
</button> | ||
</div> | ||
</div> | ||
{/* end-toolbar */} | ||
{/* start-content */} | ||
<div className="row"> | ||
{error && <Error message={error} />} | ||
{loading && <Loading />} | ||
{data?.map((result, index) => ( | ||
<div className="col-md-4 mb-4" key={result.editorial_id}> | ||
<div className="card"> | ||
{/* <img src={result.image} className="card-img-top" alt={result.editorial_name} /> */} | ||
<div className="card-body"> | ||
<h5 className="card-title">{result.editorial_name}</h5> | ||
<p className="card-text">{result.editorial_description}</p> | ||
<button className="btn btn-warning"> | ||
<i className="fa-solid fa-edit"></i> | ||
</button> | ||
| ||
<button className="btn btn-danger"> | ||
<i className="fa-solid fa-trash"></i> | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
))} | ||
</div> | ||
{/* end-content */} | ||
</> | ||
); | ||
} |
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,20 +1,27 @@ | ||
import Button from "react-bootstrap/Button"; | ||
import Modal from "react-bootstrap/Modal"; | ||
import React from "react"; | ||
|
||
export default function MyVerticallyCenteredModal(props) { | ||
export default function Modal({id, title, textbtn, body, submit}) { | ||
return ( | ||
<Modal {...props} size="lg" aria-labelledby="contained-modal-title-vcenter" centered> | ||
<Modal.Header closeButton> | ||
<Modal.Title id="contained-modal-title-vcenter">Modal heading</Modal.Title> | ||
</Modal.Header> | ||
<Modal.Body> | ||
<h4>Centered Modal</h4> | ||
<p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p> | ||
</Modal.Body> | ||
<Modal.Footer> | ||
<Button variant="secondary">Cerrar</Button> | ||
<Button variant="primary">Guardar</Button> | ||
</Modal.Footer> | ||
</Modal> | ||
<div className="modal fade" id={id}> | ||
<div className="modal-dialog modal-dialog-centered"> | ||
<div className="modal-content"> | ||
<div className="modal-header"> | ||
<h4 className="modal-title">{title}</h4> | ||
<button type="button" className="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> | ||
</div> | ||
<form onSubmit={submit}> | ||
<div className="modal-body">{body}</div> | ||
<div className="modal-footer"> | ||
<button type="button" className="btn secondary btn-sm px-4" data-bs-dismiss="modal"> | ||
Cerrar | ||
</button> | ||
<button type="submit" className="btn primary btn-sm px-4"> | ||
{textbtn} | ||
</button> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
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 was deleted.
Oops, something went wrong.