-
Notifications
You must be signed in to change notification settings - Fork 1
Refactor Digital Specimen overview: Data cards #247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
836c33a
Initial set up of the Digital Specimen overview
MelanieTheLion 047e171
Added setup of digitalSpecimenCard
MelanieTheLion 76ec7f6
Changed html
MelanieTheLion ab7e759
Merge branch 'feature/refactor-ds-data-service' into feature/refactor…
MelanieTheLion 198f333
Added styling for different types of labelPair values
MelanieTheLion 56031ff
Added georeference map
MelanieTheLion 28e3672
Added citation as well
MelanieTheLion edd790f
Releasing first version of the new digital specimen overview
MelanieTheLion 6fa3917
Changed props for OpenStreetMap in the IdCard
MelanieTheLion 4dd60bb
Replaced all spacings to variables
MelanieTheLion e065106
Added some specificity and css var
MelanieTheLion fb5321c
Updated axios due to trivy vulnerability and sanitized html when dang…
MelanieTheLion ee30cad
Added trivyignore vulnerability because of image vulnerability
MelanieTheLion 54a051c
Added wrapper function for dompurify
MelanieTheLion File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
33 changes: 33 additions & 0 deletions
33
src/components/Cards/DigitalSpecimenCard/DigitalSpecimenCard.scss
This file contains hidden or 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 @@ | ||
| .digital-specimen-card { | ||
| .ds-card-header { | ||
| margin-bottom: var(--spacing-m); | ||
| } | ||
| .ds-card-georeference { | ||
| width: 100%; | ||
| height: var(--general-card-width); | ||
| margin-block-end: var(--spacing-sm); | ||
| } | ||
| .ds-card-citation { | ||
| max-height: var(--citation-content-spacing); | ||
| width: 100%; | ||
| background-color: var(--indigo-2); | ||
| padding: var(--spacing-m); | ||
| margin-block-end: var(--spacing-sm); | ||
|
|
||
| p { | ||
| font-size: var(--sm-font-size); | ||
|
|
||
| a { | ||
| color: inherit; | ||
| text-decoration: underline; | ||
| } | ||
|
|
||
| } | ||
| } | ||
| .ds-card-body { | ||
| display: grid; | ||
| grid-template-columns: var(--general-card-height) 1fr; | ||
| gap: var(--spacing-sm) var(--spacing-m); | ||
| align-items: start; | ||
| } | ||
| } |
81 changes: 81 additions & 0 deletions
81
src/components/Cards/DigitalSpecimenCard/DigitalSpecimenCard.tsx
This file contains hidden or 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,81 @@ | ||
| /* Import components */ | ||
| import { CopyIcon, Pencil2Icon } from "@radix-ui/react-icons"; | ||
| import { Button, Card } from "@radix-ui/themes"; | ||
| import { LabelValuePair } from "components/LabelValuePair/LabelValuePair"; | ||
| import { OpenStreetMap } from "components/elements/customUI/CustomUI"; | ||
|
|
||
| /* Import styles */ | ||
| import './DigitalSpecimenCard.scss'; | ||
|
|
||
| type Props = { | ||
| cardHeader: string, | ||
| annotate?: boolean, | ||
| copy?: boolean, | ||
| fragment: any, | ||
| georeference?: boolean | ||
| citation?: boolean | ||
| } | ||
|
|
||
| export const DigitalSpecimenCard = ({ cardHeader, annotate, copy, fragment, georeference = false, citation = false }: Props) => { | ||
| const craftCitation = (fragment: any) => { | ||
| return ( | ||
| <> | ||
| <a href={fragment['organisationId'].value} | ||
| target="_blank" | ||
| rel="noreferer" | ||
| > | ||
| {fragment['organisationName'].value ?? fragment['organisationId'].value} | ||
| </a> | ||
| {` (${new Date().getFullYear()}). `} | ||
| <a href="https://ror.org/02wddde16" | ||
| target="_blank" | ||
| rel="noreferer" | ||
| > | ||
| Distributed System of Scientific Collections | ||
| </a> | ||
| {`. [Dataset]. `} | ||
| <a href={fragment['digitalSpecimenId'].value} | ||
| target="_blank" | ||
| rel="noreferer" | ||
| > | ||
| {fragment['digitalSpecimenId'].value} | ||
| </a> | ||
| </> | ||
| ) | ||
|
|
||
| } | ||
| return ( | ||
| <Card className="digital-specimen-card"> | ||
| <div className="ds-card-header"> | ||
| <h2>{cardHeader}</h2> | ||
| { annotate && | ||
| <Button variant="ghost"> | ||
| Annotate | ||
| <Pencil2Icon /> | ||
| </Button> | ||
| } | ||
| { copy && | ||
| <Button variant="ghost"> | ||
| Copy | ||
| <CopyIcon /> | ||
| </Button> | ||
| } | ||
| </div> | ||
| { georeference && | ||
| <div className="ds-card-georeference"> | ||
| <OpenStreetMap latitude={fragment?.['decimalLatitude'].value} longitude={fragment?.['decimalLongitude'].value} /> | ||
| </div> | ||
| } | ||
| { citation && | ||
| <div className="ds-card-citation"> | ||
| <p>{craftCitation(fragment)}</p> | ||
| </div> | ||
| } | ||
| <div className="ds-card-body"> | ||
| {Object.entries(fragment).map(([key, item]: [string, any]) => ( | ||
| <LabelValuePair key={key} item={item as { label: string; value: string; isHtml: boolean; type: string; hidden: boolean; }} /> | ||
| ))} | ||
| </div> | ||
| </Card> | ||
| ) | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 @@ | ||
| .property-row-fragment { | ||
| display: contents; | ||
|
|
||
| .property-label { | ||
| font-size: var(--sm-font-size); | ||
| font-weight: var(--medium-font-weight); | ||
| } | ||
|
|
||
| .verbatim { | ||
| font-size: var(--xs-font-size); | ||
| color: var(--gray-a9); | ||
| } | ||
| .property-value { | ||
| font-size: var(--sm-font-size); | ||
| font-weight: var(--regular-font-weight); | ||
|
|
||
| a { | ||
| svg { | ||
| margin-inline-start: var(--spacing-xs); | ||
| } | ||
| } | ||
|
|
||
| .verbatim { | ||
| font-size: var(--xs-font-size); | ||
| color: var(--gray-a9); | ||
|
|
||
| span { | ||
| margin-inline-start: var(--spacing-sm); | ||
| } | ||
| } | ||
| .btn-as-link { | ||
| padding: 0; | ||
|
|
||
| svg { | ||
| margin-inline-start: var(--spacing-xs); | ||
| } | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.