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