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

Button's href is a variant #6181

Merged
merged 1 commit into from
Sep 29, 2020
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ module Section = {
title: string,
description: string,
buttonCopy: string,
buttonUrl: string,
buttonUrl: [`External(string) | `Internal(string)],
image: string,
};

Expand Down Expand Up @@ -114,7 +114,7 @@ module Section = {
{React.string(row.description)}
</p>
<div className=Styles.button>
<Button bgColor=Theme.Colors.white>
<Button href=row.buttonUrl bgColor=Theme.Colors.white>
{React.string(row.buttonCopy)}
<span className=SectionStyles.icon>
<Icon kind=Icon.ArrowRightMedium />
Expand All @@ -134,7 +134,7 @@ module Section = {
title: string,
description: string,
linkCopy: string,
linkUrl: string,
linkUrl: [`External(string) | `Internal(string)],
image: string,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ module Section = {
title: string,
description: string,
buttonCopy: string,
buttonUrl: string,
buttonUrl: [`External(string) | `Internal(string)],
image: string,
};

Expand Down
2 changes: 1 addition & 1 deletion frontend/website-redesign/src/components/BlogModule.re
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ let make = (~source) => {
<Title
copy="In the News"
buttonCopy="See All Press"
buttonHref="/blog"
buttonHref=`Internal("/blog")
/>
</Wrapped>
<ListModule
Expand Down
9 changes: 6 additions & 3 deletions frontend/website-redesign/src/components/Button.re
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,12 @@ module Styles = {
module Link = {
[@react.component]
let make = (~href, ~children) => {
Js.Re.test_(Js.Re.fromString("https?::"), href) ?
<a href> children </a> :
switch (href) {
| `Scroll_to_top => <Next.Link href=""> children </Next.Link>
| `External(href) => <a className=Css.(style([textDecoration(`none)])) href> children </a>
| `Internal(href) =>
<Next.Link href> children </Next.Link>
}
};
};

Expand All @@ -92,7 +95,7 @@ module Link = {
[@react.component]
let make =
(
~href="",
~href,
~children=?,
~height=`rem(3.25),
~width=`rem(10.9),
Expand Down
4 changes: 0 additions & 4 deletions frontend/website-redesign/src/components/Contributors.re
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ module GenesisMembersGrid = {
"Meet the node operators, developers, and community builders making Mina happen.",
)}
</p>
<Button bgColor=Theme.Colors.orange width={`rem(13.5)}>
{React.string("See More Members ")}
<Icon kind=Icon.ArrowRightMedium size=1. />
</Button>
</div>
<TeamMember
fullName="Greg | DeFidog"
Expand Down
5 changes: 2 additions & 3 deletions frontend/website-redesign/src/components/EmailInput.re
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,11 @@ let make = () => {
/>
<div className=Styles.submitButton>
<Button
onClick=[%bs.raw "() => window.location = 'https://share.hsforms.com/1olz9N8_zTHW-RKQus2o3Kw4xuul'"]
height={`rem(3.25)}
width={`rem(7.93)}
href={
"https://share.hsforms.com/1olz9N8_zTHW-RKQus2o3Kw4xuul?email="
++ email
`External("https://share.hsforms.com/1olz9N8_zTHW-RKQus2o3Kw4xuul?email="
++ email)
}
dark=true>
{React.string("Submit")}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Row = {
buttonTextColor: Css.color,
buttonText: string,
dark: bool,
href: string,
href: [`External(string) | `Internal(string)],
};

type t = {
Expand Down
23 changes: 14 additions & 9 deletions frontend/website-redesign/src/components/Footer.re
Original file line number Diff line number Diff line change
Expand Up @@ -81,24 +81,28 @@ module SocialIcons = {
height(`rem(2.)),
color(white),
]);

