Download tabler-react/src/components/List/ListGroupItem.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/List/ListGroupItem.react.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/tabler-react/src/components/List/ListGroupItem.react.js
-
curl -L -o ListGroupItem.react.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/tabler-react/src/components/List/ListGroupItem.react.js
1.16 kB
| // @flow | |
| import * as React from "react"; | |
| import cn from "classnames"; | |
| import { Icon } from "../../components"; | |
| type Props = {| | |
| +children?: React.Node, | |
| +className?: string, | |
| +RootComponent?: React.ElementType, | |
| +active?: boolean, | |
| +action?: boolean, | |
| +icon?: string, | |
| +to?: string, | |
| |}; | |
| function ListGroupItem({ | |
| className, | |
| children, | |
| RootComponent, | |
| active, | |
| action, | |
| icon, | |
| to, | |
| }: Props): React.Node { | |
| const classes = cn( | |
| "list-group-item", | |
| { | |
| "list-group-item-action": action, | |
| }, | |
| { | |
| active: active, | |
| }, | |
| className | |
| ); | |
| // const Component = RootComponent || "a"; | |
| return RootComponent ? ( | |
| <RootComponent to={to} className={classes}> | |
| {icon && ( | |
| <span className="mr-3 icon"> | |
| <Icon prefix="fe" name={icon} />{" "} | |
| </span> | |
| )} | |
| {children} | |
| </RootComponent> | |
| ) : ( | |
| <a className={classes} href={to}> | |
| {icon && ( | |
| <span className="mr-3 icon"> | |
| <Icon prefix="fe" name={icon} />{" "} | |
| </span> | |
| )} | |
| {children} | |
| </a> | |
| ); | |
| } | |
| ListGroupItem.displayName = "List.GroupItem"; | |
| /** @component */ | |
| export default ListGroupItem; | |