Skip to content

Commit

Permalink
removed background image library text if collection is empty (#1876)
Browse files Browse the repository at this point in the history
* removed bg info text when empty images

* ternary into boolean change

Co-authored-by: Oleksii Petrov <oleksii.petrov@altexsoft.com>
  • Loading branch information
alexxpetrov and Oleksii Petrov authored Jul 22, 2021
1 parent 6d1cf38 commit a713126
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/molecules/ImageInput/ImageCollectionInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ export const ImageCollectionInput: React.FC<ImageInputProps> = (props) => {
[]
);

const hasImageCollections = !!imageCollection.length;

// this keeps the component state synchronised with the parent form state
useEffect(() => {
if (selectedCollectionImageUrl) {
Expand Down Expand Up @@ -131,9 +133,11 @@ export const ImageCollectionInput: React.FC<ImageInputProps> = (props) => {
value={imageUrlForPreview}
/>
{error?.message && <span className="input-error">{error.message}</span>}
<div style={{ marginTop: 10, fontSize: "16px" }}>
{`Or choose one of our popular ${imageType}`}
</div>
{hasImageCollections && (
<div style={{ marginTop: 10, fontSize: "16px" }}>
{`Or choose one of our popular ${imageType}`}
</div>
)}
<div
style={{
display: "flex",
Expand Down

0 comments on commit a713126

Please # to comment.