diff --git a/src/components/ArticleRow.tsx b/src/components/ArticleRow.tsx index 5091645..0f6ef20 100644 --- a/src/components/ArticleRow.tsx +++ b/src/components/ArticleRow.tsx @@ -18,7 +18,7 @@ export default function ArticleRow({ }; return ( -
+
{thumbUrl ? {article.title} : null}
@@ -26,6 +26,7 @@ export default function ArticleRow({

{article.title}

diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 0ff4100..ff9b211 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -17,8 +17,18 @@ let pages = [ ], }, { - url: '/news', + url: '#', title: 'News', + items: [ + { + url: '/news', + title: 'News', + }, + { + url: '#', + title: 'Newsletter (In development!)', + }, + ], }, { url: '/initiatives', @@ -72,14 +82,39 @@ export default function Navbar() {
{/* Most of these are external so we use tags instead of */} - {page.items?.map((item) => ( - <> - - {item.title} - -
- - ))} + {page.items?.map((item) => { + let isExternal = /https?:\/\//.test(item.url); + if (isExternal) { + // Treat external links differently; add 'target=_blank' so they + // open in a new window + return ( + <> + + {item.title} + +
+ + ); + } + return ( + <> + + {item.title} + +
+ + ); + })}
); diff --git a/src/imageUrl.js b/src/imageUrl.js deleted file mode 100644 index 92b3160..0000000 --- a/src/imageUrl.js +++ /dev/null @@ -1,7 +0,0 @@ -import imageUrlBuilder from '@sanity/image-url'; -import sanity from './sanity'; - -const builder = imageUrlBuilder(sanity); -export default function imageUrl(source) { - return builder.image(source); -} diff --git a/src/imageUrl.ts b/src/imageUrl.ts new file mode 100644 index 0000000..4b5828e --- /dev/null +++ b/src/imageUrl.ts @@ -0,0 +1,12 @@ +import { default as ImageUrlBuilder } from '@sanity/image-url'; +import sanity from './sanity'; + +const builder = ImageUrlBuilder(sanity); + +/** + * Build a URL for an image based on specified attributes + * @param {SanityImageSource} source The source image + */ +export default function imageUrl(source: any): any { + return builder.image(source); +}