Download tabler-react/src/components/PricingCard/PricingCardButton.react.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.16 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/tabler-react/src/components/PricingCard/PricingCardButton.react.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/tabler-react/src/components/PricingCard/PricingCardButton.react.js
-
curl -L -o PricingCardButton.react.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/tabler-react/src/components/PricingCard/PricingCardButton.react.js
1.16 kB
| // @flow | |
| import * as React from "react"; | |
| import cn from "classnames"; | |
| // TODO: Add onClick Event Handler | |
| // TODO : Add color prop | |
| type Props = {| | |
| +children?: React.Node, | |
| +className?: string, | |
| +RootComponent?: React.ElementType, | |
| +active?: boolean, | |
| +href?: string, | |
| +to?: string, | |
| +onClick?: (event: SyntheticMouseEvent<HTMLInputElement>) => mixed, | |
| |}; | |
| function PricingCardButton({ | |
| className, | |
| children, | |
| RootComponent, | |
| active, | |
| href, | |
| to, | |
| onClick, | |
| }: Props): React.Node { | |
| const classes = cn("text-center", "mt-6"); | |
| const Component = RootComponent || "a"; | |
| const componentClasses = cn( | |
| "btn", | |
| active ? "btn-green" : "btn-secondary", | |
| "btn-block", | |
| className | |
| ); | |
| const otherProps = {}; | |
| if (href) { | |
| otherProps.href = href; | |
| } | |
| if (to) { | |
| otherProps.to = to; | |
| } | |
| if (onClick) { | |
| otherProps.role = "button"; | |
| otherProps.onClick = onClick; | |
| } | |
| return ( | |
| <div className={classes}> | |
| <Component className={componentClasses} {...otherProps}> | |
| {children} | |
| </Component> | |
| </div> | |
| ); | |
| } | |
| PricingCardButton.displayName = "PricingCard.Button"; | |
| export default PricingCardButton; | |