| 1 |
import { css } from '@patternfly/react-styles'; |
| 2 |
import styles from '@patternfly/react-styles/css/components/ToggleGroup/toggle-group'; |
| 3 |
|
| 4 |
export enum ToggleGroupItemVariant { |
| 5 |
icon = 'icon', |
| 6 |
text = 'text' |
| 7 |
} |
| 8 |
|
| 9 |
export interface ToggleGroupItemElementProps { |
| 10 |
/** Content rendered inside the toggle group item */ |
| 11 |
children?: React.ReactNode; |
| 12 |
/** Adds toggle group item variant styles */ |
| 13 |
variant?: ToggleGroupItemVariant | 'icon' | 'text'; |
| 14 |
} |
| 15 |
|
| 16 |
export const ToggleGroupItemElement: React.FunctionComponent<ToggleGroupItemElementProps> = ({ variant, children }) => ( |
| 17 |
<span className={css(variant === 'icon' && styles.toggleGroupIcon, variant === 'text' && styles.toggleGroupText)}> |
| 18 |
{children} |
| 19 |
</span> |
| 20 |
); |
| 21 |
ToggleGroupItemElement.displayName = 'ToggleGroupItemElement'; |