Skip to content

Commit

Permalink
fix(styles): center newsletterBanner
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasbenary committed Nov 22, 2024
1 parent 544f7ab commit 02908a3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ChainAbstraction } from '@/components/home/ChainAbstraction';
import { Contracts } from '@/components/home/Contracts';
import { Data } from '@/components/home/Data';
import { DecentralizedApps } from '@/components/home/DecentralizedApps';
import { useNavigationStore } from '@/components/sidebar-navigation/store';
import useDeviceType from '@/hooks/useDeviceType';
import { useDefaultLayout } from '@/hooks/useLayout';
import type { NextPageWithLayout } from '@/utils/types';
Expand Down Expand Up @@ -37,15 +38,16 @@ const StyledCard = ({ href, title, description }: { href: string; title: string;
);
};

const NewsletterBanner = styled.div`
const NewsletterBanner = styled.div<{ isSidebarExpanded: boolean }>`
background-color: #0072ce;
color: white;
padding: 8px;
text-align: center;
font-size: 14px;
position: absolute;
top: 0;
left: 0;
left: ${(p) => (p.isSidebarExpanded ? 'var(--sidebar-width-expanded)' : 'var(--sidebar-width-collapsed)')};
transition: all var(--sidebar-expand-transition-speed);
right: 0;
@media (max-width: 1240px) {
Expand Down Expand Up @@ -73,6 +75,7 @@ const HomePage: NextPageWithLayout = () => {
const [nearStats, setNearStats] = useState<NearBlocks>();
const deviceType = useDeviceType();
const [visible, setVisible] = useState(false);
const isSidebarExpanded = useNavigationStore((store) => store.isSidebarExpanded && !store.expandedDrawer);

useEffect(() => {
const isClosed = localStorage.getItem('newsletterBannerClosed');
Expand Down Expand Up @@ -114,7 +117,7 @@ const HomePage: NextPageWithLayout = () => {
return (
<Section grow="available">
{visible && (
<NewsletterBanner>
<NewsletterBanner isSidebarExpanded={isSidebarExpanded}>
Stay updated!{' '}
<a
href="https://bit.ly/devhubnews"
Expand Down

0 comments on commit 02908a3

Please sign in to comment.