11import React from "react" ;
22import Link from "next/link" ;
33import { styled } from "linaria/react" ;
4- import { media } from "../../themes" ;
4+ import { breakpoints , media } from "../../themes" ;
5+ import useWindowSize from "../../hooks/useWindowSize" ;
56
67// We don't use the theme here as this is a quickfix, and it doesn't change
78// depending on dark/light mode.
89const alphaBannerBackground = "#4F00A3" as const ;
910const alphaBannerText = "#F2F2F2" as const ;
10- const alphaBannerCTA = "#C4C4C4" as const ;
1111const alphaBannerBraket = "#EDCF00" as const ;
1212
1313const AlphaBannerContainer = styled . section `
@@ -19,7 +19,6 @@ const AlphaBannerContainer = styled.section`
1919 display: flex;
2020 flex-direction: row;
2121 justify-content: center;
22- padding-bottom: 15px;
2322
2423 align-items: center;
2524 background-color: ${ alphaBannerBackground } ;
@@ -33,10 +32,7 @@ const AlphaBannerContainer = styled.section`
3332 vertical-align: middle;
3433 text-align: center;
3534
36- font-size: 14px;
37- a.CTA {
38- font-size: 13px;
39- }
35+ font-size: 15px;
4036
4137 span {
4238 height: 27px;
@@ -55,43 +51,33 @@ const AlphaBannerContainer = styled.section`
5551 line-height: 27px;
5652 }
5753
58- a.CTA {
59- color: ${ alphaBannerCTA } ;
60- position: absolute;
61- width: 100%;
62- left: 0;
63- bottom: -15px;
64- }
65-
6654 ${ media . smd } {
6755 font-size: 18px;
6856 padding-bottom: unset;
6957
70- a.CTA {
71- position: relative;
72- font-size: 18px;
73- width: unset;
74- left: unset;
75- bottom: unset;
76- padding-left: 8px;
77- }
78-
7958 span.bannerContent {
8059 padding-top: 3px;
8160 }
8261 }
8362` ;
8463
8564const AlphaBanner = ( ) => {
65+ const windowSize = useWindowSize ( ) ;
66+ const isDesktop = breakpoints . smd <= windowSize . width ;
67+
8668 return (
8769 < Link href = "/hardhat3-alpha" passHref >
8870 < AlphaBannerContainer >
8971 < span className = "braket" > [</ span >
9072 < span className = "bannerContent" >
91- < b > Hardhat 3 alpha</ b > has been released.
92- { /* We don't pass href because the Link already does it */ }
93- { /* eslint-disable-next-line jsx-a11y/anchor-is-valid */ }
94- < a className = "CTA" > Check it out</ a >
73+ { isDesktop ? (
74+ < >
75+ < b > Hardhat 3 alpha</ b > : Rust rewrite, Solidity tests, multi-chain,
76+ and more
77+ </ >
78+ ) : (
79+ < > Try the Hardhat 3 alpha release</ >
80+ ) }
9581 </ span >
9682
9783 < span className = "braket" > ]</ span >
0 commit comments