-
Notifications
You must be signed in to change notification settings - Fork 0
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
Rework external resources section #399
Changes from all commits
1149aba
6a64034
e3ab514
e8cf898
077a64c
e3c335c
6b606a7
df1b9ba
07d6fd3
e7cb6a8
8627245
2683052
c3b473a
9fdfe8a
fdf7e20
9982f86
6678833
98da85b
8bf2507
001c27b
afc9464
96b898c
b5d3ba3
486bf91
49bd95b
57348df
214bf4d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
import ExternalLink from 'common/ExternalLink' | ||
import React from 'react' | ||
|
||
interface Props { | ||
number: string | ||
baseUrl?: string | ||
label: string | ||
} | ||
function ExternalNumberLink({ baseUrl, number, label }: Props): JSX.Element { | ||
const url = `${baseUrl}${encodeURIComponent(number)}` | ||
return ( | ||
<> | ||
{`${label} (`} | ||
<ExternalLink href={url} aria-label={`${label} text ${number}`}> | ||
{number} | ||
</ExternalLink> | ||
{')'} | ||
</> | ||
) | ||
} | ||
|
||
export function BmIdLink({ number }: { number: string }): JSX.Element { | ||
return ( | ||
<ExternalNumberLink | ||
number={number} | ||
baseUrl={'https://www.britishmuseum.org/collection/object/'} | ||
label={'The British Museum'} | ||
/> | ||
) | ||
} | ||
export function CdliLink({ number }: { number: string }): JSX.Element { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar blocks of code found in 8 locations. Consider refactoring. |
||
return ( | ||
<ExternalNumberLink | ||
number={number} | ||
baseUrl={'https://cdli.mpiwg-berlin.mpg.de/'} | ||
label={'CDLI'} | ||
/> | ||
) | ||
} | ||
export function BdtnsLink({ number }: { number: string }): JSX.Element { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar blocks of code found in 8 locations. Consider refactoring. |
||
return ( | ||
<ExternalNumberLink | ||
number={number} | ||
baseUrl={'http://bdtns.filol.csic.es/'} | ||
label={'BDTNS'} | ||
/> | ||
) | ||
} | ||
export function ArchibabLink({ number }: { number: string }): JSX.Element { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar blocks of code found in 8 locations. Consider refactoring. |
||
return ( | ||
<ExternalNumberLink | ||
number={number} | ||
baseUrl={'http://www.archibab.fr/'} | ||
label={'Archibab'} | ||
/> | ||
) | ||
} | ||
export function UrOnlineLink({ number }: { number: string }): JSX.Element { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar blocks of code found in 8 locations. Consider refactoring. |
||
return ( | ||
<ExternalNumberLink | ||
number={number} | ||
baseUrl={'http://www.ur-online.org/subject/'} | ||
label={'Ur Online'} | ||
/> | ||
) | ||
} | ||
export function HilprechtJenaLink({ number }: { number: string }): JSX.Element { | ||
return ( | ||
<ExternalNumberLink | ||
number={number} | ||
baseUrl={'https://hilprecht.mpiwg-berlin.mpg.de/object3d/'} | ||
label={'Hilprecht Collection'} | ||
/> | ||
) | ||
} | ||
export function HilprechtHeidelbergLink({ | ||
number, | ||
}: { | ||
number: string | ||
}): JSX.Element { | ||
return ( | ||
<ExternalNumberLink | ||
number={number} | ||
baseUrl={'https://doi.org/10.11588/heidicon/'} | ||
label={'Hilprecht Collection – HeiCuBeDa'} | ||
/> | ||
) | ||
} | ||
export function YalePeabodyLink({ number }: { number: string }): JSX.Element { | ||
return ( | ||
<ExternalNumberLink | ||
number={number} | ||
baseUrl={'https://collections.peabody.yale.edu/search/Record/YPM-'} | ||
label={'Yale Babylonian Collection'} | ||
/> | ||
) | ||
} | ||
|
||
function OraccLink({ | ||
project, | ||
cdliNumber, | ||
}: { | ||
project: string | ||
cdliNumber: string | ||
}): JSX.Element { | ||
const baseUrl = | ||
project === 'ccp' | ||
? 'https://ccp.yale.edu/' | ||
: `https://oracc.org/${project}/` | ||
return ( | ||
<ExternalLink | ||
href={`${baseUrl}${encodeURIComponent(cdliNumber)}`} | ||
aria-label={`Oracc text ${project} ${cdliNumber}`} | ||
> | ||
{project.toUpperCase()} | ||
</ExternalLink> | ||
) | ||
} | ||
|
||
export function OraccLinks({ | ||
projects, | ||
cdliNumber, | ||
}: { | ||
projects: readonly string[] | ||
cdliNumber: string | ||
}): JSX.Element { | ||
return ( | ||
<> | ||
{'Oracc ('} | ||
{projects.map((project, index) => ( | ||
<> | ||
{index !== 0 && ', '} | ||
<OraccLink project={project} cdliNumber={cdliNumber} key={index} /> | ||
</> | ||
))} | ||
{')'} | ||
</> | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 8 locations. Consider refactoring.