All files / app/components ToggleButton.tsx

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26                      10x 81x 81x 22x   81x 81x             10x  
import React from 'react';
import { style } from 'app/styles';
 
export interface ToggleButtonProps {
  // This is the text or JSX that gets wrapped in a Toggle Button
  isSelected: boolean;
  onClick: (evt) => void;
  children?: string | JSX.Element | JSX.Element[];
  style?: string | object;
}
 
export const ToggleButton = (props: ToggleButtonProps): JSX.Element => {
  const styles: any = [];
  if (props.isSelected) {
    styles.push('selected');
  }
  styles.push(props.style);
  return (
    <div style={style(styles, props.style)} onClick={props.onClick}>
      {props.children || ' '}
    </div>
  );
};
 
ToggleButton.displayName = 'ToggleButton';