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.
		
		
		
		
		
			
		
			
	
	
		
			74 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			TypeScript
		
	
		
		
			
		
	
	
			74 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			TypeScript
		
	
| 
											4 years ago
										 | import React from 'react'; | ||
| 
											6 years ago
										 | import classNames from 'classnames'; | ||
| 
											4 years ago
										 | import { SessionButton, SessionButtonColor } from '../basic/SessionButton'; | ||
|  | import { SessionToggle } from '../basic/SessionToggle'; | ||
|  | import { SessionConfirmDialogProps } from '../dialog/SessionConfirm'; | ||
| 
											6 years ago
										 | 
 | ||
| 
											4 years ago
										 | type ButtonSettingsProps = { | ||
| 
											5 years ago
										 |   title?: string; | ||
| 
											6 years ago
										 |   description?: string; | ||
| 
											4 years ago
										 |   buttonColor: SessionButtonColor; | ||
|  |   buttonText: string; | ||
|  |   onClick: () => void; | ||
| 
											4 years ago
										 | }; | ||
| 
											4 years ago
										 | 
 | ||
| 
											4 years ago
										 | const SettingsTitleAndDescription = (props: { title?: string; description?: string }) => { | ||
|  |   return ( | ||
|  |     <div className="session-settings-item__info"> | ||
|  |       <div className="session-settings-item__title">{props.title}</div> | ||
| 
											6 years ago
										 | 
 | ||
| 
											4 years ago
										 |       {props.description && ( | ||
|  |         <div className="session-settings-item__description">{props.description}</div> | ||
|  |       )} | ||
|  |     </div> | ||
|  |   ); | ||
|  | }; | ||
| 
											6 years ago
										 | 
 | ||
| 
											4 years ago
										 | const SessionSettingsContent = (props: { children: React.ReactNode }) => { | ||
|  |   return <div className="session-settings-item__content">{props.children}</div>; | ||
|  | }; | ||
| 
											6 years ago
										 | 
 | ||
| 
											4 years ago
										 | export const SessionSettingsItemWrapper = (props: { | ||
|  |   inline: boolean; | ||
|  |   title?: string; | ||
|  |   description?: string; | ||
|  |   children: React.ReactNode; | ||
|  | }) => { | ||
| 
											4 years ago
										 |   return ( | ||
| 
											4 years ago
										 |     <div className={classNames('session-settings-item', props.inline && 'inline')}> | ||
|  |       <SettingsTitleAndDescription title={props.title} description={props.description} /> | ||
|  |       <SessionSettingsContent>{props.children}</SessionSettingsContent> | ||
|  |     </div> | ||
|  |   ); | ||
|  | }; | ||
| 
											4 years ago
										 | 
 | ||
| 
											4 years ago
										 | export const SessionToggleWithDescription = (props: { | ||
|  |   title?: string; | ||
|  |   description?: string; | ||
|  |   active: boolean; | ||
|  |   onClickToggle: () => void; | ||
|  |   confirmationDialogParams?: SessionConfirmDialogProps; | ||
|  | }) => { | ||
|  |   const { title, description, active, onClickToggle, confirmationDialogParams } = props; | ||
| 
											4 years ago
										 | 
 | ||
| 
											4 years ago
										 |   return ( | ||
|  |     <SessionSettingsItemWrapper title={title} description={description} inline={true}> | ||
|  |       <SessionToggle | ||
|  |         active={active} | ||
|  |         onClick={onClickToggle} | ||
|  |         confirmationDialogParams={confirmationDialogParams} | ||
|  |       /> | ||
|  |     </SessionSettingsItemWrapper> | ||
|  |   ); | ||
|  | }; | ||
| 
											4 years ago
										 | 
 | ||
| 
											4 years ago
										 | export const SessionSettingButtonItem = (props: ButtonSettingsProps) => { | ||
|  |   const { title, description, buttonColor, buttonText, onClick } = props; | ||
| 
											6 years ago
										 | 
 | ||
| 
											4 years ago
										 |   return ( | ||
|  |     <SessionSettingsItemWrapper title={title} description={description} inline={true}> | ||
|  |       <SessionButton text={buttonText} buttonColor={buttonColor} onClick={onClick} /> | ||
|  |     </SessionSettingsItemWrapper> | ||
| 
											4 years ago
										 |   ); | ||
|  | }; |