mirror of
https://github.com/samuelcolvin/FastUI.git
synced 2023-12-01 22:22:11 +03:00
24 lines
577 B
TypeScript
24 lines
577 B
TypeScript
import { FC } from 'react'
|
|
|
|
import { ClassName, useClassNameGenerator } from '../hooks/className'
|
|
import { useFireEvent, PageEvent, GoToEvent } from '../hooks/event'
|
|
|
|
export interface ButtonProps {
|
|
type: 'Button'
|
|
text: string
|
|
onClick?: PageEvent | GoToEvent
|
|
className?: ClassName
|
|
}
|
|
|
|
export const ButtonComp: FC<ButtonProps> = (props) => {
|
|
const { className, text, onClick } = props
|
|
|
|
const { fireEvent } = useFireEvent()
|
|
|
|
return (
|
|
<button className={useClassNameGenerator(className, props)} onClick={() => fireEvent(onClick)}>
|
|
{text}
|
|
</button>
|
|
)
|
|
}
|