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.
		
		
		
		
		
			
		
			
	
	
		
			42 lines
		
	
	
		
			714 B
		
	
	
	
		
			TypeScript
		
	
		
		
			
		
	
	
			42 lines
		
	
	
		
			714 B
		
	
	
	
		
			TypeScript
		
	
| 
											5 years ago
										 | import classNames from 'classnames'; | ||
|  | import React from 'react'; | ||
|  | 
 | ||
|  | export enum TabType { | ||
|  |   SignUp, | ||
|  |   SignIn, | ||
|  | } | ||
|  | 
 | ||
|  | export const TabLabel = ({ | ||
|  |   isSelected, | ||
|  |   onSelect, | ||
|  |   type, | ||
|  | }: { | ||
|  |   isSelected: boolean; | ||
|  |   onSelect?: (event: TabType) => void; | ||
|  |   type: TabType; | ||
|  | }) => { | ||
|  |   const handleClick = onSelect | ||
|  |     ? () => { | ||
|  |         onSelect(type); | ||
|  |       } | ||
|  |     : undefined; | ||
|  | 
 | ||
|  |   const label = | ||
|  |     type === TabType.SignUp | ||
|  |       ? window.i18n('createAccount') | ||
|  |       : window.i18n('signIn'); | ||
|  | 
 | ||
|  |   return ( | ||
|  |     <div | ||
|  |       className={classNames( | ||
|  |         'session-registration__tab', | ||
|  |         isSelected ? 'session-registration__tab--active' : null | ||
|  |       )} | ||
|  |       onClick={handleClick} | ||
|  |       role="tab" | ||
|  |     > | ||
|  |       {label} | ||
|  |     </div> | ||
|  |   ); | ||
|  | }; |