generated from layer5io/layer5-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #762 from amitamrutiya/catalogcard
Add new image and catalog empty card
- Loading branch information
Showing
18 changed files
with
338 additions
and
119 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,6 +116,7 @@ | |
"access": "public" | ||
}, | ||
"dependencies": { | ||
"js-yaml": "^4.1.0", | ||
"lodash": "^4.17.21" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import React, { useState } from 'react'; | ||
import { Dialog } from '../../base'; | ||
import { DesignIcon, MesheryFilterIcon } from '../../icons'; | ||
|
||
interface CatalogCardDesignLogoProps { | ||
zoomEffect?: boolean; | ||
imgURL?: string[]; | ||
type: { type: string }; | ||
width: string; | ||
height: string; | ||
style?: React.CSSProperties; | ||
} | ||
|
||
const CatalogCardDesignLogo: React.FC<CatalogCardDesignLogoProps> = ({ | ||
zoomEffect = false, | ||
imgURL, | ||
type, | ||
width, | ||
height, | ||
style = {} | ||
}) => { | ||
const [imgError, setImgError] = useState(false); | ||
const [isZoomed, setIsZoomed] = useState(false); | ||
|
||
const handleZoomClick = () => { | ||
if (zoomEffect) { | ||
setIsZoomed(true); | ||
} | ||
}; | ||
|
||
const handleZoomClose = () => { | ||
setIsZoomed(false); | ||
}; | ||
|
||
const SvgComponent: React.FC<{ type: { type: string } }> = ({ type }) => { | ||
return type.type === 'filter' ? ( | ||
<MesheryFilterIcon width={width} height={height} style={style} /> | ||
) : ( | ||
<DesignIcon width={width} height={height} style={style} /> | ||
); | ||
}; | ||
|
||
return ( | ||
<> | ||
{imgURL && imgURL.length > 0 ? ( | ||
<div style={{ width: '100%', height: '7.5rem', position: 'relative' }}> | ||
{!imgError ? ( | ||
<> | ||
<img | ||
src={imgURL[0]} | ||
alt="Design SnapShot" | ||
loading="lazy" | ||
onClick={handleZoomClick} | ||
onError={() => setImgError(true)} | ||
style={{ | ||
cursor: 'pointer', | ||
width: '100%', | ||
height: '100%', | ||
objectFit: 'cover' | ||
}} | ||
/> | ||
<Dialog | ||
open={isZoomed} | ||
onClose={handleZoomClose} | ||
style={{ | ||
backgroundColor: 'rgba(0, 0, 0, 0.8)' | ||
}} | ||
PaperProps={{ | ||
style: { | ||
background: 'transparent', | ||
boxShadow: 'none', | ||
overflow: 'hidden', | ||
maxWidth: '60vw' | ||
} | ||
}} | ||
> | ||
<img | ||
src={imgURL[0]} | ||
alt="Zoomed Design SnapShot" | ||
style={{ objectFit: 'contain', maxWidth: '100%', maxHeight: '100%' }} | ||
/> | ||
</Dialog> | ||
</> | ||
) : ( | ||
<SvgComponent type={type} /> | ||
)} | ||
</div> | ||
) : ( | ||
<SvgComponent type={type} /> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default CatalogCardDesignLogo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { FC } from 'react'; | ||
import { EmptyStyleIcon } from '../../icons/EmptyStyle'; | ||
import { useTheme } from '../../theme'; | ||
import { CatalogEmptyStateDiv } from './style'; | ||
|
||
const EmptyStateCard: FC = () => { | ||
const theme = useTheme(); | ||
return ( | ||
<CatalogEmptyStateDiv> | ||
<EmptyStyleIcon fill={theme.palette.text.default} width="100px" height="100px" /> | ||
<h3 style={{ color: theme.palette.text.default }}>No match found</h3> | ||
</CatalogEmptyStateDiv> | ||
); | ||
}; | ||
|
||
export default EmptyStateCard; |
Oops, something went wrong.