-
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
35 changed files
with
572 additions
and
207 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
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
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,11 @@ | ||
export interface CollectionPreview { | ||
id: string | ||
name: string | ||
isReleased: boolean | ||
releaseOrCreateDate: Date | ||
parentCollectionId?: string | ||
parentCollectionName?: string | ||
description?: string | ||
affiliation?: string | ||
thumbnail?: string | ||
} |
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
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
70 changes: 70 additions & 0 deletions
70
src/sections/collection/datasets-list/collection-card/CollectionCard.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,70 @@ | ||
@use 'sass:color'; | ||
@import "node_modules/@iqss/dataverse-design-system/src/lib/assets/styles/design-tokens/colors.module"; | ||
@import "node_modules/@iqss/dataverse-design-system/src/lib/assets/styles/design-tokens/typography.module"; | ||
|
||
.container { | ||
margin: 6px 0; | ||
padding: 4px 10px; | ||
border: 1px solid $dv-collection-border-color; | ||
} | ||
|
||
.header { | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
|
||
.title { | ||
display: flex;gap: 8px; | ||
} | ||
|
||
.icon { | ||
margin-top: 2px; | ||
color: $dv-collection-border-color; | ||
font-size: 1.3em; | ||
line-height: 1.1; | ||
|
||
> div >span { | ||
margin-right: 0; | ||
} | ||
} | ||
|
||
.thumbnail { | ||
width: 48px; | ||
margin: 8px 12px 6px 0; | ||
font-size: 2.8em; | ||
|
||
img { | ||
vertical-align: top; | ||
} | ||
} | ||
|
||
.info { | ||
display: flex; | ||
color: $dv-subtext-color; | ||
} | ||
|
||
.card-info-container { | ||
display: flex; | ||
font-size: $dv-font-size-sm; | ||
} | ||
|
||
.description { | ||
display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; | ||
flex-direction: column; | ||
width: 100%; | ||
overflow: hidden; | ||
color: black; | ||
} | ||
|
||
.date { | ||
color: $dv-subtext-color; | ||
|
||
} | ||
|
||
.affiliation { | ||
color: $dv-subtext-color; | ||
} | ||
|
||
.badge { | ||
margin-right: 0.5em; | ||
} |
24 changes: 24 additions & 0 deletions
24
src/sections/collection/datasets-list/collection-card/CollectionCard.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,24 @@ | ||
import { CollectionCardHeader } from './CollectionCardHeader' | ||
import { CollectionCardThumbnail } from './CollectionCardThumbnail' | ||
import { CollectionCardInfo } from './CollectionCardInfo' | ||
import { Stack } from '@iqss/dataverse-design-system' | ||
import { CollectionPreview } from '../../../../collection/domain/models/CollectionPreview' | ||
import styles from './CollectionCard.module.scss' | ||
|
||
interface CollectionCardProps { | ||
collectionPreview: CollectionPreview | ||
} | ||
|
||
export function CollectionCard({ collectionPreview }: CollectionCardProps) { | ||
return ( | ||
<article className={styles.container}> | ||
<CollectionCardHeader collectionPreview={collectionPreview} /> | ||
<div className={styles.info}> | ||
<Stack direction={'horizontal'} gap={3}> | ||
<CollectionCardThumbnail collectionPreview={collectionPreview} /> | ||
<CollectionCardInfo collectionPreview={collectionPreview} /> | ||
</Stack> | ||
</div> | ||
</article> | ||
) | ||
} |
39 changes: 39 additions & 0 deletions
39
src/sections/collection/datasets-list/collection-card/CollectionCardHeader.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,39 @@ | ||
import { LinkToPage } from '../../../shared/link-to-page/LinkToPage' | ||
import { Route } from '../../../Route.enum' | ||
import { CollectionPreview } from '../../../../collection/domain/models/CollectionPreview' | ||
import styles from './CollectionCard.module.scss' | ||
import { Badge, Icon, IconName } from '@iqss/dataverse-design-system' | ||
import { DvObjectType } from '../../../../shared/hierarchy/domain/models/UpwardHierarchyNode' | ||
|
||
interface CollectionCardHeaderProps { | ||
collectionPreview: CollectionPreview | ||
} | ||
|
||
export function CollectionCardHeader({ collectionPreview }: CollectionCardHeaderProps) { | ||
return ( | ||
<> | ||
<div className={styles.header}> | ||
<div className={styles.title}> | ||
<LinkToPage | ||
type={DvObjectType.COLLECTION} | ||
page={Route.COLLECTIONS} | ||
searchParams={{ id: collectionPreview.id.toString() }}> | ||
{collectionPreview.name} | ||
</LinkToPage> | ||
{collectionPreview.affiliation && ( | ||
<span className={styles.affiliation}> ({collectionPreview.affiliation})</span> | ||
)} | ||
{!collectionPreview.isReleased && ( | ||
<div className={styles.badge}> | ||
<Badge variant="warning">Unpublished</Badge> | ||
</div> | ||
)} | ||
</div> | ||
|
||
<div className={styles.icon}> | ||
<Icon name={IconName.COLLECTION} /> | ||
</div> | ||
</div> | ||
</> | ||
) | ||
} |
17 changes: 17 additions & 0 deletions
17
src/sections/collection/datasets-list/collection-card/CollectionCardHelper.ts
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,17 @@ | ||
import { | ||
DatasetLabel, | ||
DatasetLabelSemanticMeaning, | ||
DatasetLabelValue | ||
} from '../../../../dataset/domain/models/Dataset' | ||
export class CollectionCardHelper { | ||
static getLabel(isReleased: boolean) { | ||
const labels: DatasetLabel[] = [] | ||
|
||
if (!isReleased) { | ||
labels.push( | ||
new DatasetLabel(DatasetLabelSemanticMeaning.WARNING, DatasetLabelValue.UNPUBLISHED) | ||
) | ||
} | ||
return labels | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/sections/collection/datasets-list/collection-card/CollectionCardInfo.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,35 @@ | ||
import styles from './CollectionCard.module.scss' | ||
import { DateHelper } from '../../../../shared/helpers/DateHelper' | ||
import { Stack } from '@iqss/dataverse-design-system' | ||
import { LinkToPage } from '../../../shared/link-to-page/LinkToPage' | ||
import { Route } from '../../../Route.enum' | ||
import { CollectionPreview } from '../../../../collection/domain/models/CollectionPreview' | ||
import { DvObjectType } from '../../../../shared/hierarchy/domain/models/UpwardHierarchyNode' | ||
|
||
interface CollectionCardInfoProps { | ||
collectionPreview: CollectionPreview | ||
} | ||
|
||
export function CollectionCardInfo({ collectionPreview }: CollectionCardInfoProps) { | ||
return ( | ||
<div className={styles['card-info-container']}> | ||
<Stack gap={1}> | ||
<Stack direction="horizontal" gap={2}> | ||
<span className={styles.date}> | ||
{DateHelper.toDisplayFormat(collectionPreview.releaseOrCreateDate)} | ||
</span> | ||
{collectionPreview.parentCollectionName && collectionPreview.parentCollectionId && ( | ||
<LinkToPage | ||
type={DvObjectType.COLLECTION} | ||
page={Route.COLLECTIONS} | ||
searchParams={{ id: collectionPreview.parentCollectionId.toString() }}> | ||
{collectionPreview.parentCollectionName} | ||
</LinkToPage> | ||
)} | ||
</Stack> | ||
|
||
<p className={styles.description}>{collectionPreview.description}</p> | ||
</Stack> | ||
</div> | ||
) | ||
} |
33 changes: 33 additions & 0 deletions
33
src/sections/collection/datasets-list/collection-card/CollectionCardThumbnail.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,33 @@ | ||
import styles from './CollectionCard.module.scss' | ||
import { LinkToPage } from '../../../shared/link-to-page/LinkToPage' | ||
import { Route } from '../../../Route.enum' | ||
import { Icon, IconName } from '@iqss/dataverse-design-system' | ||
import { CollectionPreview } from '../../../../collection/domain/models/CollectionPreview' | ||
import { DvObjectType } from '../../../../shared/hierarchy/domain/models/UpwardHierarchyNode' | ||
|
||
interface CollectionCardCardThumbnailProps { | ||
collectionPreview: CollectionPreview | ||
} | ||
|
||
export function CollectionCardThumbnail({ collectionPreview }: CollectionCardCardThumbnailProps) { | ||
return ( | ||
<div className={styles.thumbnail}> | ||
<LinkToPage | ||
type={DvObjectType.COLLECTION} | ||
page={Route.COLLECTIONS} | ||
searchParams={{ id: collectionPreview.id.toString() }}> | ||
{collectionPreview.thumbnail ? ( | ||
<img | ||
className={styles['preview-image']} | ||
src={collectionPreview.thumbnail} | ||
alt={collectionPreview.name} | ||
/> | ||
) : ( | ||
<div className={styles.icon}> | ||
<Icon name={IconName.COLLECTION} /> | ||
</div> | ||
)} | ||
</LinkToPage> | ||
</div> | ||
) | ||
} |
Oops, something went wrong.