MCPcopy Create free account
hub / github.com/bsoc-bitbyte/busify / CustomButton

Function CustomButton

frontend/src/components/CustomButton/index.tsx:6–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4import {Link} from 'react-router-dom';
5
6const CustomButton: React.FC<CustomButtonProps> = props => {
7 const renderIcon = () => {
8 return props.icon && <IconButton>props.icon</IconButton>;
9 };
10
11 const renderBtnContent = () => {
12 return (
13 <>
14 {props.label}
15 {renderIcon()}
16 </>
17 );
18 };
19 const button_component = (
20 <Link to={props.href ? props.href : '#'}>
21 <Button
22 variant={props.variant}
23 color={props.color}
24 size={props.size}
25 disabled={props.disabled || props.loading}
26 onClick={props.onClick}
27 >
28 {renderBtnContent()}
29 </Button>
30 </Link>
31 );
32 return (
33 <>
34 {props.title ? (
35 <Tooltip title={props.title} placement={props.placement}>
36 {button_component}
37 </Tooltip>
38 ) : (
39 button_component
40 )}
41 </>
42 );
43};
44
45CustomButton.propTypes = {
46 label: PropTypes.string.isRequired,

Callers

nothing calls this directly

Calls 1

renderBtnContentFunction · 0.85

Tested by

no test coverage detected