Skip to content

Commit

Permalink
Merge pull request #4 from ahmnouira/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
ahmnouira authored Apr 17, 2022
2 parents 4ca74a4 + 9c6ac1b commit 69cb1f9
Show file tree
Hide file tree
Showing 8 changed files with 148 additions and 134 deletions.
2 changes: 1 addition & 1 deletion components/About/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const About = () => {
};

return (
<section id="about" className={styles.about}>
<section id="about-us" className={styles.about}>
<div className={styles['about-header']}>
<h3>About Us</h3>
<p>A top-tier team deeply experienced in real estate, startups, and technology.</p>
Expand Down
13 changes: 1 addition & 12 deletions components/Navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ const Navbar: React.FC<NavbarProps> = ({
},
{
text: 'About us',
onClick: () => handleAboutUsClick(),
path: '/?about=true',
path: '/?about-us=true',
},
{
text: 'Careers',
Expand All @@ -57,16 +56,6 @@ const Navbar: React.FC<NavbarProps> = ({
},
];

const handleAboutUsClick = () => {
router.pathname !== '/' && router.push('/?about=true');
router.pathname === '/' && handleMoveToId('about');
};

const handleButtonClick = () => {
router.pathname !== '/' && router.push('/?cta=true');
router.pathname === '/' && handleMoveToId();
};

const [activeLogoColor, setActiveLogoColor] = useState('');

if (!activeLogoColor) setActiveLogoColor(logoColor);
Expand Down
38 changes: 20 additions & 18 deletions components/Pillars/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,26 @@ const Pillars = () => {
<section className={styles.pillars}>
<h3>Our Pillars</h3>
<div className={styles['pillars-content']}>
{pillarCardsContent.map(({ title, subtitle, description, image, path }, index) => {
const isLast = index === pillarCardsContent.length - 1;
return (
<Grid item xs={12} sm={6} lg={3} key={index}>
<div
onClick={isLast ? handleNavigate : undefined}
style={{ cursor: isLast ? 'pointer' : 'default', width: '100%' }}>
<PillarCard
title={title}
subtitle={subtitle}
description={description}
imageSrc={image}
styles={styles}
/>
</div>
</Grid>
);
})}
<Grid container>
{pillarCardsContent.map(({ title, subtitle, description, image, path }, index) => {
const isLast = index === pillarCardsContent.length - 1;
return (
<Grid item xs={12} sm={6} lg={3} key={index}>
<div
onClick={isLast ? handleNavigate : undefined}
style={{ cursor: isLast ? 'pointer' : 'default', width: '100%' }}>
<PillarCard
title={title}
subtitle={subtitle}
description={description}
imageSrc={image}
styles={styles}
/>
</div>
</Grid>
);
})}
</Grid>
</div>
</section>
);
Expand Down
9 changes: 7 additions & 2 deletions components/Sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { useRouter } from 'next/router';
const options = [
{ title: 'Get Started' },
{ title: 'Sponsors', link: '/sponsor' },
{ title: 'About us', link: '/?about=true' },
{ title: 'About us', link: '/?about-us=true' },
{ title: 'Careers', link: '/career' },
];

Expand All @@ -28,6 +28,11 @@ const Sidebar: React.FC<any> = ({ setOpen, open }) => {
router.pathname === '/' && handleMoveToId();
};

const handleAboutUsClick = () => {
router.pathname !== '/' && router.push('/?about-us=true');
router.pathname === '/' && handleMoveToId('about-us');
};

const list = () => (
<Box sx={{ width: 250 }} role="presentation">
<div
Expand All @@ -54,7 +59,7 @@ const Sidebar: React.FC<any> = ({ setOpen, open }) => {
<ListItemText>
{option.link ? (
<Link href={option.link}>
<a>{option.title}</a>
<a onClick={option.title === 'About us' ? handleAboutUsClick : undefined}>{option.title}</a>
</Link>
) : (
<a onClick={handleButtonClick}>{option.title}</a>
Expand Down
2 changes: 1 addition & 1 deletion components/Sponsor/Banner/Banner.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
font-weight: 600;
font-size: 20px;
line-height: 26px;
color: #6e7176;
color: black;
}
}

Expand Down
16 changes: 12 additions & 4 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,18 @@ const Home: NextPage = () => {
const router = useRouter();

useEffect(() => {
if (router.query.cta) {
handleMoveToId('cta');
} else if (router.query.about) handleMoveToId('about');
}, [router]);
const timeout = setTimeout(() => {
if (router.query.cta) {
handleMoveToId('cta');
} else if (router.query['about-us']) {
handleMoveToId('about-us');
}
}, 200);

return () => {
clearTimeout(timeout);
};
}, [router.query]);

return (
<MainLayout
Expand Down
5 changes: 3 additions & 2 deletions utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { scroller } from 'react-scroll';

export const handleMoveToId = (id: string = 'cta') => {
export const handleMoveToId = (id: string = 'cta', offset: number = -85) => {
// const element = document.querySelector(`#${id}`);
scroller.scrollTo(id, {
smooth: true,
offset: -85,
offset,
duration: 200,
delay: 0,
});
Expand Down
Loading

2 comments on commit 69cb1f9

@vercel
Copy link

@vercel vercel bot commented on 69cb1f9 Dec 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

pillar – ./

pillar-topaz.vercel.app
pillar-git-master-ahmnouira.vercel.app
pillar-ahmnouira.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 69cb1f9 Dec 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.