Skip to content

Commit

Permalink
Hide nearcon banner on it's own page (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
shelegdmitriy authored Aug 8, 2023
1 parent 616ad7b commit f880c94
Showing 1 changed file with 4 additions and 22 deletions.
26 changes: 4 additions & 22 deletions src/components/banners/NearconBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import styled from 'styled-components';
import icon from '@/assets/images/nearcon_banner_2023.svg';
import { Button } from '@/components/lib/Button';
import { useBanner } from '@/hooks/useBanner';
import { useCurrentComponentStore } from '@/stores/current-component';

type FlexProps = {
gap?: string;
Expand All @@ -14,13 +15,6 @@ type FlexProps = {
wrap?: string;
};

type TextProps = {
size?: string;
lineHeight?: string;
weight?: string;
color?: string;
};

const Wrapper = styled.div`
background: #00ec97;
Expand All @@ -32,10 +26,8 @@ const Wrapper = styled.div`
display: none !important;
}
}
&.mobile-button {
display: none;
@media (max-width: 380px) {
display: inline !important;
}
Expand Down Expand Up @@ -73,31 +65,21 @@ const Flex = styled.div<FlexProps>`
}
`;

const Text = styled.p<TextProps>`
font-family: 'FK Grotesk', sans-serif;
font-size: ${(p) => p.size ?? '18px'};
line-height: ${(p) => p.lineHeight ?? '1.5'};
font-weight: ${(p) => p.weight ?? '400'};
color: ${(p) => p.color ?? '#000'};
margin: 0;
`;

export const NearconBanner = () => {
const [isBannerVisible, setBanners] = useBanner();
const componentSrc = useCurrentComponentStore();
const isNearconWidget = componentSrc && componentSrc.src?.includes('nearcon23.near/widget/Index');

const closeBanner = () => {
setBanners(!isBannerVisible);
};

if (!isBannerVisible) return null;
if (!isBannerVisible || isNearconWidget) return null;

return (
<Wrapper>
<Flex gap="24px" alignItems="center" justifyContent="center">
<Image src={icon} alt="nearcon-banner" />
<Text size="16px" weight="500" className="d-none d-sm-inline">
Early Bird Tickets are live!
</Text>
<Link href="http://nearcon.org" target="_blank" className="banner-button desktop-button">
<Button
label="Get your tickets"
Expand Down

0 comments on commit f880c94

Please sign in to comment.