Skip to content

Commit 67fe484

Browse files
authored
Merge pull request #275 from performant-software/develop
v1.4.5 Updates
2 parents 88312fe + 7513964 commit 67fe484

File tree

8 files changed

+95
-6
lines changed

8 files changed

+95
-6
lines changed

src/apps/pages/RecordDetail/Identifiers.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const { record } = Astro.props
88
const lang = Astro.currentLocale;
99
const { t } = await getTranslations(lang);
1010
---
11-
{record.web_identifiers && (
11+
{record.web_identifiers && !_.isEmpty(record.web_identifiers) && (
1212
<>
1313
<div class="py-6">
1414
<h2 class="capitalize text-lg font-semibold">{t('webAuthorities')}</h2>

src/apps/pages/sections/Images.astro

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
import ImageWithCitation from '@components/ImageWithCitation.astro';
23
import _ from 'underscore';
34
45
const { items, title } = Astro.props;
@@ -22,10 +23,12 @@ const { items, title } = Astro.props;
2223
class='flex justify-center py-8 w-full max-h-[400px] lg:w-[375px] lg:max-h-[400px]'
2324
href={item.url}
2425
>
25-
<img
26+
<ImageWithCitation
2627
alt={item.image_alt}
27-
class='w-full h-full object-cover'
28+
classNames={{ root: 'w-full h-full', image: 'w-full h-full object-cover', citation: `text-xs text-gray-400${item.citationLink ? ' underline' : ''}` }}
2829
src={item.image}
30+
citation={item.citation}
31+
citationLink={item.citation_link}
2932
/>
3033
</a>
3134
))}

src/apps/pages/sections/TextImage.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import ImageWithCitation from '@components/ImageWithCitation';
12
import LinkButton from '@components/LinkButton';
23
import clsx from 'clsx';
34
import { useEffect, useRef, useState } from 'react';
@@ -6,6 +7,8 @@ import _ from 'underscore';
67
interface Props {
78
backgroundPosition: 'top' | 'bottom' | 'left' | 'right';
89
buttonText?: string;
10+
citation?: string;
11+
citationLink?: string;
912
description?: string;
1013
image: string;
1114
imageAlt?: string;
@@ -171,10 +174,12 @@ const TextImage = (props: Props) => {
171174
height: imageHeight ? `${imageHeight}px` : undefined
172175
}}
173176
>
174-
<img
177+
<ImageWithCitation
175178
alt={props.imageAlt}
176-
className='w-full h-full object-cover'
179+
classNames={{ image: 'w-full h-full object-cover', root: 'w-full h-full', citation: `text-xs text-gray-400${props.citationLink ? ' underline' : ''}` }}
177180
src={props.image}
181+
citation={props.citation}
182+
citationLink={props.citationLink}
178183
/>
179184
</div>
180185
</div>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
interface Props {
3+
alt?: string;
4+
citation?: string;
5+
citationLink?: string;
6+
classNames?: {
7+
root?: string;
8+
image?: string;
9+
citation?: string;
10+
};
11+
src: string;
12+
}
13+
14+
const { alt, citation, citationLink, classNames, src } = Astro.props;
15+
---
16+
17+
{
18+
citation ? (
19+
<div class={classNames?.root}>
20+
<img alt={alt} src={src} class={classNames?.image} />
21+
{citationLink ? (
22+
<a href={citationLink} class={classNames?.citation}>
23+
{citation}
24+
</a>
25+
) : (
26+
<p class={classNames?.citation}>{citation}</p>
27+
)}
28+
</div>
29+
) : (
30+
<img alt={alt} src={src} class={classNames?.image} />
31+
)
32+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
interface ImageWithCitationProps {
2+
alt?: string;
3+
citation?: string;
4+
citationLink?: string;
5+
classNames?: {
6+
root?: string;
7+
image?: string;
8+
citation?: string;
9+
};
10+
src: string;
11+
}
12+
13+
const ImageWithCitation = (props: ImageWithCitationProps) => {
14+
const { alt, citation, citationLink, classNames, src } = props;
15+
return citation ? (
16+
<div className={classNames?.root}>
17+
<img alt={alt} src={src} className={classNames?.image} />
18+
{citationLink ? (
19+
<a href={citationLink} className={classNames?.citation}>
20+
{citation}
21+
</a>
22+
) : (
23+
<p className={classNames?.citation}>{citation}</p>
24+
)}
25+
</div>
26+
) : (
27+
<img alt={alt} src={src} className={classNames?.image} />
28+
);
29+
};
30+
31+
export default ImageWithCitation;

src/layouts/Page.astro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ const SectionTypes = {
103103
<TextImage
104104
backgroundPosition={section.background_position}
105105
buttonText={section.button_text}
106+
citation={section.citation}
107+
citationLink={section.citation_link}
106108
description={section.description}
107109
image={section.image}
108110
imageAlt={section.image_alt}

tina/content/pages.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,14 @@ const Pages: Collection = {
195195
name: 'url',
196196
label: 'URL',
197197
type: 'string'
198+
}, {
199+
name: 'citation',
200+
label: 'Image Citation Text',
201+
type: 'string'
202+
}, {
203+
name: 'citation_link',
204+
label: 'Image Citation Link',
205+
type: 'string'
198206
}]
199207
}]
200208
}, {
@@ -296,6 +304,14 @@ const Pages: Collection = {
296304
name: 'url',
297305
label: 'URL',
298306
type: 'string'
307+
}, {
308+
name: 'citation',
309+
label: 'Image Citation Text',
310+
type: 'string'
311+
}, {
312+
name: 'citation_link',
313+
label: 'Image Citation Link',
314+
type: 'string'
299315
}, {
300316
name: 'background_position',
301317
label: 'Background Position',

tina/tina-lock.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)