You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			37 lines
		
	
	
		
			735 B
		
	
	
	
		
			TypeScript
		
	
			
		
		
	
	
			37 lines
		
	
	
		
			735 B
		
	
	
	
		
			TypeScript
		
	
| import React from 'react';
 | |
| import { Flex } from '../basic/Flex';
 | |
| // tslint:disable: react-unused-props-and-state
 | |
| 
 | |
| interface Props {
 | |
|   label: string;
 | |
|   value: string;
 | |
|   active: boolean;
 | |
|   group?: string;
 | |
|   onClick: (value: string) => any;
 | |
| }
 | |
| 
 | |
| export const SessionRadio = (props: Props) => {
 | |
|   const { label, group, value, active, onClick } = props;
 | |
| 
 | |
|   function clickHandler(e: any) {
 | |
|     e.stopPropagation();
 | |
|     onClick(value);
 | |
|   }
 | |
| 
 | |
|   return (
 | |
|     <Flex>
 | |
|       <input
 | |
|         type="radio"
 | |
|         name={group || ''}
 | |
|         value={value}
 | |
|         aria-checked={active}
 | |
|         checked={active}
 | |
|         onChange={clickHandler}
 | |
|       />
 | |
|       <label role="button" onClick={clickHandler}>
 | |
|         {label}
 | |
|       </label>
 | |
|     </Flex>
 | |
|   );
 | |
| };
 |