Download tabler-react/src/components/Nav/NavSubmenuItem.react.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 789 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/tabler-react/src/components/Nav/NavSubmenuItem.react.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/tabler-react/src/components/Nav/NavSubmenuItem.react.js
-
curl -L -o NavSubmenuItem.react.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/tabler-react/src/components/Nav/NavSubmenuItem.react.js
789 Bytes
| // @flow | |
| import * as React from "react"; | |
| import cn from "classnames"; | |
| import Icon from "../Icon"; | |
| type Props = {| | |
| +children?: React.Node, | |
| +className?: string, | |
| +RootComponent?: React.ElementType, | |
| +active?: boolean, | |
| +icon?: string, | |
| +to?: string, | |
| |}; | |
| function NavSubmenuItem({ | |
| className, | |
| RootComponent, | |
| icon, | |
| children, | |
| active = false, | |
| to, | |
| }: Props): React.Node { | |
| const classes = cn({ "nav-item": true, active: active }, className); | |
| const Component = RootComponent || "a"; | |
| return ( | |
| <Component className={classes} to={to}> | |
| {icon && ( | |
| <React.Fragment> | |
| <Icon name={icon} />{" "} | |
| </React.Fragment> | |
| )} | |
| {children} | |
| </Component> | |
| ); | |
| } | |
| NavSubmenuItem.displayName = "Nav.SubmenuItem"; | |
| export default NavSubmenuItem; | |