-
Notifications
You must be signed in to change notification settings - Fork 4
/
EditButton.tsx
28 lines (25 loc) · 972 Bytes
/
EditButton.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { faPencil } from "@fortawesome/pro-solid-svg-icons"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import * as React from "react"
import { Button, ButtonProps } from "reactstrap"
import { makeIdFromString } from "../../global/utils"
import UncontrolledTooltipWrapper from "../UncontrolledTooltipWrapper"
type Props = ButtonProps & {
content?: string
}
/** Tlačítko pro úpravu objektu v aplikaci. */
const EditButton: React.FC<Props> = ({ content = "Upravit", onClick, contentId, ...props }) => (
<>
<Button
color="primary"
id={`EditButton_${makeIdFromString(content)}_${contentId}`}
onClick={onClick}
{...props}>
<FontAwesomeIcon icon={faPencil} />
</Button>
<UncontrolledTooltipWrapper target={`EditButton_${makeIdFromString(content)}_${contentId}`}>
{content}
</UncontrolledTooltipWrapper>
</>
)
export default EditButton