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.
		
		
		
		
		
			
		
			
	
	
		
			52 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			TypeScript
		
	
		
		
			
		
	
	
			52 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			TypeScript
		
	
| 
											5 years ago
										 | import React from 'react'; | ||
|  | import styled from 'styled-components'; | ||
|  | 
 | ||
| 
											5 years ago
										 | interface LastSeenProps { | ||
|  |   show: boolean; | ||
|  | } | ||
|  | 
 | ||
|  | const LastSeenBarContainer = styled.div<LastSeenProps>`
 | ||
|  |   padding-bottom: ${props => (props.show ? '35px' : 0)}; | ||
| 
											5 years ago
										 |   margin-inline-start: 28px; | ||
| 
											5 years ago
										 |   padding-top: ${props => (props.show ? '28px' : 0)}; | ||
|  |   transition: ${props => props.theme.common.animations.defaultDuration}; | ||
|  |   overflow: hidden; | ||
|  |   height: ${props => (props.show ? 'auto' : 0)}; | ||
| 
											5 years ago
										 | `;
 | ||
|  | 
 | ||
|  | const LastSeenBar = styled.div`
 | ||
|  |   width: 100%; | ||
|  |   height: 2px; | ||
|  |   background-color: ${props => props.theme.colors.lastSeenIndicatorColor}; | ||
|  | `;
 | ||
|  | 
 | ||
|  | const LastSeenText = styled.div`
 | ||
|  |   margin-top: 3px; | ||
|  |   font-size: 11px; | ||
|  |   line-height: 16px; | ||
|  |   letter-spacing: 0.3px; | ||
|  |   text-transform: uppercase; | ||
|  |   text-align: center; | ||
|  | 
 | ||
|  |   color: ${props => props.theme.colors.lastSeenIndicatorTextColor}; | ||
|  | `;
 | ||
|  | 
 | ||
| 
											5 years ago
										 | export const SessionLastSeenIndicator = ({ | ||
|  |   count, | ||
|  |   show, | ||
|  | }: { | ||
|  |   count: number; | ||
|  |   show: boolean; | ||
|  | }) => { | ||
| 
											5 years ago
										 |   const { i18n } = window; | ||
|  |   const text = | ||
|  |     count > 1 ? i18n('unreadMessages', count) : i18n('unreadMessage', count); | ||
|  |   return ( | ||
| 
											5 years ago
										 |     <LastSeenBarContainer show={show}> | ||
| 
											5 years ago
										 |       <LastSeenBar> | ||
|  |         <LastSeenText>{text}</LastSeenText> | ||
|  |       </LastSeenBar> | ||
|  |     </LastSeenBarContainer> | ||
|  |   ); | ||
|  | }; |