Skip to content

Commit

Permalink
Merge pull request #174 from Vizzuality/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
mluena authored Oct 31, 2024
2 parents c0f4c0f + f98f377 commit 837dac0
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 37 deletions.
74 changes: 40 additions & 34 deletions client/src/containers/countries/countries-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,42 +104,48 @@ const CountriesTable = () => {
<td key={v.iso3} className="space-x-1 space-y-1.5 p-3">
{v.isResource ? (
v.resources?.length ? (
v.resources?.map((r) => (
<Popover key={r.link_title}>
<PopoverTrigger className="whitespace-nowrap rounded border border-brand1/20 bg-brand1/10 px-2.5 py-[3px] text-xs leading-none text-brand1 data-[state='open']:bg-brand1 data-[state='open']:text-white">
{r.link_title}
</PopoverTrigger>
<PopoverPortal>
<PopoverContent
id={`popover-${t.name}`}
className="w-fit min-w-[240px] max-w-[500px] space-y-3 border-none bg-gray-700 text-white"
>
<PopoverArrow className="fill-gray-700" />
v.resources?.map((r) => {
if (!/^https?:\/\/|^www\./i.test(r.link_url)) {
r.link_url = `https://${r.link_url}`;
}

<div className="flex items-center justify-between font-open-sans">
<p className="text-xxs font-semibold uppercase leading-none text-gray-400">
{t.name}
</p>
<PopoverClose>
<LuX className="h-6 w-6 text-white" />
</PopoverClose>
</div>
<p className="border-b border-white/20 pb-3 text-xl">
{r.link_title}
</p>
<p className="text-xs">{r.description}</p>
<a
href={r.link_url}
target="_blank"
rel="noopener noreferrer"
className="flex items-center gap-2 py-1.5 text-xs text-brand2"
return (
<Popover key={r.link_title}>
<PopoverTrigger className="whitespace-nowrap rounded border border-brand1/20 bg-brand1/10 px-2.5 py-[3px] text-xs leading-none text-brand1 data-[state='open']:bg-brand1 data-[state='open']:text-white">
{r.link_title}
</PopoverTrigger>
<PopoverPortal>
<PopoverContent
id={`popover-${t.name}`}
className="w-fit min-w-[240px] max-w-[500px] space-y-3 border-none bg-gray-700 text-white"
>
Learn more <LuExternalLink className="h-5 w-5" />
</a>
</PopoverContent>
</PopoverPortal>
</Popover>
))
<PopoverArrow className="fill-gray-700" />

<div className="flex items-center justify-between font-open-sans">
<p className="text-xxs font-semibold uppercase leading-none text-gray-400">
{t.name}
</p>
<PopoverClose>
<LuX className="h-6 w-6 text-white" />
</PopoverClose>
</div>
<p className="border-b border-white/20 pb-3 text-xl">
{r.link_title}
</p>
<p className="text-xs">{r.description}</p>
<a
href={r.link_url}
target="_blank"
rel="noopener noreferrer"
className="flex items-center gap-2 py-1.5 text-xs text-brand2"
>
Learn more <LuExternalLink className="h-5 w-5" />
</a>
</PopoverContent>
</PopoverPortal>
</Popover>
);
})
) : (
"-"
)
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/countries/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const useTableData = () => {
isDatasetValueProperty(value_type) &&
datasetValue?.attributes?.[value_type];
const country = countriesData?.data?.find((c1) => c1.attributes?.iso3 === c);
console.log({ country, c, datasetValue, value });

return {
iso3: c,
countryLink: country?.attributes?.link,
Expand Down
6 changes: 4 additions & 2 deletions cms/src/api/resource/content-types/resource/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"info": {
"singularName": "resource",
"pluralName": "resources",
"displayName": "Resource"
"displayName": "Resource",
"description": ""
},
"options": {
"draftAndPublish": true
Expand All @@ -17,7 +18,8 @@
},
"link_url": {
"type": "text",
"required": true
"required": true,
"regex": "/^(https?:\\/\\/|www\\.)[a-zA-Z0-9-]+\\.[a-zA-Z]{2,}(\\/[^\\s]*)?$/"
},
"description": {
"type": "text"
Expand Down
1 change: 1 addition & 0 deletions cms/types/generated/contentTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1489,6 +1489,7 @@ export interface ApiResourceResource extends Schema.CollectionType {
singularName: 'resource';
pluralName: 'resources';
displayName: 'Resource';
description: '';
};
options: {
draftAndPublish: true;
Expand Down

0 comments on commit 837dac0

Please sign in to comment.