+ btn s'abonner dans la navbar

This commit is contained in:
AntoninoP 2024-09-23 13:25:52 +02:00
parent da3a161f30
commit f13473c2f8
4 changed files with 28 additions and 4 deletions

View File

@ -4,16 +4,19 @@ import styles from './Navbar.module.scss';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faUser, faCog, faSignOutAlt, faArrowLeft } from '@fortawesome/free-solid-svg-icons'; import { faUser, faCog, faSignOutAlt, faArrowLeft } from '@fortawesome/free-solid-svg-icons';
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { useNavigate } from 'react-router-dom';
const Navbar = ({ const Navbar = ({
user, user,
hasShadow = true, hasShadow = true,
showBackButton = false, showBackButton = false,
onBackClick, onBackClick,
backButtonText = "Retour au dashboard" backButtonText = "Retour au dashboard",
Subsribebtn = true
}) => { }) => {
const [dropdownOpen, setDropdownOpen] = useState(false); const [dropdownOpen, setDropdownOpen] = useState(false);
const dropdownRef = useRef(null); const dropdownRef = useRef(null);
const navigate = useNavigate();
const handleLogout = () => { const handleLogout = () => {
auth.signOut(); auth.signOut();
@ -45,7 +48,15 @@ const Navbar = ({
{showBackButton && ( {showBackButton && (
<div className={styles.backButton} onClick={onBackClick}> <div className={styles.backButton} onClick={onBackClick}>
<FontAwesomeIcon icon={faArrowLeft} className={styles.backIcon} /> <FontAwesomeIcon icon={faArrowLeft} className={styles.backIcon} />
<span>{backButtonText}</span> {} <span>{backButtonText}</span>
</div>
)}
{Subsribebtn && ( // Updated: Conditional rendering for the subscribe button
<div className={styles.subscribeSection}>
<div className={styles.subscribeBtn} onClick={() => navigate('/Pricing')}>
S&apos;abonner
</div>
</div> </div>
)} )}
@ -90,6 +101,7 @@ Navbar.propTypes = {
showBackButton: PropTypes.bool, showBackButton: PropTypes.bool,
onBackClick: PropTypes.func, onBackClick: PropTypes.func,
backButtonText: PropTypes.string, backButtonText: PropTypes.string,
Subsribebtn: PropTypes.bool // Updated: Prop type corrected
}; };
export default Navbar; export default Navbar;

View File

@ -89,6 +89,18 @@
font-size: 1.5rem; font-size: 1.5rem;
} }
.subscribeBtn{
padding: .5rem 1rem;
border-radius: .4rem;
background-color: #2f2f2f;
color: white;
cursor: pointer;
border: none;
margin-right: 2rem;
}
@media (max-width: 650px) { @media (max-width: 650px) {
.backButton{ .backButton{
font-size: 1.25rem; font-size: 1.25rem;

View File

@ -35,7 +35,7 @@ const Modpack = ({ user }) => {
const handleCancel = () => { const handleCancel = () => {
console.log("Annuler cliqué, index sélectionné avant :", selectedModpackIndex); console.log("Annuler cliqué, index sélectionné avant :", selectedModpackIndex);
setSelectedModpackIndex(null); // Remise à zéro de l'index sélectionné setSelectedModpackIndex(null);
}; };
const handleCreate = async () => { const handleCreate = async () => {

View File

@ -21,7 +21,7 @@
padding: 2rem; padding: 2rem;
width: 30rem; width: 30rem;
text-align: center; text-align: center;
transition: all 0.3s ease; /* Ajout de la transition pour l'état sélectionné/non-sélectionné */ transition: all 0.3s ease;
cursor: pointer; cursor: pointer;
position: relative; position: relative;