sub-manager-frontend/src/Components/PageHeader.jsx

48 lines
1.4 KiB
React
Raw Normal View History

2023-09-12 14:27:30 +00:00
import plus from '../assets/plus.svg'
import pencil from '../assets/pencil.svg'
import trash from '../assets/trash.svg'
2023-09-13 09:50:57 +00:00
import { Link, Form, useNavigate } from 'react-router-dom'
export default function (props) {
const navigate = useNavigate()
return (
2023-09-12 14:27:30 +00:00
<header id="page-header">
2023-09-10 15:01:05 +00:00
<h2>
{props.super}
</h2>
2023-09-06 15:14:50 +00:00
<h1>
2023-09-10 15:01:05 +00:00
{props.heading}
2023-09-06 15:14:50 +00:00
</h1>
2023-09-12 14:27:30 +00:00
<span id="icon-container">
2023-09-13 09:50:57 +00:00
<button onClick={() => { navigate(`${props.url}/create`) }}>
<img src={plus} />
</button>
<button onClick={() => { navigate(`${props.url}${props?.id ? `/${props.id}` : ""}/edit`) }}>
<img src={pencil} />
</button>
<Form
method="post"
action="delete"
onSubmit={(event) => {
if (
!confirm(
"Please confirm you want to delete this record."
)
) {
event.preventDefault();
}
}}
>
<button type="submit"
><img src={trash} /></button>
</Form>
2023-09-12 14:27:30 +00:00
</span>
2023-09-13 09:50:57 +00:00
2023-09-06 15:14:50 +00:00
</header>
)
}