Skip to content

Commit 123c7ea

Browse files
committed
feat: add PluginImageContainer
1 parent 59b7402 commit 123c7ea

File tree

5 files changed

+21
-11
lines changed

5 files changed

+21
-11
lines changed

src/Shared/Components/Plugin/PluginCard.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { Checkbox, CHECKBOX_VALUE } from '../../../Common'
2-
import { ImageWithFallback } from '../ImageWithFallback'
2+
import PluginImageContainer from './PluginImageContainer'
33
import PluginTagsContainer from './PluginTagsContainer'
44
import { PluginCardProps } from './types'
5-
import { ReactComponent as ICLegoBlock } from '../../../Assets/Icon/ic-lego-block.svg'
65
import { ReactComponent as ICBookOpen } from '../../../Assets/Icon/ic-book-open.svg'
76

87
const PluginCard = ({
@@ -39,14 +38,9 @@ const PluginCard = ({
3938
</div>
4039
)}
4140

42-
{/* TODO: Test multiple cards with fallback since has if in LegoBlock */}
4341
{!isSelected && (
44-
<ImageWithFallback
45-
fallbackImage={
46-
<ICLegoBlock
47-
className={`dc__no-shrink icon-dim-40 ${isSelectable ? 'dc__visible-hover--hide-child' : ''}`}
48-
/>
49-
}
42+
<PluginImageContainer
43+
fallbackImageClassName={`icon-dim-40 ${isSelectable ? 'dc__visible-hover--hide-child' : ''}`}
5044
imageProps={{
5145
src: icon,
5246
alt: `${name} logo`,
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { PluginImageContainerProps } from './types'
2+
import { ReactComponent as ICLegoBlock } from '../../../Assets/Icon/ic-lego-block.svg'
3+
import { ImageWithFallback } from '../ImageWithFallback'
4+
5+
const PluginImageContainer = ({ imageProps, fallbackImageClassName }: PluginImageContainerProps) => (
6+
<ImageWithFallback
7+
fallbackImage={<ICLegoBlock className={`dc__no-shrink ${fallbackImageClassName}`} />}
8+
imageProps={imageProps}
9+
/>
10+
)
11+
12+
export default PluginImageContainer

src/Shared/Components/Plugin/PluginListContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ const PluginListContainer = ({
227227
}}
228228
onRemoveFilter={handleRemoveSelectedTag}
229229
clearFilters={handleClearFilters}
230-
className="p-0 w-100 pt-4"
230+
className="w-100 pt-0-imp"
231231
clearButtonClassName="dc__no-background-imp dc__no-border-imp dc__tab-focus"
232232
shouldHideLabel
233233
/>

src/Shared/Components/Plugin/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { VariableType } from '../../../Common'
22
import { BaseFilterQueryParams } from '../../types'
3+
import { ImageWithFallbackProps } from '../ImageWithFallback'
34
import { getPluginStoreData } from './service'
45

56
export enum PluginCreationType {
@@ -196,3 +197,7 @@ export interface PluginTagsContainerProps {
196197
tags: string[]
197198
rootClassName?: string
198199
}
200+
201+
export interface PluginImageContainerProps extends Pick<ImageWithFallbackProps, 'imageProps'> {
202+
fallbackImageClassName?: string
203+
}

src/Shared/Components/ReactSelect/utils.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ export const MenuListWithApplyButton = ({
191191
}: MenuListProps & { handleApplyFilter: () => void }) => (
192192
<>
193193
<components.MenuList {...props} />
194-
{/* TODO: Check not working look into this */}
195194
{props.selectProps.options.length > 0 && (
196195
<div className="p-8 dc__position-sticky dc__bottom-0 dc__border-top-n1 bcn-0 dc__bottom-radius-4">
197196
<button

0 commit comments

Comments
 (0)