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
		
	
| 
											6 years ago
										 | import React from 'react'; | ||
| 
											5 years ago
										 | import { Flex } from '../basic/Flex'; | ||
| 
											5 years ago
										 | // tslint:disable: react-unused-props-and-state
 | ||
| 
											6 years ago
										 | 
 | ||
|  | interface Props { | ||
|  |   label: string; | ||
| 
											6 years ago
										 |   value: string; | ||
| 
											6 years ago
										 |   active: boolean; | ||
| 
											6 years ago
										 |   group?: string; | ||
| 
											5 years ago
										 |   onClick: (value: string) => any; | ||
| 
											6 years ago
										 | } | ||
|  | 
 | ||
| 
											5 years ago
										 | export const SessionRadio = (props: Props) => { | ||
|  |   const { label, group, value, active, onClick } = props; | ||
| 
											6 years ago
										 | 
 | ||
| 
											5 years ago
										 |   function clickHandler(e: any) { | ||
|  |     e.stopPropagation(); | ||
|  |     onClick(value); | ||
| 
											6 years ago
										 |   } | ||
|  | 
 | ||
| 
											5 years ago
										 |   return ( | ||
|  |     <Flex> | ||
|  |       <input | ||
|  |         type="radio" | ||
|  |         name={group || ''} | ||
|  |         value={value} | ||
|  |         aria-checked={active} | ||
|  |         checked={active} | ||
| 
											4 years ago
										 |         onChange={clickHandler} | ||
| 
											5 years ago
										 |       /> | ||
|  |       <label role="button" onClick={clickHandler}> | ||
|  |         {label} | ||
|  |       </label> | ||
|  |     </Flex> | ||
|  |   ); | ||
|  | }; |