diff --git a/deploy/tools/envs-validator/schema.ts b/deploy/tools/envs-validator/schema.ts index b67df304ad..7f19d78a00 100644 --- a/deploy/tools/envs-validator/schema.ts +++ b/deploy/tools/envs-validator/schema.ts @@ -590,6 +590,7 @@ const footerLinkSchema: yup.ObjectSchema = yup .object({ text: yup.string().required(), url: yup.string().test(urlTest).required(), + iconUrl: yup.array().of(yup.string().required().test(urlTest)), }); const footerLinkGroupSchema: yup.ObjectSchema = yup diff --git a/deploy/tools/envs-validator/test/assets/configs/footer_links.json b/deploy/tools/envs-validator/test/assets/configs/footer_links.json index d3f7e7d437..864295b952 100644 --- a/deploy/tools/envs-validator/test/assets/configs/footer_links.json +++ b/deploy/tools/envs-validator/test/assets/configs/footer_links.json @@ -17,7 +17,11 @@ "links": [ { "text": "Develop", - "url": "https://example.com" + "url": "https://example.com", + "iconUrl": [ + "https://example.com/mocks/image_s.jpg", + "https://example.com/mocks/image_svg.svg" + ] }, { "text": "Grants", diff --git a/docs/ENVS.md b/docs/ENVS.md index e6889e73d9..fb3adebbf3 100644 --- a/docs/ENVS.md +++ b/docs/ENVS.md @@ -192,7 +192,7 @@ The app version shown in the footer is derived from build-time ENV variables `NE | Variable | Type| Description | Compulsoriness | Default value | Example value | | --- | --- | --- | --- | --- | --- | | title | `string` | Title of link group | Required | - | `Company` | -| links | `Array<{'text':string;'url':string;}>` | list of links | Required | - | `[{'text':'Homepage','url':'https://www.blockscout.com'}]` | +| links | `Array<{'text':string;'url':string;'iconUrl'?:[string,string]}>` | An array contains a list of links in the column. Each link can optionally have an `icon_url` property, which should include an array of two external image URLs for light and dark themes, respectively. If only one URL is provided, it will be used for both color schemes. We expect the icons to be square, with a minimum size of 40px by 40px or in SVG format. | Required | - | `[{'text':'Homepage','url':'https://www.blockscout.com'}]` |   diff --git a/mocks/config/footerLinks.ts b/mocks/config/footerLinks.ts index 5ec3bdf9bf..4188db770c 100644 --- a/mocks/config/footerLinks.ts +++ b/mocks/config/footerLinks.ts @@ -79,6 +79,10 @@ export const FOOTER_LINKS: Array = [ { text: 'MetaDock', url: 'https://blocksec.com/metadock', + iconUrl: [ + 'http://localhost:3000/mocks/image_s.jpg', + 'http://localhost:3000/mocks/image_svg.svg', + ], }, { text: 'Sourcify', diff --git a/types/footerLinks.ts b/types/footerLinks.ts index 78dccf2af4..4e507359c7 100644 --- a/types/footerLinks.ts +++ b/types/footerLinks.ts @@ -1,6 +1,7 @@ export type CustomLink = { text: string; url: string; + iconUrl?: Array; }; export type CustomLinksGroup = { diff --git a/ui/snippets/footer/Footer.pw.tsx b/ui/snippets/footer/Footer.pw.tsx index 181bfcd9e9..4841dab85b 100644 --- a/ui/snippets/footer/Footer.pw.tsx +++ b/ui/snippets/footer/Footer.pw.tsx @@ -9,7 +9,7 @@ import Footer from './Footer'; const FOOTER_LINKS_URL = 'https://localhost:3000/footer-links.json'; test.describe('with custom links, max cols', () => { - test.beforeEach(async({ render, mockApiResponse, mockConfigResponse, injectMetaMaskProvider, mockEnvs }) => { + test.beforeEach(async({ render, mockApiResponse, mockConfigResponse, injectMetaMaskProvider, mockEnvs, mockAssetResponse }) => { await mockEnvs([ [ 'NEXT_PUBLIC_FOOTER_LINKS', FOOTER_LINKS_URL ], ]); @@ -21,6 +21,8 @@ test.describe('with custom links, max cols', () => { indexed_internal_transactions_ratio: '0.1', indexed_blocks_ratio: '0.1', }); + await mockAssetResponse(FOOTER_LINKS[3].links[0].iconUrl?.[0]!, './playwright/mocks/image_s.jpg'); + await mockAssetResponse(FOOTER_LINKS[3].links[0].iconUrl?.[1]!, './playwright/mocks/image_svg.svg'); await render(