-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
111 additions
and
88 deletions.
There are no files selected for viewing
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
21 changes: 0 additions & 21 deletions
21
src/sections/dataset/dataset-citation/CitationThumbnail.tsx
This file was deleted.
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
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
13 changes: 13 additions & 0 deletions
13
src/sections/dataset/dataset-citation/DatasetThumbnail.module.scss
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,13 @@ | ||
@import "node_modules/@iqss/dataverse-design-system/src/lib/assets/styles/design-tokens/colors.module"; | ||
|
||
.icon { | ||
color: $dv-info-border-color; | ||
line-height: 1.1; | ||
} | ||
|
||
.preview-image { | ||
width: 100%; | ||
max-width: 140px; | ||
height: auto; | ||
max-height: 140px; | ||
} |
20 changes: 20 additions & 0 deletions
20
src/sections/dataset/dataset-citation/DatasetThumbnail.tsx
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,20 @@ | ||
import styles from './DatasetThumbnail.module.scss' | ||
import { Icon, IconName } from '@iqss/dataverse-design-system' | ||
|
||
interface DatasetThumbnailProps { | ||
thumbnail?: string | ||
title: string | ||
isDeaccessioned?: boolean | ||
} | ||
|
||
export function DatasetThumbnail({ thumbnail, title, isDeaccessioned }: DatasetThumbnailProps) { | ||
if (thumbnail && !isDeaccessioned) { | ||
return <img className={styles['preview-image']} src={thumbnail} alt={title} /> | ||
} | ||
|
||
return ( | ||
<div className={styles.icon}> | ||
<Icon name={IconName.DATASET} /> | ||
</div> | ||
) | ||
} |
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
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
39 changes: 0 additions & 39 deletions
39
tests/component/sections/dataset/dataset-citation/CitationThumbnail.spec.tsx
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
tests/component/sections/dataset/dataset-citation/DatasetThumbnail.spec.tsx
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,29 @@ | ||
import { DatasetThumbnail } from '../../../../../src/sections/dataset/dataset-citation/DatasetThumbnail' | ||
|
||
describe('DatasetThumbnail', () => { | ||
it('renders the dataset icon when there is no thumbnail', () => { | ||
cy.customMount(<DatasetThumbnail title="Dataset title" />) | ||
|
||
cy.findByLabelText('icon-dataset').should('exist') | ||
}) | ||
|
||
it('renders the dataset icon when the dataset is deaccessioned', () => { | ||
cy.customMount( | ||
<DatasetThumbnail | ||
title="Dataset title" | ||
thumbnail="https://example.com/image.png" | ||
isDeaccessioned | ||
/> | ||
) | ||
|
||
cy.findByLabelText('icon-dataset').should('exist') | ||
}) | ||
|
||
it('renders the dataset thumbnail when there is one and the dataset is not deaccessioned', () => { | ||
cy.customMount( | ||
<DatasetThumbnail thumbnail="https://example.com/image.png" title="Dataset title" /> | ||
) | ||
|
||
cy.findByRole('img', { name: 'Dataset title' }).should('exist') | ||
}) | ||
}) |
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