let anchor = style([
textDecoration(`none)
]);
};

[@react.component]
let make = () => {
<div className=Styles.iconsRow>
<Next.Link href="https://discord.com/invite/Vexf4ED">
<a className=Styles.anchor href="https://discord.com/invite/Vexf4ED">
<Icon kind=Icon.Discord size=2. />
</Next.Link>
<Next.Link href="https://twitter.com/minaprotocol">
</a>
<a className=Styles.anchor href="https://twitter.com/minaprotocol">
<Icon kind=Icon.Twitter size=2. />
</Next.Link>
<Next.Link href="https://facebook.com/minaprotocol">
</a>
<a className=Styles.anchor href="https://facebook.com/minaprotocol">
<Icon kind=Icon.Facebook size=2. />
</Next.Link>
<Next.Link href="https://t.me/minaprotocol">
</a>
<a className=Styles.anchor href="https://t.me/minaprotocol">
<Icon kind=Icon.Telegram size=2. />
</Next.Link>
<Next.Link href=""> <Icon kind=Icon.WeChat size=2. /> </Next.Link>
</a>
<a className=Styles.anchor href="https://forums.codaprotocol.com/t/coda-protocol-chinese-resources/200"> <Icon kind=Icon.WeChat size=2. /> </a>
</div>;
};
};
Expand Down Expand Up @@ -266,6 +270,7 @@ let make = () => {
<Subfooter />
<div className=Styles.backToTopButton>
<Button
href=`Scroll_to_top
height={`rem(4.125)}
width={`rem(3.75)}
bgColor=Theme.Colors.black
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,6 @@ let make = (~name, ~photo, ~quote, ~location, ~twitter, ~github, ~blogPost) => {
}}
</div>
</div>
<div className=Styles.button>
<Button bgColor=Theme.Colors.white>
<a className=Styles.buttonLink href=blogPost>
{React.string("Learn More")}
</a>
<Icon kind=Icon.ArrowRightMedium />
</Button>
</div>
</div>
</div>;
};
2 changes: 1 addition & 1 deletion frontend/website-redesign/src/components/HomepageHero.re
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ let make = (~backgroundImg) => {
</span>
<span className=Styles.heroButton>
<Button
href="/tech"
href=`Internal("/tech")
bgColor=Theme.Colors.white
paddingX=1.
width={`rem(13.5)}>
Expand Down
2 changes: 1 addition & 1 deletion frontend/website-redesign/src/components/Nav.re
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ let make = (~dark=false) => {
<NavLink label="Blog" href="/blog" dark />
<Spacer width=1.5 />
<div className=Styles.ctaContainer>
<Button href="/genesis" width={`rem(13.)} paddingX=1. dark>
<Button href=`Internal("/genesis") width={`rem(13.)} paddingX=1. dark>
<img src="/static/img/promo-logo.svg" height="40" />
<Spacer width=0.5 />
<span> {React.string("Join Genesis Token Program")} </span>
Expand Down
10 changes: 3 additions & 7 deletions frontend/website-redesign/src/components/ProfileHero.re
Original file line number Diff line number Diff line change
Expand Up @@ -164,19 +164,15 @@ module Links = {
let make = () => {
<div className=Styles.buttonAndLinks>
<Button
href="https://forums.minaprotocol.com/t/testnet-beta-release-3-2b-challenges/435"
href=`External("https://forums.minaprotocol.com/t/testnet-beta-release-3-2b-challenges/435")
bgColor=Theme.Colors.black>
{React.string("Current Challenges")}
</Button>
<div className=Styles.linksColumn>
<Next.Link href="https://bit.ly/leaderboardFAQ">
<a className=Styles.link> {React.string("Leaderboard FAQ")} </a>
</Next.Link>
<Next.Link href="https://bit.ly/MinaDiscord">
<a className=Styles.link>
<a href="https://bit.ly/leaderboardFAQ" className=Styles.link> {React.string("Leaderboard FAQ")} </a>
<a href="https://bit.ly/MinaDiscord" className=Styles.link>
{React.string("Discord #leaderboard-qa Channel")}
</a>
</Next.Link>
</div>
</div>;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ let make = () => {
</p>
<Spacer height=2. />
<span className=Styles.button>
<Button bgColor=Theme.Colors.orange dark=true href="/docs">
<Button bgColor=Theme.Colors.orange dark=true href=`Internal("/docs")>
{React.string("Get Started")}
<Icon kind=Icon.ArrowRightMedium />
</Button>
Expand Down
4 changes: 2 additions & 2 deletions frontend/website-redesign/src/components/Summary.re
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ let make = () => {
<div className=Styles.heroRight>
<div className=Styles.buttonRow>
<Button
href="https://bit.ly/3dNmPle"
href=`External("https://bit.ly/3dNmPle")
bgColor=Theme.Colors.black
width={`rem(15.)}
paddingX=1.5>
Expand All @@ -306,7 +306,7 @@ let make = () => {
<Icon kind=Icon.ArrowRightMedium />
</Button>
<Spacer width=2.0 height=1.0 />
<Button bgColor=Theme.Colors.black width={`rem(13.)} paddingX=1.5>
<Button href=`Internal("/genesis") bgColor=Theme.Colors.black width={`rem(13.)} paddingX=1.5>
<p className=Theme.Type.buttonLabel>
{React.string("Genesis Program")}
</p>
Expand Down
3 changes: 2 additions & 1 deletion frontend/website-redesign/src/components/WorkWithMina.re
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,11 @@ let make = () => {
<div className=Styles.container>
<div className=Styles.headerCopy>
<h2 className=Styles.header> {React.string("Work with Mina")} </h2>
/* TODO: Re-enable when we have an href for this
<Button bgColor=Theme.Colors.black width={`rem(14.6)} paddingX=1.3>
{React.string("See All Opportunities")}
<Icon kind=Icon.ArrowRightMedium />
</Button>
</Button> */
</div>
<div className=Styles.content> <FeaturedContent /> <ContentColumn /> </div>
</div>;
Expand Down
6 changes: 2 additions & 4 deletions frontend/website-redesign/src/pages/Blog.re
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ module MorePosts = {
<BlogModule.Title
copy="More Blog posts"
buttonCopy="See all posts"
buttonHref="/blog/all"
buttonHref=`Internal("/blog/all")
/>
<Content posts />
</div>;
Expand Down Expand Up @@ -180,9 +180,7 @@ let make = (~posts) => {
buttonTextColor: Theme.Colors.white,
buttonText: "Read more",
dark: true,
href:
{Js.log("/blog/" ++ featured.slug);
"/blog/" ++ featured.slug},
href: `Internal("/blog/" ++ featured.slug),
},
}
/>
Expand Down
6 changes: 3 additions & 3 deletions frontend/website-redesign/src/pages/Community.re
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ let make = (~profiles) => {
buttonTextColor: Theme.Colors.white,
buttonText: "Apply now",
dark: true,
href: "/genesis",
href: `Internal("/genesis"),
},
}>
<Spacer height=4. />
Expand Down Expand Up @@ -276,7 +276,7 @@ let make = (~profiles) => {
"Mina rewards community members for contributing to Testnet with Testnet Points, making them stronger applicants for the Genesis Program. ",
)}
</p>
<Button bgColor=Theme.Colors.orange href="/leaderboard">
<Button bgColor=Theme.Colors.orange href=`Internal("/leaderboard")>
{React.string("See The Full Leaderboard")}
<Icon kind=Icon.ArrowRightSmall />
</Button>
Expand Down Expand Up @@ -310,7 +310,7 @@ let make = (~profiles) => {
buttonColor: Theme.Colors.white,
buttonTextColor: Theme.Colors.orange,
dark: false,
href: Constants.codeOfConductUrl,
href: `External(Constants.codeOfConductUrl),
},
}
/>
Expand Down
12 changes: 6 additions & 6 deletions frontend/website-redesign/src/pages/Demo.re
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,19 @@ let make = () => {
<div className=Styles.container>
/*** Regular buttons */

<Button bgColor=Theme.Colors.orange>
<Button href=`Scroll_to_top bgColor=Theme.Colors.orange>
{React.string("Button Label")}
<Icon kind=Icon.ArrowRightMedium />
</Button>
<Button bgColor=Theme.Colors.mint dark=true>
<Button href=`Scroll_to_top bgColor=Theme.Colors.mint dark=true>
{React.string("Button label ")}
<Icon kind=Icon.ArrowRightMedium />
</Button>
<Button bgColor=Theme.Colors.black>
<Button href=`Scroll_to_top bgColor=Theme.Colors.black>
{React.string("Button label")}
<Icon kind=Icon.ArrowRightMedium />
</Button>
<Button bgColor=Theme.Colors.white>
<Button href=`Scroll_to_top bgColor=Theme.Colors.white>
{React.string("Button label")}
<Icon kind=Icon.ArrowRightMedium />
</Button>
Expand All @@ -72,7 +72,7 @@ let make = () => {
</span>
</PromoButton>
/***Join Genesis Button, uses the CoreProtocolLarge icon */
<Button bgColor=Theme.Colors.orange paddingX=1. paddingY=0.5>
<Button href=`Scroll_to_top bgColor=Theme.Colors.orange paddingX=1. paddingY=0.5>
<Icon kind=Icon.CoreProtocolLarge size=2.5 />
<span className=Styles.joinGenesisButton>
{React.string("Join Genesis + Earn Mina")}
Expand Down Expand Up @@ -143,7 +143,7 @@ let make = () => {
AlternatingSections.Section.SimpleRow.title: "Run a Node",
description: "You don't have to have expensive hardware, wait days for the blockchain to sync, or use a ton of compute power to participate in consensus. Just follow clear, straightforward instructions and connect to the live peer-to-peer Mina network.",
buttonCopy: "Get Started",
buttonUrl: "/",
buttonUrl: `Internal("/"),
image: "/static/img/ProgrammableMoney.png",
},
|])
Expand Down
8 changes: 3 additions & 5 deletions frontend/website-redesign/src/pages/Genesis.re
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,7 @@ let make = (~profiles) => {
}>
<Spacer height=2. />
<Button
onClick=[%bs.raw
"() => window.location = 'https://docs.google.com/forms/d/e/1FAIpQLSebjJSGobXHIOPlnjnGtp0InsNFU3Z7Sig_xoqCfeaKebJ0XQ/viewform'"
]
href=`External("https://docs.google.com/forms/d/e/1FAIpQLSebjJSGobXHIOPlnjnGtp0InsNFU3Z7Sig_xoqCfeaKebJ0XQ/viewform")
bgColor=Theme.Colors.black>
{React.string("Apply Now")}
<Icon kind=Icon.ArrowRightMedium />
Expand All @@ -375,7 +373,7 @@ let make = (~profiles) => {
buttonColor: Theme.Colors.orange,
buttonTextColor: Theme.Colors.white,
dark: false,
href: "#",
href: `External("https://docs.google.com/forms/d/e/1FAIpQLSebjJSGobXHIOPlnjnGtp0InsNFU3Z7Sig_xoqCfeaKebJ0XQ/viewform"),
},
}
/>
Expand Down Expand Up @@ -404,7 +402,7 @@ let make = (~profiles) => {
"Mina rewards community members for contributing to Testnet with Testnet Points, making them stronger applicants for the Genesis Program. ",
)}
</p>
<Button bgColor=Theme.Colors.orange href="/leaderboard">
<Button bgColor=Theme.Colors.orange href=`Internal("/leaderboard")>
{React.string("See The Full Leaderboard")}
<Icon kind=Icon.ArrowRightSmall />
</Button>
Expand Down
Loading