From c447b7b21ef251260996c140351f7d63a9a7ab0d Mon Sep 17 00:00:00 2001 From: Tal-Ben-Avi Date: Sun, 12 May 2024 13:28:39 +0300 Subject: [PATCH 1/2] Opening announcement banner on new tab --- .../pages/(components)/NavbarStickyBanner/NavbarStickyBanner.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/workspaces/website/src/pages/(components)/NavbarStickyBanner/NavbarStickyBanner.tsx b/workspaces/website/src/pages/(components)/NavbarStickyBanner/NavbarStickyBanner.tsx index 5667d144d4..c74171f9ae 100644 --- a/workspaces/website/src/pages/(components)/NavbarStickyBanner/NavbarStickyBanner.tsx +++ b/workspaces/website/src/pages/(components)/NavbarStickyBanner/NavbarStickyBanner.tsx @@ -77,6 +77,7 @@ const NavbarStickyBanner = ({ }} _hover={{ bgColor: "white" }} variant="solid" + target="_blank" > {buttonText} From b10d142eab3fa56041df4be5775edc00bf6713cb Mon Sep 17 00:00:00 2001 From: Tal-Ben-Avi Date: Sun, 12 May 2024 14:06:34 +0300 Subject: [PATCH 2/2] editing to have cms option --- _data/pages/home.yml | 1 + workspaces/cms-config/src/blocks.ts | 6 ++++++ workspaces/cms-data/src/pages.ts | 1 + workspaces/website/src/blocks/Block.tsx | 1 + .../(components)/NavbarStickyBanner/NavbarStickyBanner.tsx | 4 +++- 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/_data/pages/home.yml b/_data/pages/home.yml index 75bc0bda3e..733dc85cde 100644 --- a/_data/pages/home.yml +++ b/_data/pages/home.yml @@ -11,6 +11,7 @@ blocks: buttonText: See more buttonLink: https://starkware.co isActive: false + openNewPage: true - type: group blocks: - type: home_hero diff --git a/workspaces/cms-config/src/blocks.ts b/workspaces/cms-config/src/blocks.ts index dcbfdfa401..010d8d2d86 100644 --- a/workspaces/cms-config/src/blocks.ts +++ b/workspaces/cms-config/src/blocks.ts @@ -910,6 +910,12 @@ export const blocks = [ widget: "boolean", default: true, }, + { + name: "openNewPage", + label: "openNewPage", + widget: "boolean", + default: false, + }, ], }, ] satisfies CmsFieldList["types"]; diff --git a/workspaces/cms-data/src/pages.ts b/workspaces/cms-data/src/pages.ts index 9392ad7da6..9ec874c993 100644 --- a/workspaces/cms-data/src/pages.ts +++ b/workspaces/cms-data/src/pages.ts @@ -168,6 +168,7 @@ export interface NavStickyBannerBlock { readonly buttonText: string; readonly buttonLink: string; readonly isActive: boolean; + readonly openNewPage: boolean; } export interface LinkListBlock { diff --git a/workspaces/website/src/blocks/Block.tsx b/workspaces/website/src/blocks/Block.tsx index 5a795449b1..803c2f605d 100644 --- a/workspaces/website/src/blocks/Block.tsx +++ b/workspaces/website/src/blocks/Block.tsx @@ -215,6 +215,7 @@ export function Block({ text={block.text} buttonText={block.buttonText} buttonLink={block.buttonLink} + openNewPage={block.openNewPage} /> ); } diff --git a/workspaces/website/src/pages/(components)/NavbarStickyBanner/NavbarStickyBanner.tsx b/workspaces/website/src/pages/(components)/NavbarStickyBanner/NavbarStickyBanner.tsx index c74171f9ae..e5501645a9 100644 --- a/workspaces/website/src/pages/(components)/NavbarStickyBanner/NavbarStickyBanner.tsx +++ b/workspaces/website/src/pages/(components)/NavbarStickyBanner/NavbarStickyBanner.tsx @@ -11,12 +11,14 @@ interface NavbarStickyBannerProps { text: string; buttonText: string; buttonLink: string; + openNewPage?: boolean; } const NavbarStickyBanner = ({ text, buttonText, buttonLink, + openNewPage = false, }: NavbarStickyBannerProps) => { const hash = useMemo( () => sha256(text + buttonLink + buttonText).slice(-8), @@ -77,7 +79,7 @@ const NavbarStickyBanner = ({ }} _hover={{ bgColor: "white" }} variant="solid" - target="_blank" + target={openNewPage ? "_blank" : ""} > {buttonText}