Skip to content

Commit

Permalink
feat: 🎸 added type divider to <Text />, refact. empty list
Browse files Browse the repository at this point in the history
  • Loading branch information
koepferd committed Mar 5, 2021
1 parent e177518 commit 3c494aa
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 42 deletions.
51 changes: 28 additions & 23 deletions src/components/sessionsList/SessionsList.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react';
import { useContext, useState, useEffect } from 'react';
import { SessionListEmptyState } from './SessionsListEmptyState';
import {
typeIsUser,
typeIsTeamSession,
Expand Down Expand Up @@ -51,6 +50,7 @@ import {
MAX_ITEMS_TO_SHOW_WELCOME_ILLUSTRATION,
SCROLL_PAGINATE_THRESHOLD
} from './sessionsListConfig';
import { Text } from '../text/Text';

export const SessionsList: React.FC = () => {
let listRef: React.RefObject<HTMLDivElement> = React.createRef();
Expand Down Expand Up @@ -463,11 +463,11 @@ export const SessionsList: React.FC = () => {

return (
<div className="sessionsList__innerWrapper">
{showFilter ? (
{showFilter && (
<div className="sessionsList__selectWrapper">
<SelectDropdown {...selectDropdown} />
</div>
) : null}
)}
<div
className={`sessionsList__scrollContainer ${
showFilter ? 'sessionsList__scrollContainer--hasFilter' : ''
Expand Down Expand Up @@ -495,27 +495,32 @@ export const SessionsList: React.FC = () => {
data-cy="sessions-list-items-wrapper"
>
{activeCreateChat &&
typeIsSession(type) &&
hasUserAuthority(AUTHORITIES.CREATE_NEW_CHAT, userData) ? (
<SessionListCreateChat />
) : null}
typeIsSession(type) &&
hasUserAuthority(
AUTHORITIES.CREATE_NEW_CHAT,
userData
) && <SessionListCreateChat />}
{sessionsData &&
sessionsData[getSessionsDataKeyForSessionType(type)] &&
!hasNoSessions ? (
sessionsData[
getSessionsDataKeyForSessionType(type)
].map((item: ListItemInterface, index) => (
<SessionListItemComponent
key={index}
type={type}
id={getChatItemForSession(item).id}
/>
))
) : !activeCreateChat ? (
<SessionListEmptyState />
) : null}
{loadingWithOffset ? <SessionsListSkeleton /> : null}
{isReloadButtonVisible ? (
!hasNoSessions
? sessionsData[
getSessionsDataKeyForSessionType(type)
].map((item: ListItemInterface, index) => (
<SessionListItemComponent
key={index}
type={type}
id={getChatItemForSession(item).id}
/>
))
: !activeCreateChat && (
<Text
className="sessionsList--empty"
text={translate('sessionList.empty')}
type="divider"
/>
)}
{loadingWithOffset && <SessionsListSkeleton />}
{isReloadButtonVisible && (
<div className="sessionsList__reloadWrapper">
<Button
item={{
Expand All @@ -529,7 +534,7 @@ export const SessionsList: React.FC = () => {
buttonHandle={handleReloadButton}
/>
</div>
) : null}
)}
</div>
</div>
</div>
Expand Down
13 changes: 0 additions & 13 deletions src/components/sessionsList/SessionsListEmptyState.tsx

This file was deleted.

6 changes: 1 addition & 5 deletions src/components/sessionsList/sessionsList.styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,8 @@ $headerHeight: 80px;
}

&--empty {
padding-top: 20px;
margin-top: $grid-base-four;
text-align: center;
font-family: $font-family-slab-regular;
font-size: $font-size-secondary;
line-height: $line-height-secondary;
color: $light-grey;
}

&__itemsWrapper {
Expand Down
3 changes: 2 additions & 1 deletion src/components/text/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export interface TextProps {
| 'standard'
| 'infoLargeStandard'
| 'infoLargeAlternative'
| 'infoSmall';
| 'infoSmall'
| 'divider';
}

export enum LABEL_TYPES {
Expand Down
7 changes: 7 additions & 0 deletions src/components/text/text.styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
color: $tertiary;
}

&__divider {
font-family: $font-family-slab-regular;
font-size: $font-size-secondary;
line-height: $line-height-secondary;
color: $light-grey;
}

&__label {
font-family: $font-family-medium;
font-weight: $font-weight-medium;
Expand Down

0 comments on commit 3c494aa

Please sign in to comment.