Simplify empty state handling, remove obsolete test

This commit is contained in:
Jackson Harper
2024-02-23 11:07:57 +08:00
parent 6543c9b017
commit f85e826146
2 changed files with 14 additions and 51 deletions

View File

@ -1143,30 +1143,20 @@ export function LibraryItemsLayout(
}}
style={{ height: '100%', width: '100%' }}
>
{!props.isValidating && props.items.length == 0 ? (
<EmptyLibrary
layoutType={props.layout}
searchTerm={props.searchTerm}
onAddLinkClicked={() => {
props.setShowAddLinkModal(true)
}}
/>
) : (
<LibraryItems
items={props.items}
layout={props.layout}
viewer={props.viewer}
isChecked={props.isChecked}
setIsChecked={props.setIsChecked}
gridContainerRef={props.gridContainerRef}
setShowEditTitleModal={props.setShowEditTitleModal}
setLinkToEdit={props.setLinkToEdit}
setShowUnsubscribeConfirmation={setShowUnsubscribeConfirmation}
setLinkToUnsubscribe={props.setLinkToUnsubscribe}
actionHandler={props.actionHandler}
multiSelectMode={props.multiSelectMode}
/>
)}
<LibraryItems
items={props.items}
layout={props.layout}
viewer={props.viewer}
isChecked={props.isChecked}
setIsChecked={props.setIsChecked}
gridContainerRef={props.gridContainerRef}
setShowEditTitleModal={props.setShowEditTitleModal}
setLinkToEdit={props.setLinkToEdit}
setShowUnsubscribeConfirmation={setShowUnsubscribeConfirmation}
setLinkToUnsubscribe={props.setLinkToUnsubscribe}
actionHandler={props.actionHandler}
multiSelectMode={props.multiSelectMode}
/>
<HStack
distribution="center"
css={{ width: '100%', mt: '$2', mb: '$4' }}

View File

@ -1,27 +0,0 @@
import { ComponentStory, ComponentMeta } from '@storybook/react'
import { EmptyLibrary } from '../components/templates/homeFeed/EmptyLibrary'
export default {
title: 'Components/EmptyLibraryStory',
component: EmptyLibrary,
argTypes: {
position: {
description: 'The empty library component',
control: { type: 'select' },
},
},
} as ComponentMeta<typeof EmptyLibrary>
export const EmptyLibraryStory: ComponentStory<typeof EmptyLibrary> = (
args: any
) => {
return (
<EmptyLibrary
layoutType="GRID_LAYOUT"
searchTerm=""
onAddLinkClicked={() => {
console.log('onAddLinkClicked')
}}
/>
)
}