Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the "Become a Mentor" button responsive. #72

Merged
merged 22 commits into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
638fccb
Corrected npm start command in README.md for local development
mayura-andrew Jan 2, 2024
04537ab
Merge branch 'sef-global:main' into main
mayura-andrew Jan 4, 2024
638ec27
Fixed README
mayura-andrew Jan 4, 2024
0a2cddf
Merge branch 'sef-global:main' into main
mayura-andrew Jan 9, 2024
335507c
Fixed Facebook icon in nav bar and Apply button issue
mayura-andrew Jan 9, 2024
f6fea0b
Fixed Apply button and See more button used TailwindCSS
mayura-andrew Jan 10, 2024
92a661b
Backend API URL Problem
mayura-andrew Jan 10, 2024
32595c8
Fixed Apply button and See more buttons (Removed template iterals)
mayura-andrew Jan 11, 2024
c26820e
Connect with Backend API
mayura-andrew Jan 11, 2024
1e5b97f
added \
mayura-andrew Jan 11, 2024
a9666e9
Added environment variable to connect backend api
mayura-andrew Jan 11, 2024
dfc7028
Fixed typos in README
mayura-andrew Jan 11, 2024
4f86fd0
added .end to .gitignore
mayura-andrew Jan 11, 2024
0bf8c9f
Merge branch 'main' into main
mayura-andrew Jan 11, 2024
5fc0a50
fixed typos in example.env file
mayura-andrew Jan 11, 2024
c07988c
changed API_URL setup
mayura-andrew Jan 11, 2024
0516513
Fixed example.env
mayura-andrew Jan 11, 2024
2459152
Stop tracking .env file
mayura-andrew Jan 12, 2024
46118e6
fixed "Become a menter" button using Tailwind
mayura-andrew Jan 13, 2024
4df0cda
Merge branch 'sef-global:main' into main
mayura-andrew Jan 13, 2024
16c2662
Fixed that "Become a Mentor" button issue in MenuDrawer
mayura-andrew Jan 13, 2024
66bfb48
Fixed LoginModal mobile responsiveness
mayura-andrew Jan 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const Home: React.FC = () => (
<Button className="flex justify-center items-center mr-5 mb-5 bg-blue-500 hover:bg-blue-700 text-white py-1 px-16 rounded w-40 h-9 font-sans font-bold">
Apply
</Button>
<Button className="flex justify-center items-center mr-5 mb-5 text-black py-1 px-16 rounded w-40 h-9 font-sans font-bold">
<Button className="flex justify-center items-center mr-5 mb-5 text-black py-1 px-16 rounded w-40 h-9 font-sans">
See more
</Button>
</div>
Expand Down
32 changes: 31 additions & 1 deletion src/components/Layout/MenuDrawer/MenuDrawer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useContext, useState } from 'react';

import {
TwitterOutlined,
Expand All @@ -8,6 +8,12 @@
} from '@ant-design/icons';
import { Avatar, Button, Drawer, Space, Typography } from 'antd';

import {
UserContext,
type UserContextType,
} from './../../../contexts/UserContext';
import { useNavigate } from 'react-router-dom';

import styles from './MenuDrawer.module.css';

const { Text } = Typography;
Expand All @@ -18,6 +24,11 @@
}

const MenuDrawer: React.FC<MenuDrawerProps> = ({ openMenu, setOpenMenu }) => {
const [isLoginModalVisible, setIsLoginModalVisible] = useState(false);

Check failure on line 27 in src/components/Layout/MenuDrawer/MenuDrawer.tsx

View workflow job for this annotation

GitHub Actions / build

'isLoginModalVisible' is declared but its value is never read.
Copy link
Member

Choose a reason for hiding this comment

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

We don't need it use openMenu, setOpenMenu

Copy link
Member Author

Choose a reason for hiding this comment

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

Screencast_20240114_003851.webm

Fixed that issue :)

const navigate = useNavigate();

const { user } = useContext(UserContext) as UserContextType;

const handleOpenMenu = (): boolean => {
return openMenu;
};
Expand All @@ -26,6 +37,19 @@
setOpenMenu(false);
};

const handleLoginModalOpen = (): void => {
setIsLoginModalVisible(true);
};

const handleMentorRegistration = (): void => {
console.log('Clicked');
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
console.log('Clicked');

if (user === null) {
handleLoginModalOpen();
} else {
navigate('/mentor-registration');
}
};

return (
<Drawer
open={handleOpenMenu()}
Expand All @@ -50,6 +74,12 @@
<a href="" target="_blank" rel="noreferrer">
<Text className={styles.antTypography}>Join Us</Text>
</a>
<Button
className="mr-5 mb-5 w-40 h-9 font-sans text-black-400 py-1 px-4 rounded"
onClick={handleMentorRegistration}
>
Become a Mentor
</Button>
<Space direction="horizontal" size={20}>
<a
href="https://www.facebook.com/sustainableeducationfoundation/"
Expand Down
12 changes: 6 additions & 6 deletions src/components/Layout/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ const Navbar: React.FC = () => {
<a href="" target="_blank" rel="noreferrer">
<Text className={styles.antTypography}>Join Us</Text>
</a>
<Button
className="mr-5 mb-5 w-40 h-9 font-sans text-black-400 py-1 px-4 rounded"
onClick={handleMentorRegistration}
>
Become a Mentor
</Button>
</div>
<Button
className={styles.loginButton}
onClick={handleMentorRegistration}
>
Become a Mentor
</Button>
</Space>
</Col>
<Col md={4} lg={4} xl={3} className={styles.socialMediaContainer}>
Expand Down
Loading