mirror of
https://github.com/web3privacy/web
synced 2024-10-15 18:26:27 +02:00
Completed the updates.
This commit is contained in:
parent
ba477a68bd
commit
15565b23b7
3 changed files with 28 additions and 5 deletions
|
@ -22,7 +22,7 @@ const {
|
||||||
images.slice(0, 4).map((image, index) => (
|
images.slice(0, 4).map((image, index) => (
|
||||||
<div class="flex-auto overflow-hidden">
|
<div class="flex-auto overflow-hidden">
|
||||||
<img
|
<img
|
||||||
class="object-cover w-full max-h-28 md:max-h-[223px] cursor-pointer gallery-image"
|
class="object-cover w-full max-h-28 max-h-[80px] md:max-h-[223px] cursor-pointer gallery-image"
|
||||||
src={image.webp}
|
src={image.webp}
|
||||||
alt={`Image ${index + 1}`}
|
alt={`Image ${index + 1}`}
|
||||||
data-index={index}
|
data-index={index}
|
||||||
|
@ -39,7 +39,7 @@ const {
|
||||||
images.slice(4).map((image, index) => (
|
images.slice(4).map((image, index) => (
|
||||||
<div class="flex-auto overflow-hidden">
|
<div class="flex-auto overflow-hidden">
|
||||||
<img
|
<img
|
||||||
class="object-cover w-full max-h-28 md:max-h-[223px] cursor-pointer gallery-image"
|
class="object-cover w-full max-h-28 max-h-[80px] md:max-h-[223px] cursor-pointer gallery-image"
|
||||||
src={image.webp}
|
src={image.webp}
|
||||||
alt={`Image ${index + 5}`}
|
alt={`Image ${index + 5}`}
|
||||||
data-index={index + 4}
|
data-index={index + 4}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
---
|
---
|
||||||
|
import { parseAndWrapCaptions } from "../../utils/captionParser";
|
||||||
|
|
||||||
const { people, team, core } = Astro.props;
|
const { people, team, core } = Astro.props;
|
||||||
|
|
||||||
// Filter based on the `core` parameter
|
// Filter based on the `core` parameter
|
||||||
|
@ -58,9 +60,9 @@ function personLink(person) {
|
||||||
{person.refs.matrix && ` | Matrix: ${person.refs.matrix}`}
|
{person.refs.matrix && ` | Matrix: ${person.refs.matrix}`}
|
||||||
{person.refs.email && ` | Email: ${person.refs.email}`}
|
{person.refs.email && ` | Email: ${person.refs.email}`}
|
||||||
</p>
|
</p>
|
||||||
<p class="text-xs text-gray-500">
|
<p class="text-xs text-gray-500" set:html={person.caption && parseAndWrapCaptions(person.caption)}></p>
|
||||||
{person.caption && person.caption}
|
|
||||||
</p>
|
|
||||||
<p class="text-xs text-gray-500">
|
<p class="text-xs text-gray-500">
|
||||||
{person.refs.designation && `${person.refs.designation}`}
|
{person.refs.designation && `${person.refs.designation}`}
|
||||||
|
|
||||||
|
|
21
utils/captionParser.js
Normal file
21
utils/captionParser.js
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
export function parseAndWrapCaptions(caption) {
|
||||||
|
console.log(caption)
|
||||||
|
return caption.replace(/\[([^\]]+)\]\((https?:\/\/[^\)]+)\)/g, (match,text, content) => {
|
||||||
|
// Split the content by spaces to identify potential URLs
|
||||||
|
const parts = content.split(' ');
|
||||||
|
const url = parts.find(part => part.startsWith('https://'));
|
||||||
|
|
||||||
|
console.log(content)
|
||||||
|
if (url) {
|
||||||
|
// If a URL is found, wrap the content in an anchor tag using the first URL
|
||||||
|
return `<a href="${url}"
|
||||||
|
target="_blank"
|
||||||
|
class="underline"
|
||||||
|
style="text-underline-offset: 4px;"
|
||||||
|
>${text}</a>`;
|
||||||
|
} else {
|
||||||
|
// If no URL, join the parts with a comma
|
||||||
|
return content.split(' ').join(', ');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in a new issue