Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opening announcement banner on new tab #2862

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions _data/pages/home.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ blocks:
buttonText: See more
buttonLink: https://starkware.co
isActive: false
openNewPage: true
- type: group
blocks:
- type: home_hero
Expand Down
6 changes: 6 additions & 0 deletions workspaces/cms-config/src/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,12 @@ export const blocks = [
widget: "boolean",
default: true,
},
{
name: "openNewPage",
label: "openNewPage",
Comment on lines +914 to +915
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: "openNewPage",
label: "openNewPage",
name: "isLinkOpenNewWindow",
label: "Open link in new window",

widget: "boolean",
default: false,
},
],
},
] satisfies CmsFieldList["types"];
Expand Down
1 change: 1 addition & 0 deletions workspaces/cms-data/src/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ export interface NavStickyBannerBlock {
readonly buttonText: string;
readonly buttonLink: string;
readonly isActive: boolean;
readonly openNewPage: boolean;
}

export interface LinkListBlock {
Expand Down
1 change: 1 addition & 0 deletions workspaces/website/src/blocks/Block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ export function Block({
text={block.text}
buttonText={block.buttonText}
buttonLink={block.buttonLink}
openNewPage={block.openNewPage}
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -77,6 +79,7 @@ const NavbarStickyBanner = ({
}}
_hover={{ bgColor: "white" }}
variant="solid"
target={openNewPage ? "_blank" : ""}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

>
{buttonText}
</Button>
Expand Down
Loading