-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1084 from near/feat/add-new-hzn-banner
feat: add new Horizon banner
- Loading branch information
Showing
4 changed files
with
167 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
import styled from 'styled-components'; | ||
|
||
import { Button } from '@/components/lib/Button'; | ||
import { Text } from '@/components/lib/Text'; | ||
import { useBanner } from '@/hooks/useBanner'; | ||
|
||
type Props = { | ||
inline?: boolean; | ||
}; | ||
|
||
type FlexProps = { | ||
gap?: string; | ||
alignItems?: string; | ||
justifyContent?: string; | ||
direction?: string; | ||
wrap?: string; | ||
}; | ||
|
||
const Wrapper = styled.div<{ | ||
inline?: boolean; | ||
}>` | ||
--bs-gutter-x: 1.5rem; | ||
padding: 8px calc(var(--bs-gutter-x) * 0.5); | ||
background: #00ec97; | ||
border-radius: ${(p) => (p.inline ? '5px' : 0)}; | ||
.banner-text { | ||
@media (max-width: 600px) { | ||
font-size: 12px; | ||
} | ||
} | ||
.banner-button { | ||
font-size: 14px; | ||
@media (max-width: 600px) { | ||
font-size: 12px; | ||
} | ||
&.desktop-button { | ||
@media (max-width: 600px) { | ||
display: none !important; | ||
} | ||
} | ||
&.mobile-button { | ||
display: none; | ||
@media (max-width: 600px) { | ||
display: inline-flex !important; | ||
} | ||
} | ||
} | ||
.close-button { | ||
all: unset; | ||
width: 14px; | ||
height: 14px; | ||
line-height: 14px; | ||
color: #664d04; | ||
background: transparent; | ||
outline: none; | ||
border: none; | ||
transition: color 0.2s; | ||
cursor: pointer; | ||
&:hover { | ||
border: none; | ||
background: transparent; | ||
} | ||
} | ||
`; | ||
|
||
const Flex = styled.div<FlexProps>` | ||
display: flex; | ||
gap: ${(p) => p.gap}; | ||
align-items: ${(p) => p.alignItems}; | ||
justify-content: ${(p) => p.justifyContent}; | ||
flex-direction: ${(p) => p.direction ?? 'row'}; | ||
flex-wrap: ${(p) => p.wrap ?? 'nowrap'}; | ||
@media (max-width: 576px) { | ||
gap: 10px; | ||
} | ||
`; | ||
|
||
export const HorizonBanner = (props: Props) => { | ||
const [isBannerVisible, setBanners] = useBanner(); | ||
|
||
const closeBanner = () => { | ||
setBanners(!isBannerVisible); | ||
}; | ||
|
||
if (!isBannerVisible) return null; | ||
|
||
return ( | ||
<Wrapper inline={props.inline}> | ||
<Flex gap="14px" alignItems="center" justifyContent="center"> | ||
<Text className="banner-text" weight="500"> | ||
Are you an early-stage founder? Apply to our equity-free accelerator program. Applications are now live! | ||
</Text> | ||
<Button | ||
href="https://airtable.com/appFoIqAoY0ikoVIb/shrst8Tt4PUtYTSvD" | ||
target="_blank" | ||
label="Apply Now" | ||
iconRight="ph-bold ph-arrow-up-right" | ||
variant="primary" | ||
fill="outline" | ||
size="small" | ||
className="banner-button desktop-button" | ||
/> | ||
|
||
<Button | ||
href="https://airtable.com/appFoIqAoY0ikoVIb/shrst8Tt4PUtYTSvD" | ||
target="_blank" | ||
label="Apply" | ||
iconRight="ph-bold ph-arrow-up-right" | ||
variant="primary" | ||
fill="outline" | ||
size="small" | ||
className="banner-button mobile-button" | ||
/> | ||
|
||
<Button | ||
type="button" | ||
onClick={closeBanner} | ||
label="Close" | ||
icon="ph-fill ph-x-circle" | ||
size="small" | ||
className="close-button" | ||
fill="ghost" | ||
/> | ||
</Flex> | ||
</Wrapper> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters