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.
		
		
		
		
		
			
		
			
	
	
		
			43 lines
		
	
	
		
			940 B
		
	
	
	
		
			TypeScript
		
	
		
		
			
		
	
	
			43 lines
		
	
	
		
			940 B
		
	
	
	
		
			TypeScript
		
	
| 
								 
											4 years ago
										 
									 | 
							
								import React from 'react';
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								import classNames from 'classnames';
							 | 
						||
| 
								 
											4 years ago
										 
									 | 
							
								import { SessionIcon, SessionIconType } from '../icon';
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								
							 | 
						||
| 
								 | 
							
								export enum SessionDropDownItemType {
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								  Default = 'default',
							 | 
						||
| 
								 | 
							
								  Danger = 'danger',
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								type Props = {
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								  content: string;
							 | 
						||
| 
								 | 
							
								  type: SessionDropDownItemType;
							 | 
						||
| 
								 | 
							
								  icon: SessionIconType | null;
							 | 
						||
| 
								 | 
							
								  active: boolean;
							 | 
						||
| 
								 | 
							
								  onClick: any;
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								};
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								export const SessionDropdownItem = (props: Props) => {
							 | 
						||
| 
								 | 
							
								  const clickHandler = (e: any) => {
							 | 
						||
| 
								 | 
							
								    if (props.onClick) {
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								      e.stopPropagation();
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								      props.onClick();
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								    }
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  };
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  const { content, type, icon, active } = props;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  return (
							 | 
						||
| 
								 | 
							
								    <div
							 | 
						||
| 
								 | 
							
								      className={classNames(
							 | 
						||
| 
								 | 
							
								        'session-dropdown__item',
							 | 
						||
| 
								 | 
							
								        active ? 'active' : '',
							 | 
						||
| 
								 | 
							
								        type || SessionDropDownItemType.Default
							 | 
						||
| 
								 | 
							
								      )}
							 | 
						||
| 
								 | 
							
								      role="button"
							 | 
						||
| 
								 | 
							
								      onClick={clickHandler}
							 | 
						||
| 
								 | 
							
								    >
							 | 
						||
| 
								 
											4 years ago
										 
									 | 
							
								      {icon ? <SessionIcon iconType={icon} iconSize="small" /> : ''}
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								      <div className="item-content">{content}</div>
							 | 
						||
| 
								 | 
							
								    </div>
							 | 
						||
| 
								 | 
							
								  );
							 | 
						||
| 
								 | 
							
								};
							 |