github.com/quickfeed/quickfeed@v0.0.0-20240507093252-ed8ca812a09c/public/src/components/admin/Button.tsx (about) 1 import React from "react" 2 import { Color } from "../../Helpers" 3 4 export enum ButtonType { 5 BADGE = "badge badge", 6 BUTTON = "btn btn", 7 OUTLINE = "btn btn-outline", 8 UNSTYLED = "btn btn-link p-0", 9 } 10 11 export type ButtonProps = { 12 children?: React.ReactNode, 13 text: string, 14 color: Color, 15 type: ButtonType, 16 className?: string, 17 onClick: () => void, 18 } 19 20 const Button = ({ children, text, color, type, className, onClick }: ButtonProps): JSX.Element => { 21 return ( 22 <button className={`${type}-${color}${className ? " " + className : ""}`} onClick={onClick}> 23 {children} 24 {text} 25 </button> 26 ) 27 } 28 29 export default Button