Skip to content

Commit

Permalink
editing to have cms option
Browse files Browse the repository at this point in the history
  • Loading branch information
TalBenAvi committed May 12, 2024
1 parent c447b7b commit b10d142
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
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",
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,7 +79,7 @@ const NavbarStickyBanner = ({
}}
_hover={{ bgColor: "white" }}
variant="solid"
target="_blank"
target={openNewPage ? "_blank" : ""}
>
{buttonText}
</Button>
Expand Down

0 comments on commit b10d142

Please sign in to comment.