Skip to content

Commit

Permalink
add modal for downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
programmer committed Oct 11, 2024
1 parent b6f9251 commit f71c8ba
Show file tree
Hide file tree
Showing 3 changed files with 155 additions and 7 deletions.
87 changes: 87 additions & 0 deletions assets/css/modal_style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
.modal {
display: flex;
flex-direction: column;
justify-content: center;
gap: 0.4rem;
width: 90%;
/* استخدام عرض نسبي */
max-width: 450px;
/* أقصى عرض */
padding: 1.3rem;
min-height: 250px;
position: absolute;
z-index: 2;
top: 10%;
left: 50%;
/* محاذاة إلى المركز */
transform: translateX(-50%);
/* تحريك إلى اليسار بنسبة 50% */
background-color: white;
border: 1px solid #ddd;
border-radius: 15px;
}

.modal .flex {
display: flex;
align-items: center;
justify-content: space-between;
}

.btns-download-cv {
display: flex;
justify-content: center;
padding-top: 30px;
}

.btn-close {
padding: 0.5rem 0.7rem;
background: #ee6b6b;
border-radius: 20%;
transform: translate(10px, -20px);
}

.overlay {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
backdrop-filter: blur(3px);
z-index: 1;
}

.hidden {
display: none;
}

/* Media Queries لتعديل التصميم على أحجام الشاشة المختلفة */
@media (max-width: 600px) {
.modal {
width: 95%;
/* عرض أكبر على الشاشات الصغيرة */
padding: 1rem;
/* تقليل الحشوة */
min-height: 200px;
/* تقليل الحد الأدنى للطول */
}

.btn-close {
padding: 0.3rem 0.5rem;
/* تقليل حجم الأزرار */
}
}

@media (max-width: 400px) {
.modal {
padding: 0.8rem;
/* حشوة أقل على الشاشات الصغيرة جدًا */
}

.btn-close {
padding: 0.2rem 0.4rem;
/* تقليل حجم الأزرار أكثر */
}
}
29 changes: 29 additions & 0 deletions assets/js/modal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const modal = document.querySelector(".modal");
const overlay = document.querySelector(".overlay");
const openModalBtn = document.querySelector(".btn-open");
const closeModalBtn = document.querySelector(".btn-close");

// close modal function
const closeModal = function () {
modal.classList.add("hidden");
overlay.classList.add("hidden");
};

// close the modal when the close button and overlay is clicked
closeModalBtn.addEventListener("click", closeModal);
overlay.addEventListener("click", closeModal);

// close modal when the Esc key is pressed
document.addEventListener("keydown", function (e) {
if (e.key === "Escape" && !modal.classList.contains("hidden")) {
closeModal();
}
});

// open modal function
const openModal = function () {
modal.classList.remove("hidden");
overlay.classList.remove("hidden");
};
// open modal event
openModalBtn.addEventListener("click", openModal);
46 changes: 39 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@


<link type="text/css" rel="stylesheet" href="assets/css/style.css">
<link type="text/css" rel="stylesheet" href="assets/css/modal_style.css">

<title>Firas Muhammed Dahaa - فراس محمد ضاحه - مطور ويب</title>
<meta name="description"
Expand Down Expand Up @@ -100,6 +101,7 @@
</div>
<div class="h-full w-full overflow-hidden ">



<section id="main" class="px-x md:px-md pt-10 md:scroll-mt-20 xl:justify-center">
<div
Expand All @@ -115,7 +117,7 @@
<div
class=" justify-center items-start flex flex-col text-white/70 gap-5 md:w-[60%] w-full "
style="opacity: 1; transform: none;"><h1
style="title dark:text-dark; ">Hello There !</h1><div
style="title dark:text-dark;">Hello There !</h1><div
class=" md:text-[32px] text-[20px] ">I’m Firas Muhammed Dahaa<p
class="text-gradient md:text-[40px] dark:text-dark text-[28px] md:whitespace-nowrap font-bold "
style="opacity: 1; "><span
Expand Down Expand Up @@ -181,11 +183,11 @@
class="flex flex-row md:gap-5 gap-2 items-center">

<div
class="btn rounded-xl text-center ">
<a target="_blank"
class="btn btn-modal btn-open rounded-xl text-center ">
<button target="_blank"
class=" text-gradient text-sm md:text-lg download-btn"
href="https://drive.google.com/file/d/1hyeHNNqTHNDnLiyrwU3TXmi5kAMLd3WE/view?usp=sharing" >Download
CV</a>
href="#" >Download
CV</button>
<svg class="ico" aria-hidden="true" fill="​#4d90fe" width="30px" height="20px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path stroke="#4d90fe" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"
d="M12 19V5m0 14-4-4m4 4 4-4"></path>
Expand Down Expand Up @@ -248,13 +250,43 @@
</div>
</section>

<section class="modal dark:bg-black hidden backdrop-blur-[.2rem] font-family: 'Google Sans', Arial, sans-serif;">
<div class="flex">
<img style="border-radius: 50px" src="https://avatars.githubusercontent.com/u/126325197?s=400&u=32d12fee5bfae0b19ec0ac6d9b027a0dff28c0f7&v=4" width="50px" height="50px" alt="user" />

<p class="text-gradient text-sm md:text-[40px] dark:text-dark text-[18px] md:whitespace-nowrap font-bold">محتوى السرة الذاتية</p>

<button class="btn-close"></button>
</div>
<p class="text-gradient text-center md:text-[40px] dark:text-dark text-[18px] md:whitespace-nowrap font-bold">Contenet Language</p>
<div class="flex padding: 20px 0 0 0">

</div>
<div class="btns-download-cv">
<a
target="_blank"
href="https://drive.google.com/file/d/1hyeHNNqTHNDnLiyrwU3TXmi5kAMLd3WE/view?usp=sharing"
class="border border-2 hover:bg-transparent btn bg-transparent text-center">
<div
class=" text-white text-sm md:text-lg "
>عربي
</div>
</a>

<a href="https://drive.google.com/file/d/1hyeHNNqTHNDnLiyrwU3TXmi5kAMLd3WE/view?usp=sharing" target="_blank" class="border border-2 hover:bg-transparent btn bg-transparent text-center ">
<div class=" text-white text-sm md:text-lg " >English</div>
</a>

</div>
</section>

<div class="overlay hidden"></div>

<div
class="relative">


<script src="assets/js/modal.js"></script>
</body>

</html>

0 comments on commit f71c8ba

Please sign in to comment.