diff --git a/README.md b/README.md index 4e405b6..b3f3efd 100644 --- a/README.md +++ b/README.md @@ -1 +1,64 @@ -# FyloCodeReview \ No newline at end of file +# FyloCodeReview + +amosZohar - V +
+benda - V +
+davidArnfled - V +
+evyatarBabay - V +
+hinoy - V +
+idanBenGavriel - V +
+inonEl - V +
+liorHassin - V +
+natiPorish - V +
+orenLevi - V +
+rotemNissim - V +
+shirYahav - V +
+talLevi - V +
+yoavFridman - V +
+eyarGdolov - V +
+reyNaftali - V +
+omerAmsalem - V +
+barRachmany - V +
+ofekWorecl - V +
+noaVinkler - V +
+oriJoseph - V +
+danielIzhaki - V +
+nofarMahani - V +
+noaGedo - V +
+omerElias - v +
+roniTwito - V +
+galLevi - V +
+oriAbulafia - V +
+avitalRubichi - V +
+yossiZrihen - V +
+morAlmakayes - V +
diff --git a/amosZohar/images/bg-desktop.png b/amosZohar/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/amosZohar/images/bg-desktop.png differ diff --git a/amosZohar/images/bg-mobile.png b/amosZohar/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/amosZohar/images/bg-mobile.png differ diff --git a/amosZohar/images/favicon-32x32.png b/amosZohar/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/amosZohar/images/favicon-32x32.png differ diff --git a/amosZohar/images/icon-document.svg b/amosZohar/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/amosZohar/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/amosZohar/images/icon-folder.svg b/amosZohar/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/amosZohar/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/amosZohar/images/icon-upload.svg b/amosZohar/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/amosZohar/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/amosZohar/images/logo.svg b/amosZohar/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/amosZohar/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/amosZohar/index.html b/amosZohar/index.html new file mode 100644 index 0000000..767882e --- /dev/null +++ b/amosZohar/index.html @@ -0,0 +1,60 @@ + + + + + + + + + + + + + Fylo data storage component + + + + +
+ +
+ +
+
+ +
+
+ +
+
+ +
> + +
+
+ +
+

You've used 815 GB of your storage

+ + +
+
+
+
+
+
+
+

+ 0 GB + 1000 GB +

+ +
+

185 GB left

+
+ +
+
+ + + \ No newline at end of file diff --git a/amosZohar/index.js b/amosZohar/index.js new file mode 100644 index 0000000..cafa1ab --- /dev/null +++ b/amosZohar/index.js @@ -0,0 +1,178 @@ +/*NOTE: the size of the files extracted from the element + is measured in Bytes. Thus, all convertions from Bytes, to KiloBytes, MegaBytes + and so on must take that into account. */ + +const KB = 1024; +const MB = KB*KB; +const GB = KB*MB; + +const AVAIL_SPACE = "available_space"; +const size_suffix = "&&fileSize"; + +const total_space = 10*MB;/*measured in Byte units.*/ + +/** + * + * @param {Event} e + * @returns {void} - this body onload event handler updates + * the html elements representing the remaining space. + */ +function Initialize(e){ + document.getElementById("max-capacity").innerText = size_to_string(total_space); + if(localStorage.getItem(AVAIL_SPACE)== null){/*Means no files were previously uploaded */ + localStorage.setItem(AVAIL_SPACE,total_space); + } + updateHTML(); + /* checks the localstorage for all previously uploaded images */ + for(let i = 0; i element. + */ +const openUploadMenu = e => document.getElementById("upload-input").click(); + +const supported_extensions = ["jpg","jpeg","png","gif","JPG","JPEG","PNG","GIF"]; + +/** + * + * @param {*} e + * @returns {void} This is the event handler for when the user has finished selecting files to upload. + * It checks if the selected files are in a vlid image format, and if there is enough space for them. + * If all is ok, will upload and update the available space. + */ +function onInput(e){ + const {files} = e.target;/* extracting the FileList object from the Event object e */ + let all_files_valid = true; + let required_space = 0; + /* traversing the FileList object associated with the input element. */ + for(let i = 0; i< files.length;i++){ + const file_ext = files[i].name.split(".")[1];/* Extracting the file extension */ + if((supported_extensions.includes(file_ext))==false){ + alert(`${file_ext} File format isn't supported`); + all_files_valid = false; + break; + } + else{ + required_space+=files[i].size; + } + } + + if(all_files_valid){ + let available_space = getAvailableSpace(); + if(available_space < required_space){ + alert("There is not enough space on the disk"); + return; + } + available_space -= required_space; + setAvailableSpace(available_space); + for(let i = 0; i< files.length;i++){ + /*If a file with the same name was already uploaded, I will overwrite it, + since it might be a different file with a different size but with the same name. + Thus, I must free the space taken by it, since the space taken by the new file + will be add to the required_space variable.*/ + let file_size = localStorage.getItem(sizeKey(files[i].name)); + if(file_size){ + removeFile(files[i].name); + updateHTML(); + } + localStorage.setItem(files[i].name,files[i]); + localStorage.setItem(sizeKey(files[i].name),files[i].size); + append_file_name(files[i].name); + } + updateHTML(); + } + +}; + +const sizeKey = fileName => `${fileName}${size_suffix}`; + +/** + * + * @param {string} fileName + * removes the file and its size from the localData, + * updates the available space, and removes the filename HTML element. + */ +function removeFile(fileName){ + localStorage.removeItem(fileName); + let size = localStorage.getItem(sizeKey(fileName)) + let available_space = getAvailableSpace(); + available_space += parseInt(size); + setAvailableSpace(available_space); + localStorage.removeItem(sizeKey(fileName)); + htmlNode = document.getElementById(fileName); + htmlNode.parentNode.removeChild(htmlNode); +} + +/** + * + * @param {string} fileName + * adds the fileName to the localStorage and adds an HTML element for it. + */ +function append_file_name(fileName){ + const newNameElement = document.createElement('span'); + newNameElement.className = "uploaded-item icon-img"; + newNameElement.innerHTML = `${fileName} `; + newNameElement.id = fileName; + document.getElementById("file-names-container").append(newNameElement); + document.getElementById(`${fileName}-span`).addEventListener("click",()=>{ + removeFile(fileName); + updateHTML(); + }); +} + +/** + * + * @param {int} size_bytes + * @returns {string} - a string representing the most fitting unit convertion of size_bytes + */ +function size_to_string(size_bytes){ + if(size_bytes/GB>1){ + return `${(size_bytes/GB).toFixed(1)} GB`; + } + if(size_bytes/MB>1){ + return `${(size_bytes/MB).toFixed(1)} MB`; + } + if(size_bytes/KB>1){ + return `${(size_bytes/KB).toFixed(1)} KB`; + } + return `${size_bytes} Bytes`; +} + +function getAvailableSpace(){ + return parseInt(localStorage.getItem(AVAIL_SPACE)); +} + + +function setAvailableSpace(num){ + return localStorage.setItem(AVAIL_SPACE,num); +} + +function setBarWidth(){ + let percentage = 100*(total_space-getAvailableSpace())/total_space; + document.getElementsByClassName("gradient-bar")[0].setAttribute("style",`width:${percentage}%`); +} + +function updateUsed(){ + document.getElementById("used-space").innerText = size_to_string(total_space - getAvailableSpace()); +} + +function updateRemaining(){ + const num_and_unit = size_to_string(getAvailableSpace()).split(" "); + document.getElementById("remaining-space").innerHTML = + `${num_and_unit[0]} ${num_and_unit[1]} left`; +} + +function updateHTML(){ + setBarWidth(); + updateRemaining(); + updateUsed(); +} \ No newline at end of file diff --git a/amosZohar/styles.css b/amosZohar/styles.css new file mode 100644 index 0000000..84b1675 --- /dev/null +++ b/amosZohar/styles.css @@ -0,0 +1,272 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} +body { + -ms-overflow-style: none; /* for Internet Explorer, Edge */ + scrollbar-width: none; /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container, +.uploaded-files_container{ + background-color: var(--container-background-color); +} +.uploaded-files_container{ + display: flex; + flex-direction: row; + flex-wrap: wrap; + /* justify-content: flex-start; */ + padding: 1vmin; + border-radius: 15px; + gap: 1vmin; + margin: 0 -2.5rem; +} + +.uploaded-item{ + color: white; +} +.uploaded-item:hover{ + transform: scale(1.1); +} +.remove-file-span:hover{ + box-shadow: .1vmin .1vmin .2vmin .2vmin rgba(255, 77, 151, 1),-.1vmin -.1vmin .2vmin .2vmin rgba(255, 163, 153, 1); +} + +.interactive:hover{ + box-shadow: .1vmin .1vmin .2vmin .2vmin rgba(255, 77, 151, 1),-.1vmin -.1vmin .2vmin .2vmin rgba(255, 163, 153, 1); + transform: scale(1.2); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + height: 7rem; + position: relative; + grid-area: b; + display: flex; + flex-direction: column; + justify-content: flex-start; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + filter: saturate(); + width: 0%; + height: 0.8rem; + position: relative; + transition:1s ease; +} +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 2.4rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + .gb-left:after { + display: none; + } +} + +.Invisible{ + display: none; +} diff --git a/avitalRubichi/images/bg-desktop.png b/avitalRubichi/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/avitalRubichi/images/bg-desktop.png differ diff --git a/avitalRubichi/images/bg-mobile.png b/avitalRubichi/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/avitalRubichi/images/bg-mobile.png differ diff --git a/avitalRubichi/images/favicon-32x32.png b/avitalRubichi/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/avitalRubichi/images/favicon-32x32.png differ diff --git a/avitalRubichi/images/icon-document.svg b/avitalRubichi/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/avitalRubichi/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/avitalRubichi/images/icon-folder.svg b/avitalRubichi/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/avitalRubichi/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/avitalRubichi/images/icon-upload.svg b/avitalRubichi/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/avitalRubichi/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/avitalRubichi/images/logo.svg b/avitalRubichi/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/avitalRubichi/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/avitalRubichi/images/project-preview.png b/avitalRubichi/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/avitalRubichi/images/project-preview.png differ diff --git a/avitalRubichi/index.html b/avitalRubichi/index.html new file mode 100644 index 0000000..6748c00 --- /dev/null +++ b/avitalRubichi/index.html @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + Fylo data storage component + + + +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+
+ +
+

You've used of your storage

+ +
+
+
+
+
+
+
+

+ 0 MB + +

+ +
+

+
+
+
+ + + \ No newline at end of file diff --git a/avitalRubichi/script.js b/avitalRubichi/script.js new file mode 100644 index 0000000..10e9e6d --- /dev/null +++ b/avitalRubichi/script.js @@ -0,0 +1,53 @@ +const filePattern = /jpg|jpeg|gif|png/; +const mbSizeInBytes = 1024 * 1024; +const totalDiskSpace = mbsToBytes(100); +const defaultUsage = mbsToBytes(85); +let currentUsage = parseInt(localStorage['currentUsage']) || defaultUsage; +const mbText = ' MB'; +const pickerOpts = { + multiple: true, +}; + +async function getFile() { + const fileHandles = await window.showOpenFilePicker(pickerOpts); + + for (const fileHandle of fileHandles) { + const file = await fileHandle.getFile(); + + if (!filePattern.test(file.type)) { + alert("File format isn't supported"); + return; + } + + if (currentUsage + file.size <= totalDiskSpace) { + currentUsage += file.size; + localStorage['currentUsage'] = currentUsage; + updateUsageDomElements(); + } else { + alert('There is not enough space on the disk'); + } + } +} + +document.addEventListener('DOMContentLoaded', function () { + document.getElementById('mb-limit').innerHTML = bytesToMbs(totalDiskSpace) + mbText; + updateUsageDomElements(); +}); + +function updateUsageDomElements() { + document.getElementById('mb-usage').innerHTML = bytesToMbs(currentUsage) + mbText; + document.getElementById('mb-left').innerHTML = bytesToMbs(totalDiskSpace - currentUsage) + ' MB left '; + document.getElementsByClassName('gradient-bar')[0].style.width = getUsagePercentage(); +} + +function getUsagePercentage() { + return (Math.round((currentUsage / totalDiskSpace) * 100)) + '%'; +} + +function bytesToMbs(size) { + return Math.round(size / mbSizeInBytes); +} + +function mbsToBytes(size) { + return size * mbSizeInBytes; +} \ No newline at end of file diff --git a/avitalRubichi/styles.css b/avitalRubichi/styles.css new file mode 100644 index 0000000..6ed2702 --- /dev/null +++ b/avitalRubichi/styles.css @@ -0,0 +1,238 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} +body { + -ms-overflow-style: none; /* for Internet Explorer, Edge */ + scrollbar-width: none; /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + height: 7rem; + position: relative; + grid-area: b; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + filter: saturate(); + height: 0.8rem; + position: relative; + transition: width 2s +} +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 2.4rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + .gb-left:after { + display: none; + } +} \ No newline at end of file diff --git a/barRachmay/images/bg-desktop.png b/barRachmay/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/barRachmay/images/bg-desktop.png differ diff --git a/barRachmay/images/bg-mobile.png b/barRachmay/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/barRachmay/images/bg-mobile.png differ diff --git a/barRachmay/images/favicon-32x32.png b/barRachmay/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/barRachmay/images/favicon-32x32.png differ diff --git a/barRachmay/images/icon-document.svg b/barRachmay/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/barRachmay/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/barRachmay/images/icon-folder.svg b/barRachmay/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/barRachmay/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/barRachmay/images/icon-upload.svg b/barRachmay/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/barRachmay/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/barRachmay/images/logo.svg b/barRachmay/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/barRachmay/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/barRachmay/images/project-preview.png b/barRachmay/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/barRachmay/images/project-preview.png differ diff --git a/barRachmay/index.html b/barRachmay/index.html new file mode 100644 index 0000000..b4ad319 --- /dev/null +++ b/barRachmay/index.html @@ -0,0 +1,60 @@ + + + + + + + + + + + + + Fylo data storage component + + + +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+
+ +
+

You've used 0 MB of your storage

+ +
+
+
+
+
+
+
+

+ 0 MB + 100 MB +

+ +
+

100> MB left

+
+
+
+ + + + \ No newline at end of file diff --git a/barRachmay/script.js b/barRachmay/script.js new file mode 100644 index 0000000..afefe60 --- /dev/null +++ b/barRachmay/script.js @@ -0,0 +1,81 @@ +document.addEventListener('DOMContentLoaded', function () { + initializeStorage(); +}); +document.getElementById('upload').addEventListener('click', uploadFile); + +function initializeStorage() { + // Check if the storage is already initialized + if (!localStorage.getItem('totalStorage')) { + // If not, set the initial storage to 100 MB + localStorage.setItem('totalStorage', 100); + } + // Initialize used storage to 0 + localStorage.setItem('usedStorage', 0); + + updateStorageUI(); +} + +function updateStorageOnUpload (fileSize) { + var totalStorage = parseInt(localStorage.getItem('totalStorage')); //this makes char to int + var usedStorage = parseInt(localStorage.getItem('usedStorage')); + + totalStorage -= fileSize; + usedStorage += Math.ceil(fileSize); + + localStorage.setItem('totalStorage' , totalStorage); + localStorage.setItem('usedStorage' , usedStorage); + + updateStorageUI(); +} + +function updateStorageUI() { + var totalStorage = parseInt(localStorage.getItem('totalStorage')); //this makes char to int + var usedStorage = parseInt(localStorage.getItem('usedStorage')); + + document.getElementById('remainingStorage').textContent = totalStorage; + document.getElementById('usedStorage').textContent = usedStorage; + + var remainingStorage = totalStorage - usedStorage; + var percentageUsed = (usedStorage) ; + var progressBar = document.getElementById('progressBar'); + progressBar.style.width = percentageUsed + '%'; + +} + +function checkFileFormat () { // this function checks the file format + var fileInput = document.getElementById('fileInput'); + var selectedFiles = fileInput.files; + + for (var i=0; itotalStorage) +{ + alert('There is not enough space on the disk') + return; +} +updateStorageOnUpload(fileSize); +} +function uploadFile() { + + checkFileFormat(); + + +} + + + \ No newline at end of file diff --git a/barRachmay/styles.css b/barRachmay/styles.css new file mode 100644 index 0000000..97fd52a --- /dev/null +++ b/barRachmay/styles.css @@ -0,0 +1,239 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} +body { + -ms-overflow-style: none; /* for Internet Explorer, Edge */ + scrollbar-width: none; /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + height: 7rem; + position: relative; + grid-area: b; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + filter: saturate(); + width: 74%; + height: 0.8rem; + position: relative; + transition: width 0.5s ease-in-out; +} +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 2.4rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + .gb-left:after { + display: none; + } +} diff --git a/benda/Fylo.js b/benda/Fylo.js new file mode 100644 index 0000000..82d95da --- /dev/null +++ b/benda/Fylo.js @@ -0,0 +1,76 @@ + +let sizeElement; +let remainingElement; +let gradientElement; +let storedSize +let remainingSize +let storedFiles=[]; + +document.addEventListener('DOMContentLoaded',()=>{ + sizeElement=document.getElementById('display-size'); + remainingElement=document.getElementById('remaining-size'); + gradientElement=document.querySelector('.gradient-bar'); +}) + +window.onload=()=>{ + storedSize=parseFloat(localStorage.getItem('storedSize'))||0; + remainingSize=parseFloat(localStorage.getItem('remainingSize'))||150; + updateUi(); +} + +async function UploadFiles(){ + const files=await showOpenFilePicker({multiple:true}); + let sizeInMB=0; + let FormatedFiles=await FormatFiles(files); + FormatedFiles.forEach(file => { + sizeInMB+=file.size/1024/1024;}); + const FileNames=FormatedFiles.map(file=>file.name); + let error=''; + error=validateFiles(FileNames,sizeInMB); + if(error!==''){ + alert(error); + return; + } + storedSize+=sizeInMB; +// for(const file of FormatedFiles){ +// storedFiles.push({name:file.name,size:file.size/1024/1024}); +// } + + updateUi(); + localStorage.setItem('storedSize',storedSize); + localStorage.setItem('remainingSize',remainingSize-storedSize) +} + + + + + +function updateUi(){ + sizeElement.innerText=storedSize.toFixed(2); + remainingElement.innerText=(remainingSize-storedSize).toFixed(2); + gradientElement.style.width=`${(storedSize/150)*100}%`; +} + +async function FormatFiles(files){ // Formating the files to a File object + let FormatedFiles=[]; + for(const file of files){ + FormatedFiles.push( await file.getFile()); + } + return FormatedFiles; +} + + + function validateFiles(fileNames,sizeOfFiles){ // checking if the files are supported and if there is enough space to upload them + let error=''; + if(sizeOfFiles+storedSize>150){ + error='There is not enough space to upload this files'; + return error; + } + for(const name of fileNames){ + if(!(name.toLowerCase().endsWith('.jpg')||name.toLowerCase().endsWith('.jpeg')||name.toLowerCase().endsWith('.png')||name.toLowerCase().endsWith('.gif'))){ + error="one or more of the files isn't supported"; + return error; + } + } + return error; +} diff --git a/benda/images/bg-desktop.png b/benda/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/benda/images/bg-desktop.png differ diff --git a/benda/images/bg-mobile.png b/benda/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/benda/images/bg-mobile.png differ diff --git a/benda/images/favicon-32x32.png b/benda/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/benda/images/favicon-32x32.png differ diff --git a/benda/images/icon-document.svg b/benda/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/benda/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/benda/images/icon-folder.svg b/benda/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/benda/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/benda/images/icon-upload.svg b/benda/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/benda/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/benda/images/logo.svg b/benda/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/benda/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/benda/images/project-preview.png b/benda/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/benda/images/project-preview.png differ diff --git a/benda/index.html b/benda/index.html new file mode 100644 index 0000000..db477d3 --- /dev/null +++ b/benda/index.html @@ -0,0 +1,58 @@ + + + + + + + + + + + + + Fylo data storage component + + + +
+ +
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+ +
+

You've used MB of your storage

+ +
+
+
+
+
+
+
+ +

+ 0 MB + 150 MB +

+ +
+

MB left

+
+
+
+ + + \ No newline at end of file diff --git a/benda/styles.css b/benda/styles.css new file mode 100644 index 0000000..c0268f4 --- /dev/null +++ b/benda/styles.css @@ -0,0 +1,247 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} +body { + -ms-overflow-style: none; /* for Internet Explorer, Edge */ + scrollbar-width: none; /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; +} +#upload-file-button{ + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; + color:white; + width: 120px; + cursor: pointer; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + height: 7rem; + position: relative; + grid-area: b; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + width:0%; + filter: saturate(); + height: 0.8rem; + position: relative; + transition: width 0.5s; +} +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 1.6rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + .gb-left:after { + display: none; + } +} diff --git a/danielIzhaki/images/bg-desktop.png b/danielIzhaki/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/danielIzhaki/images/bg-desktop.png differ diff --git a/danielIzhaki/images/bg-mobile.png b/danielIzhaki/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/danielIzhaki/images/bg-mobile.png differ diff --git a/danielIzhaki/images/favicon-32x32.png b/danielIzhaki/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/danielIzhaki/images/favicon-32x32.png differ diff --git a/danielIzhaki/images/icon-document.svg b/danielIzhaki/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/danielIzhaki/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/danielIzhaki/images/icon-folder.svg b/danielIzhaki/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/danielIzhaki/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/danielIzhaki/images/icon-upload.svg b/danielIzhaki/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/danielIzhaki/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/danielIzhaki/images/logo.svg b/danielIzhaki/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/danielIzhaki/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/danielIzhaki/images/project-preview.png b/danielIzhaki/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/danielIzhaki/images/project-preview.png differ diff --git a/danielIzhaki/index.html b/danielIzhaki/index.html new file mode 100644 index 0000000..8d7b98c --- /dev/null +++ b/danielIzhaki/index.html @@ -0,0 +1,65 @@ + + + + + + + + + + + + + Fylo data storage component + + + +
+ +
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+
+ +
+

You've used 0 MB of your storage

+ +
+
+
+
+
+
+
+

+ 0 MB + 10 MB +

+ +
+

10 MB left

+
+
    + +
    + + +
    + + + + + + \ No newline at end of file diff --git a/danielIzhaki/index.js b/danielIzhaki/index.js new file mode 100644 index 0000000..5c1350c --- /dev/null +++ b/danielIzhaki/index.js @@ -0,0 +1,64 @@ +const fileInput = document.getElementById('fileInput'); +const progress = document.querySelector('.gradient-bar'); + +fileInput.addEventListener('change', selectFile); + +var uploadedFiles = []; + +function openFileExp() { + fileInput.click(); +} + +function selectFile() { + const filePattern1 = /jpg$/; + const filePattern2 = /jpeg$/; + const filePattern3 = /png$/; + const filePattern4 = /gif$/; + + var files = fileInput.files; + for (let i = 0; i < files.length; i++) { + if (!filePattern1.test(files[i].type) && !filePattern2.test(files[i].type) && + !filePattern3.test(files[i].type) && !filePattern4.test(files[i].type)) { + alert("Please select valid image files."); + return; + } + + else if (fileInput.files[0].size > 10 * 1024 * 1024) { + alert("File size is to BIG. 10MB or lower!") + return; + } + + uploadedFiles.push(files[i]); + } + + let totalSize = 0; + for (let i = 0; i < uploadedFiles.length; i++) { + totalSize += uploadedFiles[i].size; + if (totalSize > 10 * (1024 * 1024)) { + alert("no more space"); + return; + } + } + + const MBSize = (totalSize / (1024 * 1024)).toFixed(2); + document.getElementById('spaceUsed').textContent = MBSize + ' MB'; + + const spaceLeft = (10 - MBSize).toFixed(2); + document.getElementById('spaceLeft').textContent = spaceLeft + ' MB left'; + + let gradientBarPercent = (MBSize / 10) * 100; + progress.style.width = `${gradientBarPercent}%` + displayFiles(uploadedFiles); +} + +function displayFiles(files) { + const fileList = document.getElementById('fileList'); + + fileList.innerHTML = ''; + files.forEach(file => { + const listItem = document.createElement('li'); + listItem.textContent = file.name + ' - ' + (file.size / (1024 * 1024)).toFixed(2) + ' MB'; + fileList.appendChild(listItem); + }); +} + diff --git a/danielIzhaki/styles.css b/danielIzhaki/styles.css new file mode 100644 index 0000000..59a9d2f --- /dev/null +++ b/danielIzhaki/styles.css @@ -0,0 +1,281 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} + +body { + -ms-overflow-style: none; + /* for Internet Explorer, Edge */ + scrollbar-width: none; + /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; + /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); + /* display: inline-table */ +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + height: 7rem; + position: relative; + grid-area: b; + +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + + + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + filter: saturate(); + width: 74%; + height: 0.8rem; + position: relative; +} + +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} + +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 2.4rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} + +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + + .gb-left:after { + display: none; + } +} + +#fileList { + color: var(--pale-blue); +} + +.Upload { + border-radius: 50%; + border: transparent; + height: 70px; + width: 70px; + background: linear-gradient(var(--background-color), var(--container-background-color)); + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); +} + +#spaceLeft { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; + content: ""; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} \ No newline at end of file diff --git a/davidArnfled/images/bg-desktop.png b/davidArnfled/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/davidArnfled/images/bg-desktop.png differ diff --git a/davidArnfled/images/bg-mobile.png b/davidArnfled/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/davidArnfled/images/bg-mobile.png differ diff --git a/davidArnfled/images/favicon-32x32.png b/davidArnfled/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/davidArnfled/images/favicon-32x32.png differ diff --git a/davidArnfled/images/icon-document.svg b/davidArnfled/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/davidArnfled/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/davidArnfled/images/icon-folder.svg b/davidArnfled/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/davidArnfled/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/davidArnfled/images/icon-upload.svg b/davidArnfled/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/davidArnfled/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/davidArnfled/images/logo.svg b/davidArnfled/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/davidArnfled/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/davidArnfled/images/project-preview.png b/davidArnfled/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/davidArnfled/images/project-preview.png differ diff --git a/davidArnfled/index.html b/davidArnfled/index.html new file mode 100644 index 0000000..0306fe0 --- /dev/null +++ b/davidArnfled/index.html @@ -0,0 +1,71 @@ + + + + + + + + + + + + Fylo data storage component + + + +
    + +
    + +
    +
    + +
    +
    + +
    +
    + +
    + +
    +
    + +
    + +
    +

    You've used 0 MB of your storage

    + +
    +
    +
    +
    +
    +
    +
    +

    + 0 MB + 10 MB +

    + +
    +

    10 MB left

    +
    +
    +
    + + + diff --git a/davidArnfled/script.js b/davidArnfled/script.js new file mode 100644 index 0000000..47e6e4c --- /dev/null +++ b/davidArnfled/script.js @@ -0,0 +1,138 @@ +const uploadImage = document.getElementById("uploadImage"); +const hiddenUploadBtn = document.getElementById("hiddenUploadBtn"); +const usedStorage = document.getElementById("usedStorage"); +const currentMemory = document.getElementById("currentMemory"); +const availableSpace = document.getElementById("availableSpace"); +const maxMemory = document.getElementById("maxMemory"); +const imageList = document.getElementById("imageList"); +const dangerText = document.getElementById("dangerText"); +const gradient = document.getElementById("gradient"); +const arr = JSON.parse(localStorage.getItem("photos")); + +const updateDisplay = () => { + gradient.style.width = `${ + parseFloat(localStorage.getItem("usedSpace"), 10).toFixed(2) * 10 + }%`; + + usedStorage.innerHTML = `${parseFloat( + localStorage.getItem("usedSpace"), + 10 + )} MB`; + + currentMemory.innerHTML = `${parseFloat( + localStorage.getItem("usedSpace"), + 10 + )} MB`; + + if (localStorage.getItem("availableSpace") === "10") { + availableSpace.innerHTML = `${parseInt( + localStorage.getItem("availableSpace") + )} `; + } else { + availableSpace.innerHTML = `${parseFloat( + localStorage.getItem("availableSpace"), + 10 + ).toFixed(2)} `; + } +}; + +const showButtons = (arr) => { + for (let i = 0; i < arr.length; i++) { + const button = document.createElement("button"); + button.classList.add("my-button"); + let imageSize = arr[i].imageSize; + let imageName = arr[i].imageName; + button.innerText = `${imageSize}`; + button.value = imageName; + imageList.appendChild(button); + } +}; + +// Event Listeners + +uploadImage.addEventListener("click", function () { + hiddenUploadBtn.click(); +}); + +hiddenUploadBtn.addEventListener("change", function () { + dangerText.classList.add("hidden"); + fileName = hiddenUploadBtn.value; + extension = fileName.split(".").pop(); + const selectedFile = hiddenUploadBtn.files[0]; + const image = { + imageName: selectedFile.name, + imageSize: parseFloat((selectedFile.size / 1048576).toFixed(2)), + }; + + if ( + extension !== "jpg" && + extension !== "jpeg" && + extension !== "gif" && + extension !== "png" + ) { + alert("File format isn't supported"); + } else if ( + parseFloat(localStorage.getItem("availableSpace"), 10) <= 0 || + parseFloat(localStorage.getItem("usedSpace"), 10) + image.imageSize >= 10 + ) { + dangerText.classList.remove("hidden"); + } else { + const neuArr = JSON.parse(localStorage.getItem("photos")) || []; + neuArr.push(image); + localStorage.setItem("photos", JSON.stringify(neuArr)); + + const button = document.createElement("button"); + button.classList.add("my-button"); + button.innerText = `${image.imageSize}`; + button.value = image.imageName; + document.getElementById("imageList").appendChild(button); + + let currentSize = + parseFloat(localStorage.getItem("usedSpace"), 10) + image.imageSize; + localStorage.setItem("usedSpace", currentSize.toString()); + + localStorage.setItem( + "availableSpace", + ( + parseFloat(localStorage.getItem("availableSpace"), 10) - image.imageSize + ).toFixed(2) + ); + updateDisplay(); + } +}); + +imageList.addEventListener("click", function (event) { + if (event.target.tagName === "BUTTON") { + const imageSizeToRemove = parseFloat(event.target.innerHTML, 10); + const imageNameToRemove = event.target.value; + + localStorage.setItem( + "availableSpace", + parseFloat(localStorage.getItem("availableSpace"), 10) + imageSizeToRemove + ); + + if ( + parseFloat(localStorage.getItem("usedSpace"), 10) - imageSizeToRemove === + 0 + ) { + localStorage.setItem("usedSpace", 0); + } else { + localStorage.setItem( + "usedSpace", + ( + parseFloat(localStorage.getItem("usedSpace"), 10) - imageSizeToRemove + ).toFixed(2) + ); + } + + const arr = JSON.parse(localStorage.getItem("photos")) || []; + const neuArr = arr.filter((i) => i.imageName !== imageNameToRemove); + localStorage.setItem("photos", JSON.stringify(neuArr)); + updateDisplay(); + event.target.remove(); + dangerText.classList.add("hidden"); + } +}); + +updateDisplay(); +showButtons(arr); diff --git a/davidArnfled/styles.css b/davidArnfled/styles.css new file mode 100644 index 0000000..3cbd537 --- /dev/null +++ b/davidArnfled/styles.css @@ -0,0 +1,291 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient( + 90deg, + rgba(255, 163, 153, 1) 36%, + rgba(255, 77, 151, 1) 100% + ); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} +body { + -ms-overflow-style: none; /* for Internet Explorer, Edge */ + scrollbar-width: none; /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +.hidden { + display: none; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; + cursor: pointer; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; + cursor: pointer; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + height: 7rem; + position: relative; + grid-area: b; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + filter: saturate(); + width: 0%; + height: 0.8rem; + position: relative; + transition: width 0.5s ease-in-out; +} +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ + +.gb-left p { + color: var(--dark-blue); + font-size: 1.4rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + display: flex; + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} + +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + +.buttons-container { + position: absolute; + bottom: -2.5rem; + left: 0; + display: flex; + align-items: center; + justify-content: start; + gap: 0.7rem; +} + +.my-button { + background-color: var(--background-color); + color: white; + padding: 10px 20px; + border-radius: 15px; + border: none; + cursor: pointer; + transition: all 0.3s; +} + +.my-button:hover { + background-color: var(--pale-blue); + color: var(--background-color); + font-weight: 700; +} + +.danger-text { + position: absolute; + bottom: -9px; + left: 14px; + color: red; + font-size: 0.8rem; +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + .gb-left:after { + display: none; + } + + .buttons-container { + bottom: 81.2%; + left: 0; + } +} diff --git a/evyatarBabay/images/bg-desktop.png b/evyatarBabay/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/evyatarBabay/images/bg-desktop.png differ diff --git a/evyatarBabay/images/bg-mobile.png b/evyatarBabay/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/evyatarBabay/images/bg-mobile.png differ diff --git a/evyatarBabay/images/favicon-32x32.png b/evyatarBabay/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/evyatarBabay/images/favicon-32x32.png differ diff --git a/evyatarBabay/images/icon-document.svg b/evyatarBabay/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/evyatarBabay/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/evyatarBabay/images/icon-folder.svg b/evyatarBabay/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/evyatarBabay/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/evyatarBabay/images/icon-upload.svg b/evyatarBabay/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/evyatarBabay/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/evyatarBabay/images/logo.svg b/evyatarBabay/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/evyatarBabay/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/evyatarBabay/images/project-preview.png b/evyatarBabay/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/evyatarBabay/images/project-preview.png differ diff --git a/evyatarBabay/index.html b/evyatarBabay/index.html new file mode 100644 index 0000000..8185600 --- /dev/null +++ b/evyatarBabay/index.html @@ -0,0 +1,68 @@ + + + + + + + + + + + + + Fylo data storage component + + + +
    + +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +

    You've used of your storage

    + +
    +
    +
    +
    +
    +
    +
    +

    + 0 MB + 100 MB +

    + +
    +

    +
    +
    +
    + + + \ No newline at end of file diff --git a/evyatarBabay/index.js b/evyatarBabay/index.js new file mode 100644 index 0000000..cb4ea7c --- /dev/null +++ b/evyatarBabay/index.js @@ -0,0 +1,69 @@ +const totalSize = 100000000 +var sizeAvailable; +var storageUsage; +localLoad(); +const imgRege =new RegExp( /\.(gif|jpe?g|png|)$/i); + +var multiFilesInput = document.getElementById('mult-img-input') //multiple images input element +multiFilesInput.onchange = ()=>{ + let currentFilesSize = 0; + let err= false; + for (let i = 0; i < multiFilesInput.files.length; i++) { + if(!imgRege.test( multiFilesInput.files[i].name)){ //files are not an image format + alert("File format isn't supported") + err=true; + } + currentFilesSize+=multiFilesInput.files[i].size + } + if(currentFilesSize>sizeAvailable){ //file size is too big + alert("There is not enough space on the disk") + err=true; + } + if(err){ + multiFilesInput.value= ""; // resets file explorer cause by an error + }else{ //display the files + document.getElementById('count').innerHTML = multiFilesInput.files.length+ " Files" + document.getElementById('file-size').innerHTML = (currentFilesSize/1000000).toFixed(2) + " MB" + } +} +document.getElementById('uplBtn').onclick = () =>{ //upload button clicking + let currentFilesSize = 0; + for (let i = 0; i < multiFilesInput.files.length; i++) { + currentFilesSize += multiFilesInput.files[i].size + } + console.log(currentFilesSize + "Current file size") + storageUsage+=parseInt(currentFilesSize) + sizeAvailable-=parseInt(currentFilesSize) + updateStorage(); + multiFilesInput.value= ""; // resets file explorer after using the files selected + document.getElementById('count').innerHTML =""; + document.getElementById('file-size').innerHTML =""; + localSave(); +} +updateStorage(); + +function updateStorage(){ + console.log((storageUsage/totalSize*100).toFixed(0) + " Progress bar percent") + let progressBarPercent = (storageUsage/totalSize*100).toFixed(0) + let span = document.createElement('span') + span.innerText = "MB left" + document.getElementById('storage-usage').innerHTML = (storageUsage/1000000).toFixed(2)+" MB" + document.getElementById('storage-available').innerHTML = (sizeAvailable/1000000).toFixed(0)+" " + document.getElementById('storage-available').append(span) + document.getElementsByClassName('gradient-bar')[0].style.width=progressBarPercent+"%" + +} +function localSave(){ + localStorage.setItem("sizeLeft",sizeAvailable); + localStorage.setItem("storageUse",storageUsage); +} +function localLoad(){ + if(localStorage.getItem("sizeLeft") != 'undefined'){ + sizeAvailable =parseInt( localStorage.getItem("sizeLeft")); + }else + sizeAvailable = totalSize; + if(localStorage.getItem("storageUse") != 'undefined'){ + storageUsage =parseInt( localStorage.getItem("storageUse")); + }else + storageUsage = 0; +} \ No newline at end of file diff --git a/evyatarBabay/styles.css b/evyatarBabay/styles.css new file mode 100644 index 0000000..68d5e38 --- /dev/null +++ b/evyatarBabay/styles.css @@ -0,0 +1,265 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} +body { + -ms-overflow-style: none; /* for Internet Explorer, Edge */ + scrollbar-width: none; /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: center; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} +.files{ + display: flex; + align-items: center; + justify-content: space-between; + font-weight: 700; + font-size: xx-large; +} +.files > div{ + display: flex; + justify-content: space-between; + align-items: center; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; + +} +input[type=file]{ + display: none; +} +.icon-img img { + width: 1.6rem; + height: 1.4rem; +} +.icon-img span{ + font-weight: 700; + font-size: large; +} +.icon-img button { + transition-duration: 0.6s; +} +.icon-img button:hover { + background-color:var(--pale-blue) ; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + height: 7rem; + position: relative; + grid-area: b; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + filter: saturate(); + width: 0%; + transition: width 2s; + height: 0.8rem; + position: relative; +} + +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 2.4rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + .gb-left:after { + display: none; + } +} diff --git a/eyarGdolov/index.html b/eyarGdolov/index.html new file mode 100644 index 0000000..df6f3f6 --- /dev/null +++ b/eyarGdolov/index.html @@ -0,0 +1,63 @@ + + + + + + + + + + + + + Fylo data storage component + + + + +
    + +
    + +
    +
    + +
    +
    +
    + Upload Image +
    +
    +
    + +
    +
    +
    +
    +

    Uploaded images:

    +
      +
      + +
      +

      You've used 0.00 MB of your storage

      + +
      +
      +
      +
      +
      +
      +
      +

      +
      0 MB
      +
      100 MB
      +

      + +
      +

      100MB left

      +
      +
      +
      + + + \ No newline at end of file diff --git a/eyarGdolov/script.js b/eyarGdolov/script.js new file mode 100644 index 0000000..aee815d --- /dev/null +++ b/eyarGdolov/script.js @@ -0,0 +1,86 @@ +var files=[]; +let maxSize=100; + + +function handleUserImages(event) { + const fileList = event.target.files; + for (let i = 0; i < fileList.length; i++) { + const file = fileList[i]; + const allowedExt = ['.jpg', '.jpeg', '.gif', '.png']; + + if (!allowedExt.some(ext => file.name.toLowerCase().endsWith(ext))) { + alert("Error: File format is not supported."); + console.error('Error: File format is not supported.'); + } + if (checkImageSize(file)) { + files.push(file); + if(calcFileSize(file)<0){ + alert("Error: Files size is too large. Max size is 100MB."); + console.error('Error: Files size is too large. Max size is 100MB.'); + files.pop(); + return 0; + } + displayFile(file); + } + } +} + + + function selectImage() { + console.log('Select image'); + const fileInput = document.createElement('input'); + fileInput.type = 'file'; + fileInput.accept = ''; + fileInput.addEventListener('change', handleUserImages); + fileInput.click(); + } + + + function checkImageSize(file) { + const imageSizeMB = ((file.size) / (1024 ** 2)); + console.log('File size is ', imageSizeMB, 'MB'); + if (imageSizeMB > maxSize) { + alert("Error: This file size exceeded 100MG."); + console.log("Error: This file size exceeded 100MG."); + return false; + } else + return true; + } + + + function calcFileSize(file) { + if (checkImageSize(file)) { + var totalUsedSpaceMb = Math.ceil(files.reduce((acc, curr) => acc + curr.size / (1024 ** 2), 0)); + const MbLeft = maxSize - totalUsedSpaceMb; + console.log('MbLeft:', MbLeft); + const StorageUsed = document.getElementById('StorageUsed'); + const StorageUsed1 = document.getElementById('StorageUsed1'); + StorageUsed.innerHTML = maxSize - MbLeft; + StorageUsed1.innerHTML = maxSize - MbLeft; + document.querySelector('.gradient-bar').style.width = StorageUsed.innerHTML + '%'; + const StorageLeft = document.getElementById('StorageLeft'); + StorageLeft.innerHTML = MbLeft; + return MbLeft; + } + else { + return 0; + } + } + +function displayFile(file) { + const fileList = document.getElementById('fileList'); + const listItem = document.createElement('li'); + listItem.innerHTML = `${file.name} `; + fileList.appendChild(listItem); +} + + +function deleteFile(fileName) { + files = files.filter(file => file.name !== fileName); + const fileList = document.getElementById('fileList'); + fileList.innerHTML = ''; + files.forEach(file => displayFile(file)); +} + + + diff --git a/eyarGdolov/styles.css b/eyarGdolov/styles.css new file mode 100644 index 0000000..a7fa748 --- /dev/null +++ b/eyarGdolov/styles.css @@ -0,0 +1,280 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} +body { + -ms-overflow-style: none; /* for Internet Explorer, Edge */ + scrollbar-width: none; /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images/bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + +#image-upload-button { + cursor: pointer; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + height: 7rem; + position: relative; + grid-area: b; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + width: 0%; + height: 0.8rem; + position: relative; + transition: width .5s linear; +} + +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; /* איפה שהנקודה עומדת + */ + height: auto; +} +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 2.4rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + +/** File List Box **/ +.fileListContainer { + color: var(--pale-blue); + font-size: 14px; + display: flex; + background-color: var(--container-background-color); + border-radius: 15px; + padding: 1.4rem 2.5rem; + margin-top: 20px; +} + +#fileList { + list-style: none; + padding: 0; + margin: 0; +} + +#fileList li { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 8px; + font-size: 14px; + color: var(--pale-blue); +} + +.deleteButton { + background-color: var(--dark-blue); + color: var(--pale-blue); + border: none; + border-radius: 50%; + cursor: pointer; + padding: 8px; + font-size: 12px; + line-height: 1; +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + .gb-left:after { + display: none; + } +} diff --git a/galLevi/index.html b/galLevi/index.html new file mode 100644 index 0000000..3cb3dab --- /dev/null +++ b/galLevi/index.html @@ -0,0 +1,61 @@ + + + + + + + + + + + + + Fylo data storage component + + + +
      + +
      + +
      +
      + + +
      +
      + +
      +
      + +
      +
      +
      + +
      +

      You've used of your storage

      +
      +
      +
      +
      +
      +
      +
      +

      + 0 MB + 100 MB +

      + +
      +

      MB left

      +
      +
      +
      + +
      +
      + + + + + \ No newline at end of file diff --git a/galLevi/index.js b/galLevi/index.js new file mode 100644 index 0000000..48581cf --- /dev/null +++ b/galLevi/index.js @@ -0,0 +1,110 @@ +const fileInput = document.getElementById('file-input'); +const stringSet = new Set(['image/jpg', 'image/jpeg', 'image/gif', 'image/png']); + + +const GB = document.getElementById('BB'); +const MB = document.getElementById('MBB'); +const MB1 = document.getElementById('MBB2'); +const MB2= document.getElementById('MBB3'); + +GB.style.width="0px"; +let i=0; +MB.innerText = parseInt(GB.style.width)+'MB'; +MB1.innerText = parseInt(GB.style.width)+'MB'; +MB2.innerText = 100+'MB '; + +let allSelectedFiles = []; + + +fileInput.onchange = () => { + + const selectedFiles = [...fileInput.files]; + let fileSize = 0; + for(let i=0 ; i0){ + const lastFile = selectedFiles[selectedFiles.length - 1]; + if(!stringSet.has(lastFile.type)){ + alert("You didnt uploded the right file!"); + selectedFiles.splice(-1, 1); + } + else if(parseInt(GB.style.width)<100 && (parseInt(GB.style.width) + fileSize)<=100){ + GB.style.width = (parseInt(GB.style.width) + fileSize) + '%'; + for(let i=0 ; i { + const FF2 = document.getElementById('filejs'); + let filewrapper = document.getElementById('filewrapper'); + if (!filewrapper) { + filewrapper = document.createElement("div"); + filewrapper.id = "filewrapper"; + FF2.append(filewrapper); + } + + + const container = document.createElement("div"); + container.classList.add("container"); + const showFE = document.createElement("div"); + showFE.classList.add("lst"); + const showfilel = document.createElement("span"); + showfilel.innerHTML = allSelectedFiles[allSelectedFiles.length - 1].name; + showFE.append(showfilel); + container.append(showFE); + + const rightB = document.createElement("div"); + rightB.classList.add("rightclick"); + const btn = document.createElement("span"); + btn.id = i; + i++; + btn.innerHTML = "×"; + + btn.addEventListener('click', (event) => { + const buttonMB = event.target.id; + const FX = allSelectedFiles[buttonMB].size/(1024*1024); + if((parseInt(GB.style.width) - FX)<=0){ + GB.style.width = '0px'; + MB.innerText = parseInt(GB.style.width)+'MB'; + MB1.innerText = parseInt(GB.style.width)+'MB'; + MB2.innerText = 100+'MB '; + filewrapper.remove(); + } + else{ + GB.style.width = (parseInt(GB.style.width) - FX) + '%'; + MB.innerText = parseInt(GB.style.width)+'MB'; + MB1.innerText = parseInt(GB.style.width)+'MB'; + MB2.innerText = 100-parseInt(GB.style.width)+'MB '; } + container.remove(); + }); + rightB.append(btn); + container.append(rightB); + filewrapper.append(container); + + +}; + +const saveToLocalStorage = (files) => { + const fileNames = files.map(file => file.name); + localStorage.setItem('uploadedFiles', JSON.stringify(fileNames)); +}; + +const fileIcon = document.getElementById('file-icon'); +fileIcon.addEventListener('click', function () { + fileInput.click(); +}); diff --git a/galLevi/styles.css b/galLevi/styles.css new file mode 100644 index 0000000..a14158c --- /dev/null +++ b/galLevi/styles.css @@ -0,0 +1,288 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} +body { + -ms-overflow-style: none; /* for Internet Explorer, Edge */ + scrollbar-width: none; /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ + + +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + height: 7rem; + position: relative; + grid-area: b; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; + position: relative; +} + +.gradient-bar { + position: absolute; + top: 0; + left: 0; + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + filter: saturate(); + width: 10%; + height: 0.8rem; + position: relative; + + transition: width 0.5s ease-in-out; +} +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 2.4rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + .gb-left:after { + display: none; + } +} +.ShowFiles{ + display: flex; + align-items: center; + +} + +#filewrapper { + display: flex; + flex-wrap: wrap; + margin: 10px; + background-color: var(--container-background-color); + border-radius: 10px; + padding: 10px; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); +} + +.container { + display: flex; + align-items: center; + background-color: hsl(228, 75%, 13%); + padding: 2px; + margin-bottom: 5px; + border-radius: 8px; +} + +.lst { + flex-grow: 1; + font-size: 12px; + color: aliceblue; +} + +.rightclick { + margin-left: 10px; +} + +.rightclick span { + color: red; + cursor: pointer; + font-size: 20px; +} + + diff --git a/hinoy/Fylo Project - Week 1/fylo-solution-main/Enhancing the Fylo project.pdf b/hinoy/Fylo Project - Week 1/fylo-solution-main/Enhancing the Fylo project.pdf new file mode 100644 index 0000000..20ebd2f Binary files /dev/null and b/hinoy/Fylo Project - Week 1/fylo-solution-main/Enhancing the Fylo project.pdf differ diff --git a/hinoy/Fylo Project - Week 1/fylo-solution-main/LICENSE b/hinoy/Fylo Project - Week 1/fylo-solution-main/LICENSE new file mode 100644 index 0000000..7521f14 --- /dev/null +++ b/hinoy/Fylo Project - Week 1/fylo-solution-main/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Ekaterine (Catherine) Mitagvaria + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/hinoy/Fylo Project - Week 1/fylo-solution-main/README.md b/hinoy/Fylo Project - Week 1/fylo-solution-main/README.md new file mode 100644 index 0000000..58ff98e --- /dev/null +++ b/hinoy/Fylo Project - Week 1/fylo-solution-main/README.md @@ -0,0 +1,50 @@ +![Fylo data storage component](https://github.com/catherineisonline/fylo-data-storage-component-frontendmentor/blob/main/images/project-preview.png?raw=true) + + +

      Fylo data storage component

      + +
      + +[Live](https://catherineisonline.github.io/fylo-data-storage-component-frontendmentor/) +| [Solution](https://www.frontendmentor.io/solutions/fylo-data-storage-component-gpaJOs4EP) +| [Challenge](https://www.frontendmentor.io/challenges/fylo-data-storage-component-1dZPRbV5n) + +Solution for a challenge from [frontendmentor.io](https://www.frontendmentor.io/) +
      + + + +## About The Project + +This component has some interesting CSS challenges in the design. If you're looking to test your CSS skills, this will be a great project for you! +The main challenge is to build out this data storage component and get it looking as close to the design as possible. +You can use any tools you like to help you complete the challenge. So if you've got something you'd like to practice, feel free to give it a go. + +Your users should be able to: +1. View the optimal layout depending on their device's screen size

      + +I do not have access to the Figma sketch so the design is not pixel perfect.

      + + + + +## Built with + +- Semantic HTML5 markup +- CSS custom properties +- Grid +- Desktop-first workflow + +## What I learned + +This project helped me to practice some grid as it's a little difficult for me to make the grid responsive. My goal is to make grid change from 1 row to 2 rows without using media query however I lack enough experience in this. I decided to finish this project as it is and deepen my knowledge of the grid in another project that I plan to make, specifically - a photography portfolio website. + + +## Useful resources + +1. [Figma](https://www.figma.com/) - Paste your design image to check the size of containers, width, etc. +2. [Perfect Pixel](https://chrome.google.com/webstore/detail/perfectpixel-by-welldonec/dkaagdgjmgdmbnecmcefdhjekcoceebi) - Awesome Chrome extension that helps you to match the pixels of the provided design. + +## Acknowledgments + +A big thank you to anyone providing feedback on my [solution](https://www.frontendmentor.io/solutions/fylo-data-storage-component-gpaJOs4EP). It definitely helps to find new ways to code and find easier solutions! diff --git a/hinoy/Fylo Project - Week 1/fylo-solution-main/images/bg-desktop.png b/hinoy/Fylo Project - Week 1/fylo-solution-main/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/hinoy/Fylo Project - Week 1/fylo-solution-main/images/bg-desktop.png differ diff --git a/hinoy/Fylo Project - Week 1/fylo-solution-main/images/bg-mobile.png b/hinoy/Fylo Project - Week 1/fylo-solution-main/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/hinoy/Fylo Project - Week 1/fylo-solution-main/images/bg-mobile.png differ diff --git a/hinoy/Fylo Project - Week 1/fylo-solution-main/images/favicon-32x32.png b/hinoy/Fylo Project - Week 1/fylo-solution-main/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/hinoy/Fylo Project - Week 1/fylo-solution-main/images/favicon-32x32.png differ diff --git a/hinoy/Fylo Project - Week 1/fylo-solution-main/images/icon-document.svg b/hinoy/Fylo Project - Week 1/fylo-solution-main/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/hinoy/Fylo Project - Week 1/fylo-solution-main/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/hinoy/Fylo Project - Week 1/fylo-solution-main/images/icon-folder.svg b/hinoy/Fylo Project - Week 1/fylo-solution-main/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/hinoy/Fylo Project - Week 1/fylo-solution-main/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/hinoy/Fylo Project - Week 1/fylo-solution-main/images/icon-upload.svg b/hinoy/Fylo Project - Week 1/fylo-solution-main/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/hinoy/Fylo Project - Week 1/fylo-solution-main/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/hinoy/Fylo Project - Week 1/fylo-solution-main/images/logo.svg b/hinoy/Fylo Project - Week 1/fylo-solution-main/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/hinoy/Fylo Project - Week 1/fylo-solution-main/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/hinoy/Fylo Project - Week 1/fylo-solution-main/images/project-preview.png b/hinoy/Fylo Project - Week 1/fylo-solution-main/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/hinoy/Fylo Project - Week 1/fylo-solution-main/images/project-preview.png differ diff --git a/hinoy/Fylo Project - Week 1/fylo-solution-main/index.html b/hinoy/Fylo Project - Week 1/fylo-solution-main/index.html new file mode 100644 index 0000000..f1f033b --- /dev/null +++ b/hinoy/Fylo Project - Week 1/fylo-solution-main/index.html @@ -0,0 +1,61 @@ + + + + + + + + + + + + + Fylo data storage component + + + +
      + +
      + +
      +
      + +
      +
      + +
      +
      + +
      + + +
      +
      + +
      +

      You've used 0 MB of your storage

      + +
      +
      +
      +
      +
      +
      +
      +

      + 0 MB + 15 MB +

      + +
      +

      15 MB left

      +
      +
      +
      + + + + \ No newline at end of file diff --git a/hinoy/Fylo Project - Week 1/fylo-solution-main/script.js b/hinoy/Fylo Project - Week 1/fylo-solution-main/script.js new file mode 100644 index 0000000..56e7785 --- /dev/null +++ b/hinoy/Fylo Project - Week 1/fylo-solution-main/script.js @@ -0,0 +1,53 @@ +var totalSizeLimit = 15; // 15 MB maximum +var totalUploadedSize = 0; // aggregated size of all files uploaded in bytes + +function openFile() { + document.getElementById('fileInput').click(); // opens the Finder/File Explorer +} + +function fileSelection() { + var selectedFiles = document.getElementById('fileInput').files; + var validFiles = [".png", ".jpg", ".gif", ".jpeg"]; + + for (var i = 0; i < selectedFiles.length; i++) { + var selectedFile = selectedFiles[i]; + var filesFormat = selectedFile.name.split('.').pop().toLowerCase(); // split the files extensions by "." (.jpg, .jpeg ...) + + if (validFiles.indexOf('.' + filesFormat) === -1) { + alert("File format isn't supported: " + selectedFile.name); + } else { + var fileSize = selectedFile.size; + var remainingStorage = totalSizeLimit - (totalUploadedSize / (1024 * 1024)); + + if (fileSize / (1024 * 1024) > remainingStorage) { // (fileSize / (1024 * 1024)) -> convert to MB + alert("There is not enough space on the disk"); + return; + } + totalUploadedSize += fileSize; + } + } + updateProgressBar(); + updateUploadedStorage(); +} + +function updateProgressBar() { + + var progressBar = document.querySelector('.gradient-bar'); + var progressDot = document.getElementById('progressDot'); + var mbLeft = document.getElementById('mbLeft'); + var percentageCalc = (totalUploadedSize / (totalSizeLimit * 1024 * 1024)) * 100; // (totalSizeLimit * 1024 * 1024) convert from MB to bytes and multiply by 100 to convert to a percentage + progressBar.style.width = percentageCalc + '%'; + var remainingStorage = totalSizeLimit - (totalUploadedSize / (1024 * 1024)); + mbLeft.textContent = remainingStorage.toFixed(2) + ' MB LEFT'; +} + +function updateUploadedStorage() { + var usedStorageElement = document.getElementById('usedStorage'); + var uploadedSizeInMB = totalUploadedSize / (1024 * 1024); // convert bytes to MB + usedStorageElement.textContent = uploadedSizeInMB.toFixed(2) + ' MB'; +} + +// place the progress bar at starting point +window.onload = function () { + updateProgressBar(); +} \ No newline at end of file diff --git a/hinoy/Fylo Project - Week 1/fylo-solution-main/styles.css b/hinoy/Fylo Project - Week 1/fylo-solution-main/styles.css new file mode 100644 index 0000000..7eefceb --- /dev/null +++ b/hinoy/Fylo Project - Week 1/fylo-solution-main/styles.css @@ -0,0 +1,274 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} + +body { + -ms-overflow-style: none; + /* for Internet Explorer, Edge */ + scrollbar-width: none; + /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; + /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; + color: grey; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + height: 7rem; + position: relative; + grid-area: b; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + filter: saturate(); + width: 74%; + height: 0.8rem; + position: relative; + transition: width 1s; +} + +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} + +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 2.4rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; + + + +} + +.gb-left span { + font-size: 0.9rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; + color: black; + +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; + + +} + +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); + +} + +#fileInput { + display: none; +} + +#mbLeft { + font-size: 0.9rem; + position: relative; + +} + +#maxStorage { + font-size: 1rem; +} + +#minStorage { + font-size: 1rem; +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + + .gb-left:after { + display: none; + } +} \ No newline at end of file diff --git a/idanBenGavriel/fylo-solution-main/LICENSE b/idanBenGavriel/fylo-solution-main/LICENSE new file mode 100644 index 0000000..7521f14 --- /dev/null +++ b/idanBenGavriel/fylo-solution-main/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Ekaterine (Catherine) Mitagvaria + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/idanBenGavriel/fylo-solution-main/README.md b/idanBenGavriel/fylo-solution-main/README.md new file mode 100644 index 0000000..58ff98e --- /dev/null +++ b/idanBenGavriel/fylo-solution-main/README.md @@ -0,0 +1,50 @@ +![Fylo data storage component](https://github.com/catherineisonline/fylo-data-storage-component-frontendmentor/blob/main/images/project-preview.png?raw=true) + + +

      Fylo data storage component

      + +
      + +[Live](https://catherineisonline.github.io/fylo-data-storage-component-frontendmentor/) +| [Solution](https://www.frontendmentor.io/solutions/fylo-data-storage-component-gpaJOs4EP) +| [Challenge](https://www.frontendmentor.io/challenges/fylo-data-storage-component-1dZPRbV5n) + +Solution for a challenge from [frontendmentor.io](https://www.frontendmentor.io/) +
      + + + +## About The Project + +This component has some interesting CSS challenges in the design. If you're looking to test your CSS skills, this will be a great project for you! +The main challenge is to build out this data storage component and get it looking as close to the design as possible. +You can use any tools you like to help you complete the challenge. So if you've got something you'd like to practice, feel free to give it a go. + +Your users should be able to: +1. View the optimal layout depending on their device's screen size

      + +I do not have access to the Figma sketch so the design is not pixel perfect.

      + + + + +## Built with + +- Semantic HTML5 markup +- CSS custom properties +- Grid +- Desktop-first workflow + +## What I learned + +This project helped me to practice some grid as it's a little difficult for me to make the grid responsive. My goal is to make grid change from 1 row to 2 rows without using media query however I lack enough experience in this. I decided to finish this project as it is and deepen my knowledge of the grid in another project that I plan to make, specifically - a photography portfolio website. + + +## Useful resources + +1. [Figma](https://www.figma.com/) - Paste your design image to check the size of containers, width, etc. +2. [Perfect Pixel](https://chrome.google.com/webstore/detail/perfectpixel-by-welldonec/dkaagdgjmgdmbnecmcefdhjekcoceebi) - Awesome Chrome extension that helps you to match the pixels of the provided design. + +## Acknowledgments + +A big thank you to anyone providing feedback on my [solution](https://www.frontendmentor.io/solutions/fylo-data-storage-component-gpaJOs4EP). It definitely helps to find new ways to code and find easier solutions! diff --git a/idanBenGavriel/fylo-solution-main/images/bg-desktop.png b/idanBenGavriel/fylo-solution-main/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/idanBenGavriel/fylo-solution-main/images/bg-desktop.png differ diff --git a/idanBenGavriel/fylo-solution-main/images/bg-mobile.png b/idanBenGavriel/fylo-solution-main/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/idanBenGavriel/fylo-solution-main/images/bg-mobile.png differ diff --git a/idanBenGavriel/fylo-solution-main/images/favicon-32x32.png b/idanBenGavriel/fylo-solution-main/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/idanBenGavriel/fylo-solution-main/images/favicon-32x32.png differ diff --git a/idanBenGavriel/fylo-solution-main/images/icon-document.svg b/idanBenGavriel/fylo-solution-main/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/idanBenGavriel/fylo-solution-main/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/idanBenGavriel/fylo-solution-main/images/icon-folder.svg b/idanBenGavriel/fylo-solution-main/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/idanBenGavriel/fylo-solution-main/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/idanBenGavriel/fylo-solution-main/images/icon-upload.svg b/idanBenGavriel/fylo-solution-main/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/idanBenGavriel/fylo-solution-main/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/idanBenGavriel/fylo-solution-main/images/logo.svg b/idanBenGavriel/fylo-solution-main/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/idanBenGavriel/fylo-solution-main/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/idanBenGavriel/fylo-solution-main/images/project-preview.png b/idanBenGavriel/fylo-solution-main/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/idanBenGavriel/fylo-solution-main/images/project-preview.png differ diff --git a/idanBenGavriel/fylo-solution-main/index.html b/idanBenGavriel/fylo-solution-main/index.html new file mode 100644 index 0000000..f361061 --- /dev/null +++ b/idanBenGavriel/fylo-solution-main/index.html @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + Fylo data storage component + + + +
      + +
      + +
      +
      + +
      +
      + + + +
      +
      + +
      +
      +
      + + +
      +

      You've used 0 MB of your storage

      + +
      +
      +
      +
      +
      +
      +
      +

      + 0 MB + 100 MB +

      + +
      +

      100

      MB left +
      +
      +
      + + + + \ No newline at end of file diff --git a/idanBenGavriel/fylo-solution-main/index.js b/idanBenGavriel/fylo-solution-main/index.js new file mode 100644 index 0000000..f044275 --- /dev/null +++ b/idanBenGavriel/fylo-solution-main/index.js @@ -0,0 +1,50 @@ +document.addEventListener("DOMContentLoaded", function() { + // Get the elements from the HTML file + const imageInput = document.getElementById('imageInput'); + const progressBar = document.querySelector('.gradient-bar'); + const usedStorageElement = document.getElementById('used-storage'); + const MbLeftElement = document.getElementById('lefted-storage'); + + let totalStorage = 100; + let usedStorage = 0; // Start with 0 used storage + + // Event listener for file changes + imageInput.addEventListener('change', function() { + const selectedFiles = imageInput.files; + + if (selectedFiles) { + let totalSelectedSizeKB = 0; + + // Loop for adding files and also checks if this is a correct file + const allowedFormats = ['image/jpeg', 'image/jpg', 'image/png', 'image/gif']; // The Allowed image formats + for (let i = 0; i < selectedFiles.length; i++) { + const selectedFile = selectedFiles[i]; + if (!allowedFormats.includes(selectedFile.type)) { + alert('File format isn’t supported'); + return; + } + totalSelectedSizeKB += selectedFile.size / 1024; // Convert bytes to KB + } + + // Check available storage for all selected files + const availableStorage = totalStorage - usedStorage; + if (totalSelectedSizeKB > availableStorage) { + alert('There is not enough space on the disk'); + return; + } + + // Update used storage for all selected files + usedStorage += totalSelectedSizeKB; + updateStorageDisplay(); + } + }); + + // Function to update the storage display + function updateStorageDisplay() { + progressBar.style.width = (usedStorage / totalStorage) * 100 + '%'; // Changes the progress bar + usedStorageElement.textContent = usedStorage.toFixed(0) ; // Changes the number of used storage + MbLeftElement.textContent = (totalStorage - usedStorage).toFixed(0) ; // changes the number of lefted storage + } + + +}); diff --git a/idanBenGavriel/fylo-solution-main/styles.css b/idanBenGavriel/fylo-solution-main/styles.css new file mode 100644 index 0000000..72f90fd --- /dev/null +++ b/idanBenGavriel/fylo-solution-main/styles.css @@ -0,0 +1,239 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} +body { + -ms-overflow-style: none; /* for Internet Explorer, Edge */ + scrollbar-width: none; /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + height: 7rem; + position: relative; + grid-area: b; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + filter: saturate(); + width: 0%; + height: 0.8rem; + position: relative; +} +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 2.4rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + .gb-left:after { + display: none; + } + +} diff --git a/inonEl/Enhancing the Fylo project.pdf b/inonEl/Enhancing the Fylo project.pdf new file mode 100644 index 0000000..20ebd2f Binary files /dev/null and b/inonEl/Enhancing the Fylo project.pdf differ diff --git a/inonEl/LICENSE b/inonEl/LICENSE new file mode 100644 index 0000000..7521f14 --- /dev/null +++ b/inonEl/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Ekaterine (Catherine) Mitagvaria + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/inonEl/README.md b/inonEl/README.md new file mode 100644 index 0000000..58ff98e --- /dev/null +++ b/inonEl/README.md @@ -0,0 +1,50 @@ +![Fylo data storage component](https://github.com/catherineisonline/fylo-data-storage-component-frontendmentor/blob/main/images/project-preview.png?raw=true) + + +

      Fylo data storage component

      + +
      + +[Live](https://catherineisonline.github.io/fylo-data-storage-component-frontendmentor/) +| [Solution](https://www.frontendmentor.io/solutions/fylo-data-storage-component-gpaJOs4EP) +| [Challenge](https://www.frontendmentor.io/challenges/fylo-data-storage-component-1dZPRbV5n) + +Solution for a challenge from [frontendmentor.io](https://www.frontendmentor.io/) +
      + + + +## About The Project + +This component has some interesting CSS challenges in the design. If you're looking to test your CSS skills, this will be a great project for you! +The main challenge is to build out this data storage component and get it looking as close to the design as possible. +You can use any tools you like to help you complete the challenge. So if you've got something you'd like to practice, feel free to give it a go. + +Your users should be able to: +1. View the optimal layout depending on their device's screen size

      + +I do not have access to the Figma sketch so the design is not pixel perfect.

      + + + + +## Built with + +- Semantic HTML5 markup +- CSS custom properties +- Grid +- Desktop-first workflow + +## What I learned + +This project helped me to practice some grid as it's a little difficult for me to make the grid responsive. My goal is to make grid change from 1 row to 2 rows without using media query however I lack enough experience in this. I decided to finish this project as it is and deepen my knowledge of the grid in another project that I plan to make, specifically - a photography portfolio website. + + +## Useful resources + +1. [Figma](https://www.figma.com/) - Paste your design image to check the size of containers, width, etc. +2. [Perfect Pixel](https://chrome.google.com/webstore/detail/perfectpixel-by-welldonec/dkaagdgjmgdmbnecmcefdhjekcoceebi) - Awesome Chrome extension that helps you to match the pixels of the provided design. + +## Acknowledgments + +A big thank you to anyone providing feedback on my [solution](https://www.frontendmentor.io/solutions/fylo-data-storage-component-gpaJOs4EP). It definitely helps to find new ways to code and find easier solutions! diff --git a/inonEl/images/bg-desktop.png b/inonEl/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/inonEl/images/bg-desktop.png differ diff --git a/inonEl/images/bg-mobile.png b/inonEl/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/inonEl/images/bg-mobile.png differ diff --git a/inonEl/images/favicon-32x32.png b/inonEl/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/inonEl/images/favicon-32x32.png differ diff --git a/inonEl/images/icon-document.svg b/inonEl/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/inonEl/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/inonEl/images/icon-folder.svg b/inonEl/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/inonEl/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/inonEl/images/icon-upload.svg b/inonEl/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/inonEl/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/inonEl/images/logo.svg b/inonEl/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/inonEl/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/inonEl/images/project-preview.png b/inonEl/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/inonEl/images/project-preview.png differ diff --git a/inonEl/index.html b/inonEl/index.html new file mode 100644 index 0000000..ede251f --- /dev/null +++ b/inonEl/index.html @@ -0,0 +1,64 @@ + + + + + + + + + + + + + Fylo data storage component + + + +
      + +
      + +
      +
      + +
      +
      + +
      +
      + + +
      +
      +
      + +
      +

      You've used 70 MB of your storage

      +
      + +
      +
      +
      +
      +
      +
      +
      +

      + 0 MB + 100 MB +

      + + +
      +

      +

      100

      MB left

      +
      +
      +
      + + + + + \ No newline at end of file diff --git a/inonEl/script.js b/inonEl/script.js new file mode 100644 index 0000000..ec885ee --- /dev/null +++ b/inonEl/script.js @@ -0,0 +1,112 @@ +function saveState(sizeNum, files) { + localStorage.setItem('storageSize', sizeNum.toString()); + localStorage.setItem('storageFiles', JSON.stringify(files)); +} + + +function loadState() { + const size = parseFloat(localStorage.getItem('storageSize')) || 0; + const files = JSON.parse(localStorage.getItem('storageFiles')) || []; + + return { sizeNum: size, files }; +} + + + +function updateDotPosition(sizeNum) { + const gradientBar = document.querySelector('.gradient-bar'); + gradientBar.style.width = `${sizeNum}%`; +} + + +function updateLeft(sizeNum) { + const left = document.getElementById("left"); + left.innerText = Math.round((100 - sizeNum) * 100) / 100; +} + + +function openFileExplorer() { + document.getElementById('file-input').click(); +} + + +function handleFileSelect(event) { + const selectedFiles = event.target.files; + let state = loadState(); + const sizeElement = document.getElementById('size'); + + for (let i = 0; i < selectedFiles.length; i++) { + const selectedFile = selectedFiles[i]; + const selectedFileSize = Math.round((selectedFile.size / 1000000) * 100) / 100; + + if (selectedFile.type === 'image/jpeg' || selectedFile.type === 'image/jpg' || selectedFile.type === 'image/png' || selectedFile.type === 'image/gif') { + if (state.sizeNum + selectedFileSize < 100) { + state.sizeNum = Math.round((state.sizeNum + selectedFileSize) * 100) / 100; + sizeElement.innerText = state.sizeNum; + state.files.push({ name: selectedFile.name, size: selectedFileSize }); + saveState(state.sizeNum, state.files); + + updateDotPosition(state.sizeNum); + updateLeft(state.sizeNum); + + const filesDiv = document.getElementById("files"); + const button = document.createElement('button'); + button.textContent = selectedFile.name; + button.classList.add('file-button'); + button.onclick = function () { + handleRemove(button, selectedFileSize); + }; + + filesDiv.appendChild(button); + } else { + alert("There is not enough space on the disk"); + } + } else { + alert("File format isn't supported"); + } + } +} + + +function handleRemove(button, fileSize) { + let state = loadState(); + state.sizeNum = Math.round((state.sizeNum - fileSize) * 100) / 100; + + state.files = state.files.filter(file => file.name !== button.textContent); + saveState(state.sizeNum, state.files); + + const sizeElement = document.getElementById('size'); + sizeElement.innerText = state.sizeNum; + updateDotPosition(state.sizeNum); + updateLeft(state.sizeNum); + button.style.display = 'none'; + + document.getElementById('file-input').value = ''; +} + + +document.addEventListener('DOMContentLoaded', function () { + let state = loadState(); + updateDotPosition(state.sizeNum); + updateLeft(state.sizeNum); + const sizeElement = document.getElementById('size'); + sizeElement.innerText = state.sizeNum + + const filesDiv = document.getElementById("files"); + state.files.forEach(file => { + const button = document.createElement('button'); + button.textContent = file.name; + button.classList.add('file-button'); + button.onclick = function () { + handleRemove(button, file.size, state.files); + }; + + filesDiv.appendChild(button); + }); +}); + + +function clearState() { + localStorage.removeItem('storageSize'); + localStorage.removeItem('storageFiles'); +} \ No newline at end of file diff --git a/inonEl/styles.css b/inonEl/styles.css new file mode 100644 index 0000000..4722843 --- /dev/null +++ b/inonEl/styles.css @@ -0,0 +1,285 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} + +body { + -ms-overflow-style: none; + /* for Internet Explorer, Edge */ + scrollbar-width: none; + /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; + /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + max-height: auto; + position: relative; + grid-area: b; +} + + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + filter: saturate(); + height: 0.8rem; + width: 0%; + position: relative; +} + +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} + +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 2.4rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} + +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + + .gb-left:after { + display: none; + } +} + + +#file-input { + display: none; +} + +.file-button { + position: relative; + display: flex; + align-items: center; + background-color: rgb(83, 83, 133); + border-radius: 50px; + height: 1rem; + margin-bottom: 10px; + border-style: none; + color: white; +} + +#uploud-img { + cursor: pointer; +} + +#files { + display: flex; + flex-flow: row wrap; +} + +#clear-button { + background-color: rgba(119, 90, 144, 0.991); + position: relative; + display: flex; + align-items: center; + border-radius: 50px; + height: 1rem; + margin-bottom: 10px; + border-style: none; + color: white; +} \ No newline at end of file diff --git a/liorHassin/Enhancing the Fylo project.pdf b/liorHassin/Enhancing the Fylo project.pdf new file mode 100644 index 0000000..20ebd2f Binary files /dev/null and b/liorHassin/Enhancing the Fylo project.pdf differ diff --git a/liorHassin/LICENSE b/liorHassin/LICENSE new file mode 100644 index 0000000..7521f14 --- /dev/null +++ b/liorHassin/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Ekaterine (Catherine) Mitagvaria + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/liorHassin/README.md b/liorHassin/README.md new file mode 100644 index 0000000..fb9a866 --- /dev/null +++ b/liorHassin/README.md @@ -0,0 +1,10 @@ +## About The Project + +This component has some interesting CSS challenges in the design. If you're looking to test your CSS skills, this will be a great project for you! +The main challenge is to build out this data storage component and get it looking as close to the design as possible. +You can use any tools you like to help you complete the challenge. So if you've got something you'd like to practice, feel free to give it a go. + +Your users should be able to: +1. View the optimal layout depending on their device's screen size +2. Upload images and see the progress bar/other parameters change accordingly. +3. Refresh the page and have the entire data saved(local storage). diff --git a/liorHassin/images/bg-desktop.png b/liorHassin/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/liorHassin/images/bg-desktop.png differ diff --git a/liorHassin/images/bg-mobile.png b/liorHassin/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/liorHassin/images/bg-mobile.png differ diff --git a/liorHassin/images/favicon-32x32.png b/liorHassin/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/liorHassin/images/favicon-32x32.png differ diff --git a/liorHassin/images/icon-document.svg b/liorHassin/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/liorHassin/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/liorHassin/images/icon-folder.svg b/liorHassin/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/liorHassin/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/liorHassin/images/icon-upload.svg b/liorHassin/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/liorHassin/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/liorHassin/images/logo.svg b/liorHassin/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/liorHassin/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/liorHassin/images/project-preview.png b/liorHassin/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/liorHassin/images/project-preview.png differ diff --git a/liorHassin/index.html b/liorHassin/index.html new file mode 100644 index 0000000..2a447bb --- /dev/null +++ b/liorHassin/index.html @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + Fylo data storage component + + + +
      + +
      + +
      +
      + +
      +
      + +
      +
      + +
      +
      +
      + +
      +

      You've used 0 MB of your storage

      + +
      +
      +
      +
      +
      +
      +
      +

      + 0 MB + 10 MB +

      + +
      +

      10

      MB left

      +
      +
      +
      + + \ No newline at end of file diff --git a/liorHassin/script.js b/liorHassin/script.js new file mode 100644 index 0000000..ab7788a --- /dev/null +++ b/liorHassin/script.js @@ -0,0 +1,67 @@ +const maxSize = 10; +let storedSize; +let storedFiles = []; + +let total_used; +let mb_left; +let gradient_bar; +document.addEventListener('DOMContentLoaded', () => { + total_used = document.getElementById("total-used"); + mb_left = document.getElementById("mb-left"); + gradient_bar = document.querySelector(".gradient-bar"); +}); +window.onload = () => { + storedSize = parseFloat(localStorage.getItem('storedSize')) || 0; + updateView(); +}; + +async function uploadFiles(){ + let size = 0; + const filesSystemFileHandler = await showOpenFilePicker({multiple: true}); + const files = await extractFileFromHandler(filesSystemFileHandler); + + files.forEach(element => { + size+= element.size/1024/1024; + }); + + const error = validateFiles(files, size); + if(error !== "") { + alert(error); + return; + } + + storedSize += size; + files.forEach(file => {storedFiles.push({fileName: file.name, fileSize: file.size/1024/1024});}); + + updateView(); + localStorage.setItem('storedSize', storedSize); +} + +async function extractFileFromHandler(fileHandlers){ + const files = []; + for (const fileHandler of fileHandlers) { + const file = await fileHandler.getFile(); + files.push(file); + } + return files; +} + +function validateFiles(files, size){ + if(size + storedSize > maxSize) return "Error: Size exceeded maximum!"; + const fileRegex = new RegExp("[^\\s]+(.*?)\\.(jpg|jpeg|png|gif|JPG|JPEG|PNG|GIF)$"); + let error = "Error: Following files format are not supported -> "; + let unsupportedFileFound = false; + for(let i = 0; i < files.length; i++) { + if(!fileRegex.test(files[i].name)){ + error += files[i].name + " | "; + unsupportedFileFound = true; + } + } + return unsupportedFileFound ? error : ""; +} + +function updateView(){ + total_used.innerText = storedSize.toFixed(2); + mb_left.innerText = (maxSize - storedSize).toFixed(2); + gradient_bar.style.width = `${storedSize.toFixed(2)*10}%`; +} \ No newline at end of file diff --git a/liorHassin/styles.css b/liorHassin/styles.css new file mode 100644 index 0000000..08f5b2a --- /dev/null +++ b/liorHassin/styles.css @@ -0,0 +1,243 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} +body { + -ms-overflow-style: none; /* for Internet Explorer, Edge */ + scrollbar-width: none; /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + height: 7rem; + position: relative; + grid-area: b; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + transition: width 1.2s; + border-radius: 50px; + filter: saturate(); + width: 0.8rem; + height: 0.8rem; + position: relative; +} +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 1.9rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + .gb-left:after { + display: none; + } +} + +#upload-button{ + cursor: pointer; +} \ No newline at end of file diff --git a/morAlmakayes/images/bg-desktop.png b/morAlmakayes/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/morAlmakayes/images/bg-desktop.png differ diff --git a/morAlmakayes/images/bg-mobile.png b/morAlmakayes/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/morAlmakayes/images/bg-mobile.png differ diff --git a/morAlmakayes/images/favicon-32x32.png b/morAlmakayes/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/morAlmakayes/images/favicon-32x32.png differ diff --git a/morAlmakayes/images/icon-document.svg b/morAlmakayes/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/morAlmakayes/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/morAlmakayes/images/icon-folder.svg b/morAlmakayes/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/morAlmakayes/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/morAlmakayes/images/icon-upload.svg b/morAlmakayes/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/morAlmakayes/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/morAlmakayes/images/logo.svg b/morAlmakayes/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/morAlmakayes/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/morAlmakayes/images/project-preview.png b/morAlmakayes/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/morAlmakayes/images/project-preview.png differ diff --git a/morAlmakayes/index.html b/morAlmakayes/index.html new file mode 100644 index 0000000..7315032 --- /dev/null +++ b/morAlmakayes/index.html @@ -0,0 +1,59 @@ + + + + + + + + + + + + Fylo data storage component + + + +
      + +
      + +
      +
      + +
      +
      + +
      +
      + + +
      +
      +
      + +
      +

      You've used MB left of your storage

      + +
      +
      +
      +
      +
      +
      +
      +

      + 0 MB + +

      + +
      +

      +
      +
      +
      + + + + \ No newline at end of file diff --git a/morAlmakayes/program.js b/morAlmakayes/program.js new file mode 100644 index 0000000..1fc97a2 --- /dev/null +++ b/morAlmakayes/program.js @@ -0,0 +1,47 @@ +const totalDiskSpace = 30; +const totalDiskSpaceId = document.getElementById('totalDiskSpaceId'); +totalDiskSpaceId.textContent = totalDiskSpace + ' MB '; + +let usedSpace = 0; +const usedSpaceId = document.getElementById('usedSpaceId'); +usedSpaceId.textContent = usedSpace; + +let availableDiskSpace = totalDiskSpace - usedSpace; +const availableDiskSpaceId = document.getElementById('availableDiskSpaceId'); +availableDiskSpaceId.textContent = availableDiskSpace+ ' MB ' ; + +document.getElementById('openFileExplorer').onclick = function() { + document.getElementById('fileInput').click(); +}; + +const FillTheBar = document.getElementById('FillTheBarId'); + +document.getElementById('fileInput').onchange = function() { + const files = this.files; + let totalFileSize = 0; + + for (let i = 0; i < files.length; i++) { + const file = files[i]; + totalFileSize += file.size / 1048576; + } + + if (usedSpace + totalFileSize <= totalDiskSpace) { + usedSpace += totalFileSize; + availableDiskSpace = totalDiskSpace - usedSpace; + + usedSpaceId.textContent = usedSpace.toFixed(2); + availableDiskSpaceId.textContent = availableDiskSpace.toFixed(2)+ ' MB ' ; + + FillTheBar.style.width = (usedSpace * 100) / totalDiskSpace + '%'; + + } else { + + alert('There is not enough space on the disk, please try again'); + document.getElementById('fileInput').value = ''; + usedSpace = 0; + availableDiskSpace = totalDiskSpace; + usedSpaceId.textContent = usedSpace.toFixed(2); + availableDiskSpaceId.textContent = availableDiskSpace.toFixed(2)+ ' MB ' ; + FillTheBar.style.width = '0%'; + }לא +}; \ No newline at end of file diff --git a/morAlmakayes/styles.css b/morAlmakayes/styles.css new file mode 100644 index 0000000..ae97e95 --- /dev/null +++ b/morAlmakayes/styles.css @@ -0,0 +1,245 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} +body { + -ms-overflow-style: none; /* for Internet Explorer, Edge */ + scrollbar-width: none; /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + +.button{ + width: 8.5rem; + height: auto; + background-color: var(--background-color); +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + height: 7rem; + position: relative; + grid-area: b; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + filter: saturate(); + width: 0%; + height: 0.8rem; + position: relative; + transition: width 1.5s ease-in-out; +} +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 2.4rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + .gb-left:after { + display: none; + } +} diff --git a/natiPorish/Ex2 - fylo-solution/.vscode/settings.json b/natiPorish/Ex2 - fylo-solution/.vscode/settings.json new file mode 100644 index 0000000..6f3a291 --- /dev/null +++ b/natiPorish/Ex2 - fylo-solution/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "liveServer.settings.port": 5501 +} \ No newline at end of file diff --git a/natiPorish/Ex2 - fylo-solution/Enhancing the Fylo project.pdf b/natiPorish/Ex2 - fylo-solution/Enhancing the Fylo project.pdf new file mode 100644 index 0000000..20ebd2f Binary files /dev/null and b/natiPorish/Ex2 - fylo-solution/Enhancing the Fylo project.pdf differ diff --git a/natiPorish/Ex2 - fylo-solution/LICENSE b/natiPorish/Ex2 - fylo-solution/LICENSE new file mode 100644 index 0000000..7521f14 --- /dev/null +++ b/natiPorish/Ex2 - fylo-solution/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Ekaterine (Catherine) Mitagvaria + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/natiPorish/Ex2 - fylo-solution/README.md b/natiPorish/Ex2 - fylo-solution/README.md new file mode 100644 index 0000000..58ff98e --- /dev/null +++ b/natiPorish/Ex2 - fylo-solution/README.md @@ -0,0 +1,50 @@ +![Fylo data storage component](https://github.com/catherineisonline/fylo-data-storage-component-frontendmentor/blob/main/images/project-preview.png?raw=true) + + +

      Fylo data storage component

      + +
      + +[Live](https://catherineisonline.github.io/fylo-data-storage-component-frontendmentor/) +| [Solution](https://www.frontendmentor.io/solutions/fylo-data-storage-component-gpaJOs4EP) +| [Challenge](https://www.frontendmentor.io/challenges/fylo-data-storage-component-1dZPRbV5n) + +Solution for a challenge from [frontendmentor.io](https://www.frontendmentor.io/) +
      + + + +## About The Project + +This component has some interesting CSS challenges in the design. If you're looking to test your CSS skills, this will be a great project for you! +The main challenge is to build out this data storage component and get it looking as close to the design as possible. +You can use any tools you like to help you complete the challenge. So if you've got something you'd like to practice, feel free to give it a go. + +Your users should be able to: +1. View the optimal layout depending on their device's screen size

      + +I do not have access to the Figma sketch so the design is not pixel perfect.

      + + + + +## Built with + +- Semantic HTML5 markup +- CSS custom properties +- Grid +- Desktop-first workflow + +## What I learned + +This project helped me to practice some grid as it's a little difficult for me to make the grid responsive. My goal is to make grid change from 1 row to 2 rows without using media query however I lack enough experience in this. I decided to finish this project as it is and deepen my knowledge of the grid in another project that I plan to make, specifically - a photography portfolio website. + + +## Useful resources + +1. [Figma](https://www.figma.com/) - Paste your design image to check the size of containers, width, etc. +2. [Perfect Pixel](https://chrome.google.com/webstore/detail/perfectpixel-by-welldonec/dkaagdgjmgdmbnecmcefdhjekcoceebi) - Awesome Chrome extension that helps you to match the pixels of the provided design. + +## Acknowledgments + +A big thank you to anyone providing feedback on my [solution](https://www.frontendmentor.io/solutions/fylo-data-storage-component-gpaJOs4EP). It definitely helps to find new ways to code and find easier solutions! diff --git a/natiPorish/Ex2 - fylo-solution/images/bg-desktop.png b/natiPorish/Ex2 - fylo-solution/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/natiPorish/Ex2 - fylo-solution/images/bg-desktop.png differ diff --git a/natiPorish/Ex2 - fylo-solution/images/bg-mobile.png b/natiPorish/Ex2 - fylo-solution/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/natiPorish/Ex2 - fylo-solution/images/bg-mobile.png differ diff --git a/natiPorish/Ex2 - fylo-solution/images/favicon-32x32.png b/natiPorish/Ex2 - fylo-solution/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/natiPorish/Ex2 - fylo-solution/images/favicon-32x32.png differ diff --git a/natiPorish/Ex2 - fylo-solution/images/icon-document.svg b/natiPorish/Ex2 - fylo-solution/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/natiPorish/Ex2 - fylo-solution/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/natiPorish/Ex2 - fylo-solution/images/icon-folder.svg b/natiPorish/Ex2 - fylo-solution/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/natiPorish/Ex2 - fylo-solution/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/natiPorish/Ex2 - fylo-solution/images/icon-upload.svg b/natiPorish/Ex2 - fylo-solution/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/natiPorish/Ex2 - fylo-solution/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/natiPorish/Ex2 - fylo-solution/images/logo.svg b/natiPorish/Ex2 - fylo-solution/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/natiPorish/Ex2 - fylo-solution/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/natiPorish/Ex2 - fylo-solution/images/project-preview.png b/natiPorish/Ex2 - fylo-solution/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/natiPorish/Ex2 - fylo-solution/images/project-preview.png differ diff --git a/natiPorish/Ex2 - fylo-solution/index.html b/natiPorish/Ex2 - fylo-solution/index.html new file mode 100644 index 0000000..207256e --- /dev/null +++ b/natiPorish/Ex2 - fylo-solution/index.html @@ -0,0 +1,90 @@ + + + + + + + + + + + + + Fylo data storage component + + + +
      + + +
      + +
      +
      + +
      +
      +
      + +
      +

      You've used 0MB of your storage

      + +
      +
      +
      +
      +
      +
      +
      +

      + 0 MB + 100 MB +

      + +
      +

      100 MB left

      +
      +
      + + +
      +
      +
      + + + + + + + + + + \ No newline at end of file diff --git a/natiPorish/Ex2 - fylo-solution/script.js b/natiPorish/Ex2 - fylo-solution/script.js new file mode 100644 index 0000000..33e0cd2 --- /dev/null +++ b/natiPorish/Ex2 - fylo-solution/script.js @@ -0,0 +1,158 @@ +var modal = document.getElementById("myModal"); +var modal2 = document.getElementById("myModal2"); + +var span = document.getElementsByClassName("close")[0]; +var span2 = document.getElementsByClassName("close")[1]; + + +document.addEventListener('DOMContentLoaded', function () { + var storedFiles = JSON.parse(localStorage.getItem('files')) || []; + var progressBar = document.querySelector('.progress-bar .gradient-bar'); + + var uploadedImageBox = document.getElementById('uploaded-image-box'); + if (storedFiles.length > 0) { + uploadedImageBox.innerHTML = storedFiles.map(function (file) { + return '
      ' + file.name + '
      '; + }).join(''); + showUploadedImageBox(); + } + + function showUploadedImageBox() { + uploadedImageBox.style.display = 'block'; + setTimeout(function () { + uploadedImageBox.classList.add('show'); + }, 10); + } + + function hideUploadedImageBox() { + uploadedImageBox.classList.remove('show'); + setTimeout(function () { + uploadedImageBox.style.display = 'none'; + }, 500); + } + + calculateTotalSize(); + updateProgressBar(); + updateUsedSizeSum(); + + function calculateTotalSize() { + var totalSize = storedFiles.reduce(function (acc, file) { + return acc + file.size; + }, 0); + localStorage.setItem('totalSize', totalSize); + return totalSize; + } + + function updateProgressBar() { + var totalSize = calculateTotalSize(); + var percentage = (totalSize / (100 * 1024 * 1024)).toFixed(2) * 100; + progressBar.style.width = percentage + '%'; + } + + function updateUsedSizeSum() { + var totalSize = calculateTotalSize(); + var usedSizeSum = document.getElementById('storage-used'); + var usedSizeSum2 = document.getElementById('storage-used2'); + var storageLeft = document.getElementById('storage-left'); + usedSizeSum.innerHTML = (totalSize / (1024 * 1024)).toFixed(2) + ' '; + usedSizeSum2.innerHTML = (totalSize / (1024 * 1024)).toFixed(2) + ' MB'; + + var remainingMB = (100 - (totalSize / (1024 * 1024)).toFixed(2)).toFixed(2); + storageLeft.innerHTML = remainingMB + ' MB left'; + if (totalSize === 0) { + storageLeft.innerHTML = '100' + ' MB left'; + uploadedImageBox.innerHTML = ''; + } + } + + document.getElementById('file-input').addEventListener('change', function () { + var fileInput = document.getElementById('file-input'); + var file = fileInput.files[0]; + var allowedExtensions = /(\.jpg|\.jpeg|\.gif|\.png)$/i; + + if (!allowedExtensions.exec(file.name)) { + modal.style.display = "block"; + fileInput.value = ''; + return; + } + + var fileSizeInMB = file.size / (1024 * 1024); + var totalSizeInMB = calculateTotalSize() / (1024 * 1024); + + if (fileSizeInMB + totalSizeInMB > 100) { + modal2.style.display = "block"; + return; + } + + var fileName = file.name; + var fileType = fileName.split('.').pop(); + var truncatedFileName = fileName.length > 12 ? fileName.substring(0, 7) + '...' + fileType : fileName; + var fileSize = file.size; + storedFiles.push({ name: truncatedFileName, size: fileSize }); + + localStorage.setItem('files', JSON.stringify(storedFiles)); + + uploadedImageBox.innerHTML += '
      ' + truncatedFileName + '
      '; + + uploadedImageBox.style.display = 'block'; + + updateProgressBar(); + updateUsedSizeSum(); + + setTimeout(function () { + uploadedImageBox.classList.add('fade-in'); + }, 100); + + showUploadedImageBox(); + console.log(storedFiles); + }); + + document.addEventListener('click', function (e) { + if (e.target && e.target.classList.contains('delete-icon')) { + var clickedFileName = e.target.previousElementSibling.textContent; + storedFiles = storedFiles.filter(function (file) { + return file.name !== clickedFileName; + }); + + localStorage.setItem('files', JSON.stringify(storedFiles)); + + e.target.parentElement.remove(); + + if (storedFiles.length === 0) { + uploadedImageBox.style.display = 'none'; + } + + if (storedFiles.length === 0) { + hideUploadedImageBox(); + } + + updateProgressBar(); + updateUsedSizeSum(); + } + }); +}); + +span.onclick = function () { + modal.style.display = "none"; +} + +span2.onclick = function () { + modal2.style.display = "none"; +} + +window.onclick = function (event) { + if (event.target == modal) { + modal.style.display = "none"; + } + if (event.target == modal2) { + modal2.style.display = "none"; + } +} + +document.getElementById("understandBtn").addEventListener("click", function () { + modal.style.display = "none"; +}); + +document.getElementById("understandBtn2").addEventListener("click", function () { + modal2.style.display = "none"; +}); \ No newline at end of file diff --git a/natiPorish/Ex2 - fylo-solution/styles.css b/natiPorish/Ex2 - fylo-solution/styles.css new file mode 100644 index 0000000..016467e --- /dev/null +++ b/natiPorish/Ex2 - fylo-solution/styles.css @@ -0,0 +1,382 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} + +body { + /* top: 50%; */ + -ms-overflow-style: none; + /* for Internet Explorer, Edge */ + scrollbar-width: none; + /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; + /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 23rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container, +.fylo-container2 { + background-color: var(--container-background-color); + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + gap: 2rem; +} + + + +.fylo-container2 { + border-radius: 15px; + padding: 2.5rem; + padding-right: 8.3rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-box { + display: flex; + flex-direction: row; + align-items: center; + gap: 0.5rem; + width: 33%; + cursor: pointer; +} + +.upload-file-txt { + color: var(--pale-blue); + font-size: 0.9rem; + font-weight: 700; + text-align: center; + white-space: nowrap; + /* Prevent text from wrapping */ +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + height: 7rem; + position: relative; + grid-area: b; +} + + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + filter: saturate(); + width: 0; + /* Initialize width to 0 */ + height: 0.8rem; + position: relative; + transition: width 0.5s ease; + /* Add transition property */ +} + +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} + +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 2.4rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 11.5rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: center; +} + +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + + .gb-left:after { + display: none; + } +} + +#uploaded-image-box { + display: none; + position: fixed; + right: 10%; + width: 7%; + transform: translate(0, -50%); + background-color: var(--container-background-color); + border-radius: 15px; + padding: 10px; + color: var(--white); + z-index: 999; + height: 20%; + text-align: center; + transition: opacity 0.5s, transform 0.5s; + opacity: 0; + transform: translateX(100%); + overflow-y: auto; +} + +#uploaded-image-box.show { + opacity: 1; + /* When the show class is added, make it visible */ + transform: translateX(0); + /* Slide it back to the center */ +} + +/* Add this style to make the delete icon */ +.delete-icon { + cursor: pointer; +} + + +/* Modals */ + +.modal { + display: none; + position: fixed; + z-index: 9999; + left: 0; + top: 0; + width: 100%; + height: 100%; + overflow: auto; + background-color: rgba(0, 0, 0, 0.7); + /* Adjust background color for warning effect */ +} + +.modal-content { + background-color: #fefefe; + margin: 15% auto; + padding: 5px 20px 20px 20px; + border: 1px solid #888; + width: 80%; + max-width: 400px; + border-radius: 10px; +} + +.modal-header { + display: flex; + justify-content: space-between; + align-items: center; +} + +.modal-header h2 { + margin: 0; +} + +.close { + color: #aaa; + font-size: 28px; + cursor: pointer; +} + +.close:hover, +.close:focus { + color: black; + text-decoration: none; + cursor: pointer; +} + +.modal-body { + text-align: center; +} + +.modal-body p { + margin-bottom: 20px; +} + +#understandBtn, +#understandBtn2 { + background-color: #245ae5; + color: white; + padding: 10px 20px; + border: none; + border-radius: 5px; + cursor: pointer; + font-size: 16px; + margin-top: 25px; +} + +#understandBtn:hover { + background-color: #4b7bf3; +} \ No newline at end of file diff --git a/noaGedo/images/bg-desktop.png b/noaGedo/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/noaGedo/images/bg-desktop.png differ diff --git a/noaGedo/images/bg-mobile.png b/noaGedo/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/noaGedo/images/bg-mobile.png differ diff --git a/noaGedo/images/camera.png b/noaGedo/images/camera.png new file mode 100644 index 0000000..8b27476 Binary files /dev/null and b/noaGedo/images/camera.png differ diff --git a/noaGedo/images/favicon-32x32.png b/noaGedo/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/noaGedo/images/favicon-32x32.png differ diff --git a/noaGedo/images/icon-document.svg b/noaGedo/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/noaGedo/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/noaGedo/images/icon-folder.svg b/noaGedo/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/noaGedo/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/noaGedo/images/icon-upload.svg b/noaGedo/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/noaGedo/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/noaGedo/images/logo.svg b/noaGedo/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/noaGedo/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/noaGedo/images/project-preview.png b/noaGedo/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/noaGedo/images/project-preview.png differ diff --git a/noaGedo/index.html b/noaGedo/index.html new file mode 100644 index 0000000..a8cd787 --- /dev/null +++ b/noaGedo/index.html @@ -0,0 +1,60 @@ + + + + + + + + + + + + + Fylo data storage component + + + +
      + +
      + +
      +
      + +
      +
      + +
      +
      + + + +
      + +
      +
      + +
      +

      You've used 0MB of your storage

      + +
      +
      +
      +
      +
      +
      +
      +

      + 0 MB + 100 MB +

      + +
      +

      100MB left

      +
      +
      +
      + + + + \ No newline at end of file diff --git a/noaGedo/script.js b/noaGedo/script.js new file mode 100644 index 0000000..1d0c92c --- /dev/null +++ b/noaGedo/script.js @@ -0,0 +1,45 @@ +let profilePic = document.getElementById("profile-pic"); +let inputFile = document.getElementById("input-file"); +let fileSizeSpan = document.getElementById("file-size"); +let progressBar = document.getElementById("gradient-bar"); +let leftMB = document.getElementById("gb-left"); + +function checkFileExtension(fileInput) { + var allowedExtensions = /(\.jpg|\.jpeg|\.png|\.gif)$/i; + if (!allowedExtensions.exec(fileInput.name)) { + alert('Error: Please upload an image file (jpg, jpeg, png, gif)'); + fileInput.value = ''; + return false; + } + return true; +} + +inputFile.onchange = function(){ + let file = inputFile.files[0] + if (!checkFileExtension(file)) { + return; + } + let fileSizeInMB = file.size/(1024*1024); + if (fileSizeInMB>100) + { + alert("You've passed the limit. Image size up to 100MB"); + inputFile.value = ''; + fileSizeSpan.innerHTML = "0MB" + } + else{ + profilePic.src = URL.createObjectURL(inputFile.files[0]); + fileSizeSpan.innerHTML = fileSizeInMB.toFixed(2)+"MB"; + left = 100 - fileSizeInMB ; + leftMB.innerHTML = left.toFixed(2); + const usagePercentage = fileSizeInMB*100;//כפול 100 כדי להראות איזושהי התקדמות + const progressBar = document.querySelector('.gradient-bar'); + progressBar.style.width = `${usagePercentage}%`; + } + +} + +document.getElementById('input-file').addEventListener('change', function() { + checkFileExtension(this.files[0]); +}); + + diff --git a/noaGedo/styles.css b/noaGedo/styles.css new file mode 100644 index 0000000..d6eb46f --- /dev/null +++ b/noaGedo/styles.css @@ -0,0 +1,244 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} +body { + -ms-overflow-style: none; /* for Internet Explorer, Edge */ + scrollbar-width: none; /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + height: 7rem; + position: relative; + grid-area: b; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: linear-gradient(to right, #7ed56f, #28b485); + border-radius: 50px; + filter: saturate(1); + height: 0.8rem; + position: relative; + width: 0; /* רוחב התחלתי של 0 */ + transition: width 5s; /* הוספת אנימציה */ +} +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left span { + color: var(--dark-blue); + font-size: 2rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left p { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + .gb-left:after { + display: none; + } +} + +input{ + display:none; +} + + diff --git a/noaVinkler/images/bg-desktop.png b/noaVinkler/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/noaVinkler/images/bg-desktop.png differ diff --git a/noaVinkler/images/bg-mobile.png b/noaVinkler/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/noaVinkler/images/bg-mobile.png differ diff --git a/noaVinkler/images/favicon-32x32.png b/noaVinkler/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/noaVinkler/images/favicon-32x32.png differ diff --git a/noaVinkler/images/icon-document.svg b/noaVinkler/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/noaVinkler/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/noaVinkler/images/icon-folder.svg b/noaVinkler/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/noaVinkler/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/noaVinkler/images/icon-upload.svg b/noaVinkler/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/noaVinkler/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/noaVinkler/images/logo.svg b/noaVinkler/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/noaVinkler/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/noaVinkler/images/project-preview.png b/noaVinkler/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/noaVinkler/images/project-preview.png differ diff --git a/noaVinkler/index.html b/noaVinkler/index.html new file mode 100644 index 0000000..a58da68 --- /dev/null +++ b/noaVinkler/index.html @@ -0,0 +1,62 @@ + + + + + + + + + + + + + Fylo data storage component + + + +
      + +
      + +
      +
      + +
      +
      + + +
      +
      + + +
      +
      +
      + +
      +

      You've used 0 MB of your storage

      + +
      +
      +
      +
      +
      +
      +
      +

      +

      + 0 MB + 100 MB +

      + +
      +

      100

      MB left +
      +
      +
      + + + + \ No newline at end of file diff --git a/noaVinkler/index2.js b/noaVinkler/index2.js new file mode 100644 index 0000000..9082a0f --- /dev/null +++ b/noaVinkler/index2.js @@ -0,0 +1,75 @@ +const totalSize = 10; +let usedSize = 0; +let percent; +let sizeLeft; +const totalSizeElement = document.getElementById('totalSize'); +const sizeLeftElement = document.getElementById('sizeLeft'); +const progressElement = document.getElementById('progress'); +const usedSizeElement = document.getElementById('sizeOccupied'); +const selectedFileElemnt=document.getElementById("selectedFile"); + +const shortenSizeNumber = (x) => { + return Number.parseFloat(x).toFixed(2); +}; + +const init = () => { + usedSize = Number(window.localStorage.getItem('usedSize')); + percent = 100 * (usedSize / totalSize) + 4; + sizeLeft = totalSize - usedSize; + totalSizeElement.innerText = totalSize + ' MB'; + sizeLeftElement.innerText = shortenSizeNumber(sizeLeft); + usedSizeElement.innerText = shortenSizeNumber(usedSize) + ' MB'; + progressElement.style.width = percent.toString(10) + '%'; +}; + +const addCurrentFileSize = (s) => { + s /= Math.pow(1024, 2); + if (usedSize + s < totalSize) { + usedSize += s; + sizeLeft = totalSize - usedSize; + percent = 100 * (usedSize / totalSize) - 4; + usedSizeElement.innerText = shortenSizeNumber(usedSize) + ' MB'; + sizeLeftElement.innerText = shortenSizeNumber(sizeLeft); + progressElement.style.width = percent.toString(10) + '%'; + progressElement.style.transition = 'width 0.5s ease 0.1s'; + } else { + alert('There is not enough space on the disk'); + } +}; + +const addFileRightBox=(name,size)=>{ + const span= document.createElement('span'); + span.innerText=name; + const removeButton=document.createElement('button'); + removeButton.innerText="X"; + removeButton.classList.add('removeButton'); + removeButton.addEventListener('click',()=>{ + span.remove(); + addCurrentFileSize(-size); + }); + span.appendChild(removeButton); + selectedFileElemnt.appendChild(span); +} + +const onFileInputChange = (e) => { + const fileName = e.value.split('\\').pop(); + const isImgFile = new RegExp('(.(gif|jpeg|jpg|png|svg))').test(fileName); + if (isImgFile) { + const file = e.files[0]; + addCurrentFileSize(file.size); + addFileRightBox(fileName,file.size); + } else { + alert('File Type Not Supported'); + } +}; + +const clear = document.getElementById('clear'); +clear.addEventListener('click', () => { + usedSize = 0; + init(); +}); + + +//main start + +init(); \ No newline at end of file diff --git a/noaVinkler/styles.css b/noaVinkler/styles.css new file mode 100644 index 0000000..df631ca --- /dev/null +++ b/noaVinkler/styles.css @@ -0,0 +1,266 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} +body { + -ms-overflow-style: none; /* for Internet Explorer, Edge */ + scrollbar-width: none; /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; + cursor: pointer; +} +#image-upload>input { + display: none; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + position: relative; + grid-area: b; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + filter: saturate(); + width: 74%; + height: 0.8rem; + position: relative; +} +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 2.4rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} +.gb-left.sizeLeft{ + font-size: large; +} + +.gb-left .gbLeft { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} +.selectedFile { + display: flex; + justify-content: space-between; + align-items: center; + border: 1px solid black; + padding: 5px; + margin-bottom: 5px; + width: 35%; + border-radius: 30px; + +} +.removeButton { + margin-right: auto; + cursor: pointer; + color: red; + border-radius: 50%; + background-color: var(--background-color); + display: table-row; + justify-content: space-between; + + +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + .gb-left:after { + display: none; + } +} diff --git a/nofarMahani/index.css b/nofarMahani/index.css new file mode 100644 index 0000000..1d1eadb --- /dev/null +++ b/nofarMahani/index.css @@ -0,0 +1,249 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} +body { + -ms-overflow-style: none; /* for Internet Explorer, Edge */ + scrollbar-width: none; /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + #up{ + width: 1.6rem; + height: 2rem; + display: flex; + align-items: center; + } + + + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + height: 7rem; + position: relative; + grid-area: b; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ + + +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + filter: saturate(); + width: 0%; + height: 0.8rem; + position: relative; + transition: width 0.5s ease-out; +} +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 2.4rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +#span2 { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + .gb-left:after { + display: none; + } +} diff --git a/nofarMahani/index.html b/nofarMahani/index.html new file mode 100644 index 0000000..b2dd41f --- /dev/null +++ b/nofarMahani/index.html @@ -0,0 +1,60 @@ + + + + + + + + + + + + + Fylo data storage component + + + +
      + +
      + +
      +
      + +
      +
      + +
      + + +
      +
      + +
      +

      You've used 0 MB of your storage

      + +
      +
      +
      +
      +
      +
      +
      +

      + 0 MB + 10 MB +

      + +
      +

      10 MB left

      +
      +
      +
      + + + + + \ No newline at end of file diff --git a/nofarMahani/script.js b/nofarMahani/script.js new file mode 100644 index 0000000..8642295 --- /dev/null +++ b/nofarMahani/script.js @@ -0,0 +1,38 @@ +const input = document.getElementById('file'); +const progress=document.querySelector('.gradient-bar'); +var total=10; +var totalpercent=0; +var sum=0; +function info(){ + const pattern1=/jpg$/; + const pattern2=/jpeg$/; + const pattern3=/gif$/; + const pattern4=/png$/; + var files=input.files; + console.log(files[0].type); + if((!pattern1.test(files[0].type)) && (!pattern2.test(files[0].type)) && (!pattern3.test(files[0].type)) && (!pattern4.test(files[0].type))) + { + alert('File format isn’t supported') + return; + } + var size=files[0].size; + var fileSize=(size/(1024*1024)).toFixed(2); + if(fileSize>10) + { + alert('There is not enough space on the disk'); + return; + } + sum=(sum+ parseFloat(fileSize)); + total=total-fileSize; + if(total<0) + { + alert('There is not enough space on the disk'); + return; + } + document.getElementById('span1').innerHTML=total.toFixed(2); + document.getElementById('element2').innerHTML=sum.toFixed(2); + let percent=(fileSize/10)*100; + totalpercent+=percent; + progress.style.width = `${totalpercent}%` + +} diff --git a/ofekWorcel/Enhancing the Fylo project.pdf b/ofekWorcel/Enhancing the Fylo project.pdf new file mode 100644 index 0000000..20ebd2f Binary files /dev/null and b/ofekWorcel/Enhancing the Fylo project.pdf differ diff --git a/ofekWorcel/images/bg-desktop.png b/ofekWorcel/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/ofekWorcel/images/bg-desktop.png differ diff --git a/ofekWorcel/images/bg-mobile.png b/ofekWorcel/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/ofekWorcel/images/bg-mobile.png differ diff --git a/ofekWorcel/images/favicon-32x32.png b/ofekWorcel/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/ofekWorcel/images/favicon-32x32.png differ diff --git a/ofekWorcel/images/icon-document.svg b/ofekWorcel/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/ofekWorcel/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ofekWorcel/images/icon-folder.svg b/ofekWorcel/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/ofekWorcel/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ofekWorcel/images/icon-upload.svg b/ofekWorcel/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/ofekWorcel/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ofekWorcel/images/logo.svg b/ofekWorcel/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/ofekWorcel/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ofekWorcel/images/project-preview.png b/ofekWorcel/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/ofekWorcel/images/project-preview.png differ diff --git a/ofekWorcel/index.html b/ofekWorcel/index.html new file mode 100644 index 0000000..7d02506 --- /dev/null +++ b/ofekWorcel/index.html @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + Fylo data storage component + + + +
      + +
      + +
      +
      + +
      +
      + + + +
      +
      + + + +
      +
      +
      + +
      +

      You've used of your storage

      + +
      +
      +
      +
      +
      +
      +
      +
      +

      + +

      +

      + +

      +
      +
      + + +
      + +
      +
      +
      + + + + \ No newline at end of file diff --git a/ofekWorcel/scripts.js b/ofekWorcel/scripts.js new file mode 100644 index 0000000..dc41457 --- /dev/null +++ b/ofekWorcel/scripts.js @@ -0,0 +1,103 @@ +var minMemory = "0"; +var maxMemory = "10 MB" +var currentDiskSpace = 0; +var diskSize = 10 * 1024 * 1024; // 10 MB for testing +var currentPercent = 0; + +document.addEventListener("DOMContentLoaded", function() { + document.getElementById("used-memory").innerHTML = ((currentDiskSpace / 1024 / 1024) + "").substring(0,5) + " MB"; + document.getElementById("min-memory").innerHTML = minMemory; + document.getElementById("max-memory").innerHTML = maxMemory; + document.getElementById("memory-left").innerHTML = "

      " + (parseInt(maxMemory) - currentDiskSpace) + " MB left

      "; +}); + + +function handleFiles(files) { + var allowedFormats = /(\.jpg|\.jpeg|\.gif|\.png)$/i; + var filePreviewContainer = document.getElementById('filePreviewContainer'); + var filePreviews = {}; + var totalSize = 0; + + + function createFilePreview(file, fileId) { + + var fileName = file.name; + var fileExtension = fileName.slice(((fileName.lastIndexOf(".") - 1) >>> 0) + 2); + var nameWithoutExtension = fileName.replace(/\.[^/.]+$/, ''); + var truncatedName = nameWithoutExtension.length > 7 ? nameWithoutExtension.substring(0, 7) + '...' : nameWithoutExtension; + + + var filePreview = document.createElement('div'); + filePreview.className = 'file-preview'; + filePreview.textContent = truncatedName + '.' + fileExtension; + filePreview.id = 'preview-' + fileId; + + + var deleteIndicator = document.createElement('span'); + deleteIndicator.className = 'delete-indicator'; + deleteIndicator.textContent = 'x'; + + + filePreview.appendChild(deleteIndicator); + + + filePreviewContainer.appendChild(filePreview); + + + deleteIndicator.addEventListener('click', function() { + filePreviewContainer.removeChild(filePreview); + delete filePreviews[fileId]; + document.getElementById('fileInput').value = ''; + currentDiskSpace -= file.size; + move(); + if(currentDiskSpace == 0){ + document.getElementById("memory-left").innerHTML = "

      " + parseInt(maxMemory) + " MB left

      "; + } + }); + + filePreviews[fileId] = filePreview; + } + + Array.from(files).forEach(function(file) { + if (!allowedFormats.test(file.name)) { + alert('File format isn\'t supported.\nNote: Allowed file formats: .jpeg, .jpg, .gif, .png'); + return; + } + totalSize += file.size; + }); + + + if (currentDiskSpace + totalSize > diskSize) { + alert('There is not enough space on the disk.'); + } else { + Array.from(files).forEach(function(file, index) { + var fileId = 'file-' + Date.now() + '-' + index; + + createFilePreview(file, fileId); + currentDiskSpace += file.size; + move(); + }); + }; +} + + if(document.getElementById('fileInput') != null){ + document.getElementById('fileInput').addEventListener('change', function(e) { + handleFiles(e.target.files); + }); + } +function updateHTML(elementName, value){ + document.getElementById(elementName).innerHTML = value; +} +var i = 0; +function move() { + var elem = document.getElementById("progress-bar"); + currentPercent = currentDiskSpace/diskSize*100; + + if(currentPercent == 0){ + currentPercent = 0.5; + } + document.getElementById("used-memory").innerHTML = ((currentDiskSpace / 1024 / 1024) + "").substring(0,5) + " MB"; + elem.style.width = currentPercent + "%"; + document.getElementById("memory-left").innerHTML = "

      " + (parseFloat(maxMemory) - currentDiskSpace /1024 /1024).toFixed(1) + " MB left

      "; +} + diff --git a/ofekWorcel/styles.css b/ofekWorcel/styles.css new file mode 100644 index 0000000..26797c8 --- /dev/null +++ b/ofekWorcel/styles.css @@ -0,0 +1,277 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} +body { + -ms-overflow-style: none; /* for Internet Explorer, Edge */ + scrollbar-width: none; /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + min-height: 10rem; + position: relative; + grid-area: b; + display: flex; + flex-direction: column; + justify-content: space-between; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; + flex-direction: column; +} + +#scales{ + display: flex; + flex-direction: row; + align-items: center; + flex-wrap: wrap; + width: 100%; + justify-content: space-between; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + filter: saturate(); + min-width: 0.7rem; + width: 0%; + height: 0.8rem; + position: relative; + transition: width 1s ease; +} +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + width: 100%; + align-items: center; + height: 1rem; +} +.dot { + position: absolute; + background-color: var(--white); + height: 0.7rem; + width: 0.7rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 2.4rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 10.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + .gb-left:after { + display: none; + } + + +} + +.file-preview { + display: inline-block; + margin: 10px; + padding: 10px; + border: 1px solid #ddd; + position: relative; + border-radius: 25px; + background: darkblue; + color: white; +} + +.delete-indicator { + position: absolute; + top: -10px; + right: -10px; + cursor: pointer; + background-color: white; + color: black; + border-radius: 50%; + padding: 0 5px; + align-content: center; +} diff --git a/omerAmsalem/functions.js b/omerAmsalem/functions.js new file mode 100644 index 0000000..3cd3c5f --- /dev/null +++ b/omerAmsalem/functions.js @@ -0,0 +1,86 @@ +const TotalSizeMb = 100; +var files = []; + +function handleFileSelection(event) { + const fileList = event.target.files; + for (let i = 0; i < fileList.length; i++) { + const file = fileList[i]; + const allowedExtensions = ['.jpg', '.jpeg', '.gif', '.png']; + + if (!allowedExtensions.some(ext => file.name.toLowerCase().endsWith(ext))) { + alert("Error: File format is not supported."); + console.error('Error: File format is not supported.'); + continue; + } + + if (checkFileSize(file)) { + files.push(file); + if(fileSizeCalculator(file)<0){ + alert("Error: Files size is too large. Max size is 100MB."); + console.error('Error: Files size is too large. Max size is 100MB.'); + files.pop(); + return 0; + } + displayFile(file); + } + } +} + +function chooseFile() { + console.log('chooseFile'); + const fileInput = document.createElement('input'); + fileInput.type = 'file'; + fileInput.accept = ''; + fileInput.addEventListener('change', handleFileSelection); + fileInput.click(); +} + +function checkFileSize(file) { + console.log("check total size"); + const fileSizeInMbs = Math.ceil(file.size / (1024 ** 2)); + + console.log('File size:', fileSizeInMbs + ' Mb'); + if (fileSizeInMbs > TotalSizeMb) { + alert("Error: File size is too large. Max size is 100MB."); + console.error('Error: File size is too large. Max size is 100MB.'); + return false; + } + return true; +} + +function fileSizeCalculator(file) { + if(checkFileSize(file)){ + const totalUsedSpaceMb = Math.ceil(files.reduce((acc, curr) => acc + curr.size / (1024 ** 2), 0)); + const MbLeft = TotalSizeMb - totalUsedSpaceMb; + console.log('MbLeft:', MbLeft); + const StorageUsed = document.getElementById('StorageUsed'); + const BottomStorageUsed = document.getElementById('BottomStorageUsed'); + StorageUsed.innerHTML = 100-MbLeft; + BottomStorageUsed.innerHTML = 100-MbLeft; + document.querySelector('.gradient-bar').style.width = StorageUsed.innerHTML+'%'; + const StorageLeft = document.getElementById('StorageLeft'); + StorageLeft.innerHTML = MbLeft; + return MbLeft; + } + else { + return 0; + } +} + + +function displayFile(file) { + const fileList = document.getElementById('fileList'); + const listItem = document.createElement('li'); + listItem.innerHTML = `${file.name} `; + fileList.appendChild(listItem); +} + +function deleteFile(fileName) { + files = files.filter(file => file.name !== fileName); + const fileList = document.getElementById('fileList'); + fileList.innerHTML = ''; + files.forEach(file => displayFile(file)); +} + + + diff --git a/omerAmsalem/images/bg-desktop.png b/omerAmsalem/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/omerAmsalem/images/bg-desktop.png differ diff --git a/omerAmsalem/images/bg-mobile.png b/omerAmsalem/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/omerAmsalem/images/bg-mobile.png differ diff --git a/omerAmsalem/images/favicon-32x32.png b/omerAmsalem/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/omerAmsalem/images/favicon-32x32.png differ diff --git a/omerAmsalem/images/icon-document.svg b/omerAmsalem/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/omerAmsalem/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/omerAmsalem/images/icon-folder.svg b/omerAmsalem/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/omerAmsalem/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/omerAmsalem/images/icon-upload.svg b/omerAmsalem/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/omerAmsalem/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/omerAmsalem/images/logo.svg b/omerAmsalem/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/omerAmsalem/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/omerAmsalem/images/project-preview.png b/omerAmsalem/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/omerAmsalem/images/project-preview.png differ diff --git a/omerAmsalem/index.html b/omerAmsalem/index.html new file mode 100644 index 0000000..fafc9a1 --- /dev/null +++ b/omerAmsalem/index.html @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + Fylo data storage component + + + +
      + +
      + +
      +
      + + + +
      +
      + +
      +
      + +
      +
      +
      + +
      +

      Chosen Files:

      +
        +
        + +
        +

        You've used 0 MB of your storage

        + +
        +
        +
        +
        +
        +
        +
        +

        +
        0 MB
        + 100 MB +

        + +
        +

        100 MB left

        +
        +
        +
        + + + \ No newline at end of file diff --git a/omerAmsalem/styles.css b/omerAmsalem/styles.css new file mode 100644 index 0000000..1b79ddc --- /dev/null +++ b/omerAmsalem/styles.css @@ -0,0 +1,252 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} +body { + -ms-overflow-style: none; /* for Internet Explorer, Edge */ + scrollbar-width: none; /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} +.text{ + color: white; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + height: 7rem; + position: relative; + grid-area: b; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + filter: saturate(); + width: 0%; + height: 0.8rem; + position: relative; +} +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 2.4rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + +/** File List Box **/ +#fileListContainer { + background-color: var(--container-background-color); + border-radius: 15px; + padding: 1.4rem 2.5rem; + margin-top: 20px; +} + +#fileList { + list-style: none; + padding: 0; + margin: 0; +} + +#fileList li { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 8px; + font-size: 14px; + color: var(--pale-blue); +} + +.deleteButton { + background-color: var(--dark-blue); + color: var(--pale-blue); + border: none; + border-radius: 50%; + cursor: pointer; + padding: 5px; + font-size: 12px; + line-height: 1; +} + + diff --git a/omerElias/assets/js/upload.js b/omerElias/assets/js/upload.js new file mode 100644 index 0000000..2bf9a8a --- /dev/null +++ b/omerElias/assets/js/upload.js @@ -0,0 +1,21 @@ +class UploadImage{ + + constructor() { + this.maxSize = 185; + this.currentSize = 0; + this.isFull = false; + } + + isFull(){ + return this.maxSize > this.currentSize; + } + + upload_one_image(){ + alert('123'); + } + + + + + +} diff --git a/omerElias/images/bg-desktop.png b/omerElias/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/omerElias/images/bg-desktop.png differ diff --git a/omerElias/images/bg-mobile.png b/omerElias/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/omerElias/images/bg-mobile.png differ diff --git a/omerElias/images/favicon-32x32.png b/omerElias/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/omerElias/images/favicon-32x32.png differ diff --git a/omerElias/images/icon-document.svg b/omerElias/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/omerElias/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/omerElias/images/icon-folder.svg b/omerElias/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/omerElias/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/omerElias/images/icon-upload.svg b/omerElias/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/omerElias/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/omerElias/images/logo.svg b/omerElias/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/omerElias/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/omerElias/images/project-preview.png b/omerElias/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/omerElias/images/project-preview.png differ diff --git a/omerElias/index.html b/omerElias/index.html new file mode 100644 index 0000000..52798ac --- /dev/null +++ b/omerElias/index.html @@ -0,0 +1,110 @@ + + + + + + + + + + + + + Fylo data storage component + + + + +
        + +
        + +
        + + + + + + +
        +
        + +
        +

        You've used MB of your storage

        + +
        +
        +
        +
        +
        +
        +
        +

        + 0 MB + 800 MB +

        + +
        +

        800

        MB left

        +
        +
        +
        + + + + + \ No newline at end of file diff --git a/omerElias/styles.css b/omerElias/styles.css new file mode 100644 index 0000000..26baf28 --- /dev/null +++ b/omerElias/styles.css @@ -0,0 +1,245 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient( + 90deg, + rgba(255, 163, 153, 1) 36%, + rgba(255, 77, 151, 1) 100% + ); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} +body { + -ms-overflow-style: none; /* for Internet Explorer, Edge */ + scrollbar-width: none; /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + height: 7rem; + position: relative; + grid-area: b; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + filter: saturate(); + width: 0%; + height: 0.8rem; + position: relative; +} +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 2.4rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + .gb-left:after { + display: none; + } +} +input[type="file"] { + display: none; +} diff --git a/orenLevi/Enhancing the Fylo project.pdf b/orenLevi/Enhancing the Fylo project.pdf new file mode 100644 index 0000000..20ebd2f Binary files /dev/null and b/orenLevi/Enhancing the Fylo project.pdf differ diff --git a/orenLevi/images/bg-desktop.png b/orenLevi/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/orenLevi/images/bg-desktop.png differ diff --git a/orenLevi/images/bg-mobile.png b/orenLevi/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/orenLevi/images/bg-mobile.png differ diff --git a/orenLevi/images/favicon-32x32.png b/orenLevi/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/orenLevi/images/favicon-32x32.png differ diff --git a/orenLevi/images/icon-document.svg b/orenLevi/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/orenLevi/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/orenLevi/images/icon-folder.svg b/orenLevi/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/orenLevi/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/orenLevi/images/icon-upload.svg b/orenLevi/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/orenLevi/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/orenLevi/images/logo.svg b/orenLevi/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/orenLevi/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/orenLevi/images/project-preview.png b/orenLevi/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/orenLevi/images/project-preview.png differ diff --git a/orenLevi/index.html b/orenLevi/index.html new file mode 100644 index 0000000..b67225d --- /dev/null +++ b/orenLevi/index.html @@ -0,0 +1,66 @@ + + + + + + + + + + + + + Fylo data storage component + + + + +
        + +
        + +
        +
        + +
        +
        + +
        +
        + +
        +
        +
        + +
        +

        You've used 0 MB of your storage

        +
        + +
        + +
        +
        +
        +
        +
        +
        +
        +

        + 0 MB + 10 MB +

        + +
        +

        10 GB left

        +
        +
        +
        + + + \ No newline at end of file diff --git a/orenLevi/project2.js b/orenLevi/project2.js new file mode 100644 index 0000000..412427f --- /dev/null +++ b/orenLevi/project2.js @@ -0,0 +1,75 @@ +const uploadButton = document.getElementById('uploadFile'); + +document.addEventListener('DOMContentLoaded', function() { + const documantButton = document.getElementById('documentButton'); + const gradientBar = document.getElementById('gradientBar'); + const sizeText = document.getElementById('sizeText'); + const remaningSize = document.getElementById('remaningSize'); + const fileNamesContainer = document.getElementById('fileNamesContainer'); + const restMem = document.getElementById('restMem'); + getLocalStorage(); +}); + +let totalSizeInMB = 0; + +function getLocalStorage() { // the function get the file how save in the local storage + var tmpdata = JSON.parse(localStorage.getItem('fileStorage')); + if (tmpdata) + createFileButton(tmpdata, tmpdata.sizeInMB); +} + +function updateTotalSize(sizeInMB) { //the function calculate the gradientBar and update + totalSizeInMB += sizeInMB; + let percentage = (totalSizeInMB / 10) * 100; + gradientBar.style.width = percentage + '%'; + remaningSize.textContent = (10 - totalSizeInMB).toFixed(2) + ' MB'; + restMem.textContent = totalSizeInMB.toFixed(2) + ' MB'; +} + +function removeFile(fileSizeInMB) { //if i click on the button i create its delete + totalSizeInMB -= fileSizeInMB; + let percentage = (totalSizeInMB / 10) * 100; + gradientBar.style.width = percentage + '%'; + remaningSize.textContent = (10 - totalSizeInMB).toFixed(2) + ' MB'; + restMem.textContent = totalSizeInMB.toFixed(2) + ' MB'; +} + +function createFileButton(file, fileSizeInMB) { // the funcion create new file button + let fileName = file.name.split('.').slice(0, -1).join('.'); + let fileNameElement = document.createElement('button'); + fileNameElement.classList.add('file-button'); + fileNameElement.textContent = fileName; + fileNameElement.addEventListener('click', function() { + fileNamesContainer.removeChild(fileNameElement); + removeFile(fileSizeInMB); + localStorage.removeItem('fileStorage'); + }); + fileNamesContainer.appendChild(fileNameElement); + updateTotalSize(fileSizeInMB); +} + +function importData() { //the function open the file explorer and call the other function + let input = document.createElement('input'); + input.type = 'file'; + input.multiple = true; + input.accept = '.png, .gif, .jpeg, .jpg'; + input.onchange = _ => { + let files = Array.from(input.files); + files.forEach(function(file) { + let fileSizeInMB = file.size / (1024 * 1024); + if (fileSizeInMB > 10) { + alert('File size exceeds the 10 MB limit: ' + file.name); + return; + } + let fileData = { + name: file.name, + sizeInMB: fileSizeInMB + }; + localStorage.setItem('fileStorage', JSON.stringify(fileData)); + createFileButton(file, fileSizeInMB); + }); + }; + input.click(); +} + +uploadButton.addEventListener('click', importData); diff --git a/orenLevi/styles.css b/orenLevi/styles.css new file mode 100644 index 0000000..de4e4ea --- /dev/null +++ b/orenLevi/styles.css @@ -0,0 +1,266 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} +body { + -ms-overflow-style: none; /* for Internet Explorer, Edge */ + scrollbar-width: none; /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + height: 7rem; + position: relative; + grid-area: b; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: linear-gradient(to right, red, yellow, green); + background: var(--gradient); + width: 0; + border-radius: 50px; + filter: saturate(); + height: 0.8rem; + transition: width 0.3s ease; + position: relative; +} +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 2.4rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + .gb-left:after { + display: none; + } +} +.imageDocumentButton{ + background-color: transparent; + border: none; +} +.imageUpladFile{ + background-color: transparent; + border: none; + cursor: pointer; +} +.Imagefile{ + background-color: transparent; + border: none; +} +.file-button { + display: inline-block; + margin-right: 10px; + margin-bottom: 10px; + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; + color: white; + border: none; + cursor: pointer; +} + + + diff --git a/oriAbulafia/doc.js b/oriAbulafia/doc.js new file mode 100644 index 0000000..7728de2 --- /dev/null +++ b/oriAbulafia/doc.js @@ -0,0 +1,64 @@ +document.addEventListener('DOMContentLoaded', function() { + const fileInput = document.getElementById('fileInput'); + const openFileExplorer = document.getElementById('openFileExplorer'); + var totalspace=10240; + var i=0; + var x=0; + openFileExplorer.addEventListener('click', function() { + fileInput.click(); + }); + + fileInput.addEventListener('change', function() { + const file = this.files[0]; + if (file) { + const fileName = file.name.toLowerCase(); + if (/\.(jpg|jpeg|gif|png)$/.test(fileName)) { + document.getElementById('Error').innerText = ''; + x=0; + } else { + document.getElementById('Error').innerText = 'File format isn’t supported'; + x=1; + } + } + }); + document.getElementById('fileInput').addEventListener('change', function() { + if(x==0){ + + var file = this.files[0]; + var fileSize = file.size; + var FilesizeKB = (fileSize / 1024).toFixed(2); + + if ((totalspace-=FilesizeKB)<0) + { + document.getElementById('Error').innerText = 'NO SPACE!!!'; + totalspace+=FilesizeKB; + } + + else + { + var container = document.createElement('filebox'); + container.className = 'storage-container'; + document.body.appendChild(container); + container.style.top = '100px'; + container.style.left = '70px'; + container.style.color = 'white'; + container.style.marginLeft= '10px'; + + var per= totalspace/10240; + var formper= per.toFixed(2); + var endper= (100-(100*formper)); + document.querySelector('.gradient-bar').style.width = endper+'%'; + var mbleft= totalspace/1024; + var mbend= mbleft.toFixed(1); + var mbused= 10-mbend; + var mbusedend= mbused.toFixed(1); + document.getElementById('mbtext').textContent= mbend.toString(); + document.getElementById('usedmb').textContent= mbusedend.toString()+' MB'; + var filename = file.name; + container.innerHTML += filename; + } + } + + }); + +}); diff --git a/oriAbulafia/images/bg-desktop.png b/oriAbulafia/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/oriAbulafia/images/bg-desktop.png differ diff --git a/oriAbulafia/images/bg-mobile.png b/oriAbulafia/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/oriAbulafia/images/bg-mobile.png differ diff --git a/oriAbulafia/images/favicon-32x32.png b/oriAbulafia/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/oriAbulafia/images/favicon-32x32.png differ diff --git a/oriAbulafia/images/icon-document.svg b/oriAbulafia/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/oriAbulafia/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oriAbulafia/images/icon-folder.svg b/oriAbulafia/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/oriAbulafia/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oriAbulafia/images/icon-upload.svg b/oriAbulafia/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/oriAbulafia/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oriAbulafia/images/logo.svg b/oriAbulafia/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/oriAbulafia/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oriAbulafia/images/project-preview.png b/oriAbulafia/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/oriAbulafia/images/project-preview.png differ diff --git a/oriAbulafia/index.html b/oriAbulafia/index.html new file mode 100644 index 0000000..4d0a282 --- /dev/null +++ b/oriAbulafia/index.html @@ -0,0 +1,57 @@ + + + + + + + + + + + + + Fylo data storage component + + + + +
        +
        + +
        + +
        + +

        Upload image

        + + +
        +
        + +
        +

        You've used 0 MB of your storage

        + +
        +
        +
        +
        +
        +
        +
        +

        + 0 MB + 10 MB +

        + +
        +

        10

        MB left +
        +
        + +
        + + + \ No newline at end of file diff --git a/oriAbulafia/styles.css b/oriAbulafia/styles.css new file mode 100644 index 0000000..c759ddc --- /dev/null +++ b/oriAbulafia/styles.css @@ -0,0 +1,251 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} +body { + -ms-overflow-style: none; /* for Internet Explorer, Edge */ + scrollbar-width: none; /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + height: 7rem; + position: relative; + grid-area: b; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + filter: saturate(); + width: 0%; + height: 0.8rem; + position: relative; +} + +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 2.4rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + .gb-left:after { + display: none; + } + +} +.ErrorMsg +{ + text-align: center; + align-items: center; + color: red; + padding-top: 20px; + + +} + + diff --git a/oriJoseph/Enhancing the Fylo project.pdf b/oriJoseph/Enhancing the Fylo project.pdf new file mode 100644 index 0000000..20ebd2f Binary files /dev/null and b/oriJoseph/Enhancing the Fylo project.pdf differ diff --git a/oriJoseph/images/bg-desktop.png b/oriJoseph/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/oriJoseph/images/bg-desktop.png differ diff --git a/oriJoseph/images/bg-mobile.png b/oriJoseph/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/oriJoseph/images/bg-mobile.png differ diff --git a/oriJoseph/images/favicon-32x32.png b/oriJoseph/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/oriJoseph/images/favicon-32x32.png differ diff --git a/oriJoseph/images/icon-document.svg b/oriJoseph/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/oriJoseph/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oriJoseph/images/icon-folder.svg b/oriJoseph/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/oriJoseph/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oriJoseph/images/icon-upload.svg b/oriJoseph/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/oriJoseph/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oriJoseph/images/logo.svg b/oriJoseph/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/oriJoseph/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oriJoseph/images/project-preview.png b/oriJoseph/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/oriJoseph/images/project-preview.png differ diff --git a/oriJoseph/index.html b/oriJoseph/index.html new file mode 100644 index 0000000..024c224 --- /dev/null +++ b/oriJoseph/index.html @@ -0,0 +1,63 @@ + + + + + + + + + + + + + Fylo data storage component + + + +
        + +
        + +
        +
        + +
        +
        + +
        +
        + + +
        +
        +
        + +
        +

        You've used 0 MB of your storage

        + +
        +
        +
        +
        +
        +
        +
        + + +

        + 0 MB + 100 MB +

        + +
        +

        100

        MB left +
        +

        +
        +
        + + + + \ No newline at end of file diff --git a/oriJoseph/script.js b/oriJoseph/script.js new file mode 100644 index 0000000..68dc0e5 --- /dev/null +++ b/oriJoseph/script.js @@ -0,0 +1,70 @@ +const totalSize = 10; + +let usedSize = 0; +let percent; +let sizeLeft; + +const usedSizeElement = document.getElementById('sizeOccupied'); +const totalSizeElement = document.getElementById('totalSize'); +const sizeLeftElement = document.getElementById('sizeLeft'); +const progressElement = document.getElementById('progress'); +const selectedFileP = document.getElementById('selectedFile'); + +const shortenSizeNumber = (x) => { + return Number.parseFloat(x).toFixed(2); +}; + +const init = () => { + usedSize = Number(window.localStorage.getItem('usedSize')); + percent = 100 * (usedSize / totalSize) + 4; + sizeLeft = totalSize - usedSize; + totalSizeElement.innerText = totalSize + ' MB'; + sizeLeftElement.innerText = shortenSizeNumber(sizeLeft); + usedSizeElement.innerText = shortenSizeNumber(usedSize) + ' MB'; + progressElement.style.width = percent.toString(1) + '%'; +}; + +const addSize = (size) => { + size /= Math.pow(1024, 2); + if (usedSize + size < totalSize) { + usedSize += size; + sizeLeft = totalSize - usedSize; + percent = 100 * (usedSize / totalSize) - 4; + usedSizeElement.innerText = shortenSizeNumber(usedSize) + ' MB'; + sizeLeftElement.innerText = shortenSizeNumber(sizeLeft); + progressElement.style.width = percent.toString(10) + '%'; + progressElement.style.transition = 'width 0.5s ease 0.1s'; + } else { + alert('There is not enough space on the disk'); + } +}; + +const addFileName = (name, size) => { + const span = document.createElement('span'); + span.innerText = `${name}`; + const removeButton = document.createElement('button'); + removeButton.innerText = 'x'; + removeButton.addEventListener('click', () => { + span.remove(); + addSize(-size); + }); + span.appendChild(removeButton); + span.style.margin = '5px'; + span.style.backgroundColor = 'lightgray'; + + selectedFileP.appendChild(span); +}; + +const onFileInputChange = (e) => { + const fileName = e.value.split('\\').pop(); + const isImgFile = new RegExp('(.(gif|jpeg|jpg|png|svg|ico))').test(fileName); + if (isImgFile) { + const file = e.files[0]; + addSize(file.size); + addFileName(fileName, file.size); + } else { + alert('File Type Not Supported'); + } +}; + +init(); diff --git a/oriJoseph/styles.css b/oriJoseph/styles.css new file mode 100644 index 0000000..a07dcd4 --- /dev/null +++ b/oriJoseph/styles.css @@ -0,0 +1,242 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} +body { + -ms-overflow-style: none; /* for Internet Explorer, Edge */ + scrollbar-width: none; /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; + cursor: pointer; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; + +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; + cursor: pointer; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + position: relative; + grid-area: b; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + filter: saturate(); + width: 0%; + height: 0.8rem; + position: relative; +} +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 2.4rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + .gb-left:after { + display: none; + } +} + + diff --git a/rayNaftali/images/bg-desktop.png b/rayNaftali/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/rayNaftali/images/bg-desktop.png differ diff --git a/rayNaftali/images/bg-mobile.png b/rayNaftali/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/rayNaftali/images/bg-mobile.png differ diff --git a/rayNaftali/images/favicon-32x32.png b/rayNaftali/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/rayNaftali/images/favicon-32x32.png differ diff --git a/rayNaftali/images/icon-document.svg b/rayNaftali/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/rayNaftali/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/rayNaftali/images/icon-folder.svg b/rayNaftali/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/rayNaftali/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/rayNaftali/images/icon-upload.svg b/rayNaftali/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/rayNaftali/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/rayNaftali/images/logo.svg b/rayNaftali/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/rayNaftali/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/rayNaftali/images/project-preview.png b/rayNaftali/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/rayNaftali/images/project-preview.png differ diff --git a/rayNaftali/index.html b/rayNaftali/index.html new file mode 100644 index 0000000..6236648 --- /dev/null +++ b/rayNaftali/index.html @@ -0,0 +1,68 @@ + + + + + + + + + + + + + Fylo data storage component + + + +
        + +
        + +
        +
        + +
        +
        + +
        +
        + +
        + +
        + +
        + +
        +
        + +
        + +
          +

          You've used 0 MB of your storage

          + +
          +
          +
          +
          +
          +
          +
          +

          + 0 MB + 10 MB +

          + +
          +

          10 MB left

          +
          +
          +
          + + + + + + + + diff --git a/rayNaftali/main.js b/rayNaftali/main.js new file mode 100644 index 0000000..b6a81d1 --- /dev/null +++ b/rayNaftali/main.js @@ -0,0 +1,116 @@ +var totalDiskSpace = 10; // in MB +var currentSpace = 0; +var files = {}; // Store file names and their sizes +var allowedFormats = ['.jpg', '.jpeg', '.gif', '.png']; // Allowed file formats + +function openFileExplorer() { + var input = document.createElement('input'); + input.type = 'file'; + input.multiple = true; + + input.addEventListener('change', function(event) { + var newFiles = event.target.files; + for (var i = 0; i < newFiles.length; i++) { + var file = newFiles[i]; + var fileName = file.name; + var fileSizeMB = file.size / (1024 * 1024); + + var fileExtension = fileName.split('.').pop().toLowerCase(); + if (!allowedFormats.includes('.' + fileExtension)) { + alert('File format isn’t supported: ' + fileName); + continue; + } + + if (!files[fileName]) { + if ((currentSpace + fileSizeMB) <= totalDiskSpace) { + files[fileName] = fileSizeMB; + updateAvailableSpace(fileSizeMB); + displayFileName(fileName); + } else { + alert('File size exceeds the available space.'); + break; + } + } else { + alert('File "' + fileName + '" is already uploaded.'); + } + } + + // Save files localStorage after processing all files + saveStateToLocalStorage(); + }); + + input.click(); +} + +function updateAvailableSpace(fileSizeMB) { + currentSpace += fileSizeMB; + currentSpace = Math.min(currentSpace, totalDiskSpace); + + var usedStorageElement = document.getElementById('usedStorage'); + var remainingSpaceElement = document.getElementById('remainingSpace'); + + usedStorageElement.textContent = currentSpace.toFixed(0) + ' MB'; + remainingSpaceElement.textContent = (totalDiskSpace - currentSpace).toFixed(0); + + var gradientBar = document.querySelector('.gradient-bar'); + var usedPercentage = (currentSpace / totalDiskSpace) * 100; + + if ((totalDiskSpace - currentSpace).toFixed(0) == 0) { + gradientBar.style.width = 100 + '%'; + } else { + gradientBar.style.width = usedPercentage + '%'; + } +} + +function saveStateToLocalStorage() { + localStorage.setItem('files', JSON.stringify(files)); +} + +function loadStateFromLocalStorage() { + var savedFiles = localStorage.getItem('files'); + if (savedFiles !== null) { + files = JSON.parse(savedFiles); + for (var fileName in files) { + if (files.hasOwnProperty(fileName)) { + displayFileName(fileName); + } + } + } + + // Calculate current space based on loaded files + currentSpace = Object.values(files).reduce((acc, fileSize) => acc + fileSize, 0); + updateAvailableSpace(0); // Update UI without adding any file sizes +} + +function displayFileName(fileName) { + var listItem = document.createElement('li'); + var fileNameElement = document.createElement('span'); + fileNameElement.textContent = fileName; + fileNameElement.style.color = 'red'; + + var removeText = document.createElement('span'); + removeText.textContent = ' X'; + removeText.style.cursor = 'pointer'; + removeText.style.color = 'red'; + removeText.addEventListener('click', function() { + listItem.remove(); + var fileSizeMB = files[fileName]; + delete files[fileName]; + updateAvailableSpace(-fileSizeMB); + saveStateToLocalStorage(); // Update localStorage after removing file + }); + + listItem.appendChild(fileNameElement); + listItem.appendChild(removeText); + + document.getElementById('fileList').appendChild(listItem); +} + +function clearLocalStorage() { + localStorage.clear(); + location.reload(); // Reload the page to reflect the cleared storage +} + +window.onload = function() { + loadStateFromLocalStorage(); +}; diff --git a/rayNaftali/styles.css b/rayNaftali/styles.css new file mode 100644 index 0000000..7fe8d76 --- /dev/null +++ b/rayNaftali/styles.css @@ -0,0 +1,282 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} +body { + -ms-overflow-style: none; /* for Internet Explorer, Edge */ + scrollbar-width: none; /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); + display: flex; + flex-direction: column; + justify-content: flex-end; + position: relative; + padding-top: 0%; + +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + /* height: 7rem; */ /* Remove the fixed height */ + position: relative; + grid-area: b; + + display: inline-flex; + flex-direction: column; /* Align children vertically */ +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + filter: saturate(); + width: 0; /* Updated width start at 0 */ + height: 0.8rem; + position: relative; + transition: width 0.5s ease; +} + +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ + +.gb-left p { + color: var(--dark-blue); + font-size: 1.5rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-flex; + +} +#remainingSpace{ + color: var(--dark-blue); + font-size: 1.5rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} +#fileList { + list-style: none; + padding: 0; + margin: 0; + font-weight: 700; + +} + +#fileList li { + display: inline; /* Display list items as inline-block */ + margin-right: 10px; /* Add some space between list items */ + + + font-size: 0.7rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; + + +} + +@keyframes updateSpace { + 0% { transform: scale(1); } + 50% { transform: scale(1.1); } + 100% { transform: scale(1); } +} +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + overflow: auto; /* or overflow: hidden; */ + + } + + .gb-left:after { + display: none; + } + +} + \ No newline at end of file diff --git a/roniTwito/fylo-solution-main/.DS_Store b/roniTwito/fylo-solution-main/.DS_Store new file mode 100644 index 0000000..879f82d Binary files /dev/null and b/roniTwito/fylo-solution-main/.DS_Store differ diff --git a/roniTwito/fylo-solution-main/Enhancing the Fylo project.pdf b/roniTwito/fylo-solution-main/Enhancing the Fylo project.pdf new file mode 100644 index 0000000..20ebd2f Binary files /dev/null and b/roniTwito/fylo-solution-main/Enhancing the Fylo project.pdf differ diff --git a/roniTwito/fylo-solution-main/LICENSE b/roniTwito/fylo-solution-main/LICENSE new file mode 100644 index 0000000..7521f14 --- /dev/null +++ b/roniTwito/fylo-solution-main/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Ekaterine (Catherine) Mitagvaria + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/roniTwito/fylo-solution-main/README.md b/roniTwito/fylo-solution-main/README.md new file mode 100644 index 0000000..58ff98e --- /dev/null +++ b/roniTwito/fylo-solution-main/README.md @@ -0,0 +1,50 @@ +![Fylo data storage component](https://github.com/catherineisonline/fylo-data-storage-component-frontendmentor/blob/main/images/project-preview.png?raw=true) + + +

          Fylo data storage component

          + +
          + +[Live](https://catherineisonline.github.io/fylo-data-storage-component-frontendmentor/) +| [Solution](https://www.frontendmentor.io/solutions/fylo-data-storage-component-gpaJOs4EP) +| [Challenge](https://www.frontendmentor.io/challenges/fylo-data-storage-component-1dZPRbV5n) + +Solution for a challenge from [frontendmentor.io](https://www.frontendmentor.io/) +
          + + + +## About The Project + +This component has some interesting CSS challenges in the design. If you're looking to test your CSS skills, this will be a great project for you! +The main challenge is to build out this data storage component and get it looking as close to the design as possible. +You can use any tools you like to help you complete the challenge. So if you've got something you'd like to practice, feel free to give it a go. + +Your users should be able to: +1. View the optimal layout depending on their device's screen size

          + +I do not have access to the Figma sketch so the design is not pixel perfect.

          + + + + +## Built with + +- Semantic HTML5 markup +- CSS custom properties +- Grid +- Desktop-first workflow + +## What I learned + +This project helped me to practice some grid as it's a little difficult for me to make the grid responsive. My goal is to make grid change from 1 row to 2 rows without using media query however I lack enough experience in this. I decided to finish this project as it is and deepen my knowledge of the grid in another project that I plan to make, specifically - a photography portfolio website. + + +## Useful resources + +1. [Figma](https://www.figma.com/) - Paste your design image to check the size of containers, width, etc. +2. [Perfect Pixel](https://chrome.google.com/webstore/detail/perfectpixel-by-welldonec/dkaagdgjmgdmbnecmcefdhjekcoceebi) - Awesome Chrome extension that helps you to match the pixels of the provided design. + +## Acknowledgments + +A big thank you to anyone providing feedback on my [solution](https://www.frontendmentor.io/solutions/fylo-data-storage-component-gpaJOs4EP). It definitely helps to find new ways to code and find easier solutions! diff --git a/roniTwito/fylo-solution-main/images/bg-desktop.png b/roniTwito/fylo-solution-main/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/roniTwito/fylo-solution-main/images/bg-desktop.png differ diff --git a/roniTwito/fylo-solution-main/images/bg-mobile.png b/roniTwito/fylo-solution-main/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/roniTwito/fylo-solution-main/images/bg-mobile.png differ diff --git a/roniTwito/fylo-solution-main/images/favicon-32x32.png b/roniTwito/fylo-solution-main/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/roniTwito/fylo-solution-main/images/favicon-32x32.png differ diff --git a/roniTwito/fylo-solution-main/images/icon-document.svg b/roniTwito/fylo-solution-main/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/roniTwito/fylo-solution-main/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/roniTwito/fylo-solution-main/images/icon-folder.svg b/roniTwito/fylo-solution-main/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/roniTwito/fylo-solution-main/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/roniTwito/fylo-solution-main/images/icon-upload.svg b/roniTwito/fylo-solution-main/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/roniTwito/fylo-solution-main/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/roniTwito/fylo-solution-main/images/logo.svg b/roniTwito/fylo-solution-main/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/roniTwito/fylo-solution-main/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/roniTwito/fylo-solution-main/images/project-preview.png b/roniTwito/fylo-solution-main/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/roniTwito/fylo-solution-main/images/project-preview.png differ diff --git a/roniTwito/fylo-solution-main/index.html b/roniTwito/fylo-solution-main/index.html new file mode 100644 index 0000000..c6f088b --- /dev/null +++ b/roniTwito/fylo-solution-main/index.html @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + Fylo data storage component + + + + +
          + +
          + +
          + + + + +
          + + +
          + +
          +

          You've used 0 MB of your storage

          + +
          +
          +
          +
          +
          +
          +
          +

          + 0 MB + 999 MB +

          + +
          +

          999

          MB left

          +
          +
          +
          + + + + \ No newline at end of file diff --git a/roniTwito/fylo-solution-main/styles.css b/roniTwito/fylo-solution-main/styles.css new file mode 100644 index 0000000..b7583ec --- /dev/null +++ b/roniTwito/fylo-solution-main/styles.css @@ -0,0 +1,246 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} +body { + -ms-overflow-style: none; /* for Internet Explorer, Edge */ + scrollbar-width: none; /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.5rem; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + height: 7rem; + position: relative; + grid-area: b; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + filter: saturate(); + width: 0%; + height: 0.8rem; + position: relative; +} +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 2.4rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + /* Hide the file input */ + #fileInput { + display: none; +} +/* Style the label to look like the icon */ +.icon-img { + cursor: pointer; +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + .gb-left:after { + display: none; + } +} diff --git a/rotmeNissim/Assignment_1_DevClub-main/.vscode/launch.json b/rotmeNissim/Assignment_1_DevClub-main/.vscode/launch.json new file mode 100644 index 0000000..08e4fed --- /dev/null +++ b/rotmeNissim/Assignment_1_DevClub-main/.vscode/launch.json @@ -0,0 +1,16 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + + { + "type": "chrome", + "request": "launch", + "name": "Launch Chrome against localhost", + "url": "http://localhost:8080", + "webRoot": "${workspaceFolder}" + } + ] +} \ No newline at end of file diff --git a/rotmeNissim/Assignment_1_DevClub-main/Enhancing the Fylo project.pdf b/rotmeNissim/Assignment_1_DevClub-main/Enhancing the Fylo project.pdf new file mode 100644 index 0000000..20ebd2f Binary files /dev/null and b/rotmeNissim/Assignment_1_DevClub-main/Enhancing the Fylo project.pdf differ diff --git a/rotmeNissim/Assignment_1_DevClub-main/LICENSE b/rotmeNissim/Assignment_1_DevClub-main/LICENSE new file mode 100644 index 0000000..7521f14 --- /dev/null +++ b/rotmeNissim/Assignment_1_DevClub-main/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Ekaterine (Catherine) Mitagvaria + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/rotmeNissim/Assignment_1_DevClub-main/README.md b/rotmeNissim/Assignment_1_DevClub-main/README.md new file mode 100644 index 0000000..58ff98e --- /dev/null +++ b/rotmeNissim/Assignment_1_DevClub-main/README.md @@ -0,0 +1,50 @@ +![Fylo data storage component](https://github.com/catherineisonline/fylo-data-storage-component-frontendmentor/blob/main/images/project-preview.png?raw=true) + + +

          Fylo data storage component

          + +
          + +[Live](https://catherineisonline.github.io/fylo-data-storage-component-frontendmentor/) +| [Solution](https://www.frontendmentor.io/solutions/fylo-data-storage-component-gpaJOs4EP) +| [Challenge](https://www.frontendmentor.io/challenges/fylo-data-storage-component-1dZPRbV5n) + +Solution for a challenge from [frontendmentor.io](https://www.frontendmentor.io/) +
          + + + +## About The Project + +This component has some interesting CSS challenges in the design. If you're looking to test your CSS skills, this will be a great project for you! +The main challenge is to build out this data storage component and get it looking as close to the design as possible. +You can use any tools you like to help you complete the challenge. So if you've got something you'd like to practice, feel free to give it a go. + +Your users should be able to: +1. View the optimal layout depending on their device's screen size

          + +I do not have access to the Figma sketch so the design is not pixel perfect.

          + + + + +## Built with + +- Semantic HTML5 markup +- CSS custom properties +- Grid +- Desktop-first workflow + +## What I learned + +This project helped me to practice some grid as it's a little difficult for me to make the grid responsive. My goal is to make grid change from 1 row to 2 rows without using media query however I lack enough experience in this. I decided to finish this project as it is and deepen my knowledge of the grid in another project that I plan to make, specifically - a photography portfolio website. + + +## Useful resources + +1. [Figma](https://www.figma.com/) - Paste your design image to check the size of containers, width, etc. +2. [Perfect Pixel](https://chrome.google.com/webstore/detail/perfectpixel-by-welldonec/dkaagdgjmgdmbnecmcefdhjekcoceebi) - Awesome Chrome extension that helps you to match the pixels of the provided design. + +## Acknowledgments + +A big thank you to anyone providing feedback on my [solution](https://www.frontendmentor.io/solutions/fylo-data-storage-component-gpaJOs4EP). It definitely helps to find new ways to code and find easier solutions! diff --git a/rotmeNissim/Assignment_1_DevClub-main/images/bg-desktop.png b/rotmeNissim/Assignment_1_DevClub-main/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/rotmeNissim/Assignment_1_DevClub-main/images/bg-desktop.png differ diff --git a/rotmeNissim/Assignment_1_DevClub-main/images/bg-mobile.png b/rotmeNissim/Assignment_1_DevClub-main/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/rotmeNissim/Assignment_1_DevClub-main/images/bg-mobile.png differ diff --git a/rotmeNissim/Assignment_1_DevClub-main/images/favicon-32x32.png b/rotmeNissim/Assignment_1_DevClub-main/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/rotmeNissim/Assignment_1_DevClub-main/images/favicon-32x32.png differ diff --git a/rotmeNissim/Assignment_1_DevClub-main/images/icon-document.svg b/rotmeNissim/Assignment_1_DevClub-main/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/rotmeNissim/Assignment_1_DevClub-main/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/rotmeNissim/Assignment_1_DevClub-main/images/icon-folder.svg b/rotmeNissim/Assignment_1_DevClub-main/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/rotmeNissim/Assignment_1_DevClub-main/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/rotmeNissim/Assignment_1_DevClub-main/images/icon-upload.svg b/rotmeNissim/Assignment_1_DevClub-main/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/rotmeNissim/Assignment_1_DevClub-main/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/rotmeNissim/Assignment_1_DevClub-main/images/logo.svg b/rotmeNissim/Assignment_1_DevClub-main/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/rotmeNissim/Assignment_1_DevClub-main/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/rotmeNissim/Assignment_1_DevClub-main/images/project-preview.png b/rotmeNissim/Assignment_1_DevClub-main/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/rotmeNissim/Assignment_1_DevClub-main/images/project-preview.png differ diff --git a/rotmeNissim/Assignment_1_DevClub-main/index.html b/rotmeNissim/Assignment_1_DevClub-main/index.html new file mode 100644 index 0000000..0dc878b --- /dev/null +++ b/rotmeNissim/Assignment_1_DevClub-main/index.html @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + Fylo data storage component + + + +
          + +
          + +
          +
          + +
          +
          + +
          +
          +
          + +
          +
          +
          +
          + +
          +

          You've used 815 GB of your storage

          + +
          +
          +
          +
          +
          +
          +
          +

          + 0 MB + 100 MB +

          + +
          +

          185 MB left

          +
          +
          +
          +

          Uploaded Images:

          +
          +
            +
            +
            +
            + + + + \ No newline at end of file diff --git a/rotmeNissim/Assignment_1_DevClub-main/script.js b/rotmeNissim/Assignment_1_DevClub-main/script.js new file mode 100644 index 0000000..7fc93ab --- /dev/null +++ b/rotmeNissim/Assignment_1_DevClub-main/script.js @@ -0,0 +1,175 @@ +//formatting bytes to MB/KB/GB for UI. +function formatSizeUnits(fileSize) { + + if (fileSize >=1073741824 ) { fileSize = (fileSize / 1073741824).toFixed(2) + "GB"; } + else if(fileSize >= 1048576) { fileSize = (fileSize / 1048576).toFixed(2) + "MB"; } + else if (fileSize >= 1024) {fileSize = (fileSize / 1024).toFixed(2) + "KB"; } + else if (fileSize > 1) { fileSize = fileSize + "bytes"; } + else if (fileSize == 1) { fileSize = fileSize + "byte"; } + else {fileSize = "0 bytes"; } + return fileSize; + + } +//shrinking the file name for UI. +function shrinkFileName(fileName) { + if (fileName <= 7) + { + return fileName; + } + return fileName.slice(0,7) + "..."; + } +function updateLocalStorage() { + + const storedFiles = JSON.parse(window.localStorage.getItem("selectedFiles")) || []; //holding the selected file as JSON object + console.log(storedFiles); //self-checking + // As I was struggling with the CSS I tried to dynamically resize my container (lines 28-32) + const fileCount = storedFiles.length; + const containerHeight = 7 + fileCount * 1.25; + const containerWidth = Math.max(24,12 + fileCount * 2); + document.querySelector(".uploaded-images").style.height = `${containerHeight}rem`; + document.querySelector(".uploaded-images").style.width = `${containerWidth}rem`; + //creating the list items (uploaded images) + const currentUploaded = document.getElementById("localStorage-current"); + currentUploaded.innerHTML = ""; + storedFiles.forEach(file => { + const li = document.createElement("li"); + li.classList.add("file-box"); + //image details to be shown inside the container - for UI (creating and implementing) + const fileName = document.createElement("span"); + fileName.textContent = shrinkFileName(file.name); + const fileSize = document.createElement("span"); + fileSize.textContent = formatSizeUnits(file.size); + + //creating the removal option and handling the removing scenario + const removeButton = document.createElement("button"); + removeButton.textContent = "X"; + removeButton.addEventListener("click", function () { + removeFile(file); + updateLocalStorage(); //updating the localStorage upon removal + }); + + //populating new elements and inserting new elements into the list of files + li.appendChild(fileName); + li.appendChild(fileSize); + li.appendChild(removeButton); + currentUploaded.appendChild(li); +}); + } +//removing files option +function removeFile(fileToRemove) { + + console.log("File to remove:", fileToRemove); //self-checking + + const storedFiles = JSON.parse(window.localStorage.getItem("selectedFiles")) || []; //holding the array of items upon removal + console.log("Stored files:", storedFiles); //self-checking + const updatedFiles = storedFiles.filter(file => file.name !== fileToRemove.name); //holding the array of items after removal + console.log("Updated files:", updatedFiles); //self-checking + + const totalSize = calcTotalSize(updatedFiles); //keeping track of the size (for progress-bar) + console.log("Total new size:", totalSize); //self-checking + updateProgressBar(totalSize); //updating progress bar after removal + + window.localStorage.setItem("selectedFiles", JSON.stringify(updatedFiles)); //updating the local storage with the new set of items +} +//function that sums the size in bytes for each selected file +function calcTotalSize(files) { + let totalSize = 0; + for (const file of files) { + totalSize += parseFloat(file.size); + } + console.log("Total size (in bytes):", totalSize); + return totalSize; +} +//function that initializes the progress bar to avoid the default display. +function initProgressBar() { + const storedFiles = JSON.parse(localStorage.getItem("selectedFiles")) || [] ; + const totalSize = calcTotalSize(storedFiles); + + updateProgressBar(totalSize); +} +function updateProgressBar(totalSize) { + const progressBar = document.querySelector(".gradient-bar"); //setting the progress bar as variant according to its class in HTML file - to change width + //setting both the text and the space used as variants so I can later use the dynamic data for display. + const text = document.getElementById("mb-left-num"); + const usage = document.getElementById("storage-used"); + + const maxStorage = 100 * 1024 * 1024; //setting the max storage to 100MB. + //handling the case where there's not enough memory left + if (totalSize > maxStorage) { + alert("Not enough memory, please remove file/s and try again"); + } + //validations + let percentage; + if (totalSize > 0) { + percentage = (totalSize / maxStorage) * 100; + } else { + percentage = 0; + } + //self-checking + console.log("Total size (in bytes):", totalSize); + console.log("Max storage (in bytes):", maxStorage); + console.log("Percentage:", percentage); + progressBar.style.width = percentage + "%"; //changing the width of the progress bar according to variant. + //validations + let formattedSize; + if (totalSize > 0) { + formattedSize = formatSizeUnits(totalSize); + } else { + formattedSize = "100 MB"; + } + //changing the static text that was previously set to a dynamic one based on our results. + usage.textContent = formattedSize; + text.textContent = formatSizeUnits(maxStorage - totalSize) + ' LEFT'; +} +document.addEventListener("DOMContentLoaded", function() { +var fileSelector = document.getElementById("fileSelector"); +initProgressBar(); //initializing progress bar to 0 and 100MB. + + +fileSelector.addEventListener("change", (event) => { + const files = event.target.files; + //allowed formats validation + + const allowedFormats = ["image/png", "image/jpeg", "image/jpg"]; +for (const file of files) { + if (!allowedFormats.includes(file.type)) { + alert("Invalid file type! Please select a Supported file type (JPG/PNG/JPEG"); + fileSelector.value = null; + return; + } +} + //creating an array of files; The array holds the name and the size of the file that is selected. + if (files.length > 0) { + const selectedFiles = JSON.parse(window.localStorage.getItem("selectedFiles")) || []; //wether there are already files or not + + const newFiles = Array.from(files).map(file => ({ + name: file.name, + size:file.size, + })); + selectedFiles.push(...newFiles); //this assures that even if there are multiple choices of a single file, it'll be inserted to the array. + //calculating the total size and updating the progress bar accordingly + const totalSize = calcTotalSize(selectedFiles); + console.log(totalSize); + updateProgressBar(totalSize); + + window.localStorage.setItem("selectedFiles", JSON.stringify(selectedFiles)); + + updateLocalStorage(); //calling the function to update accordingly when adding a new file/files + } + //handling the case where user wants to remove a file/files + document.getElementById("localStorage-current").addEventListener("click",function(e) { + if (e.target.tagName === "BUTTON" && e.target.textContent === "X") { + const fileName = e.target.dataset.fileName; + const fileToRemove = JSON.parse(window.localStorage.getItem("selectedFiles")).find(file => file.name === fileName); + if (fileToRemove) { + removeFile(fileToRemove); + updateLocalStorage(); + } + + } +}); + +}); + +updateLocalStorage(); +}); \ No newline at end of file diff --git a/rotmeNissim/Assignment_1_DevClub-main/styles.css b/rotmeNissim/Assignment_1_DevClub-main/styles.css new file mode 100644 index 0000000..345fcd8 --- /dev/null +++ b/rotmeNissim/Assignment_1_DevClub-main/styles.css @@ -0,0 +1,325 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} +body { + -ms-overflow-style: none; /* for Internet Explorer, Edge */ + scrollbar-width: none; /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + height: 7rem; + position: relative; + grid-area: b; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + filter: saturate(); + width: 0%; + height: 0.8rem; + position: relative; +} +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 1rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 13%; + top: -18%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} +.icon-img { + display: inline-block; +} +.icon-img .input-div { + position: relative; + display: inline-block; +} +.icon-img input[type="file"] { + display:block; + opacity:0; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + cursor: pointer; + z-index: 2; +} +#upload.icon-img { + position: relative; + z-index: 1; + cursor: pointer; +} + +.file-box { +position: relative; +border-radius: 5px; +padding: 25px; +margin-bottom: 10px; +background-color: var(--dark-blue); +list-style: none; +overflow: hidden; +color:var(--pale-blue); +max-width: 65%; +max-height: 20%; +padding-left: 10px; +width: calc(25%-20px); +box-sizing: border-box; +} + +.uploaded-images { + border-radius: 15px; + padding: 0.5% 10%; + height: 7rem; + width: 100%; + position: relative; + background-color: var(--container-background-color); + +} +.uploaded-pics { + + border-radius: 8px; + display:flex; + justify-content: flex-start; + flex-wrap: wrap; + flex-direction: row; + overflow-x:auto; + padding:0; + list-style-type: none; +} +.uploaded-pics ul { + list-style-type:none; + display: flex; + gap:10px; + flex-direction: row; +} + +.file-box span { + margin-right: 4px; + max-width: 100px; +} + +.file-box button { + position: absolute; + top: 1px; + right: 1px; + background-color: white; + color: black; + border: none; + padding: 3px 6px; + border-radius: 5px; + cursor: pointer; + +} +.file-box button:hover { + background-color: var(--grayish-blue); +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + .gb-left:after { + display: none; + } +} diff --git a/shirYahav/images/bg-desktop.png b/shirYahav/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/shirYahav/images/bg-desktop.png differ diff --git a/shirYahav/images/bg-mobile.png b/shirYahav/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/shirYahav/images/bg-mobile.png differ diff --git a/shirYahav/images/favicon-32x32.png b/shirYahav/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/shirYahav/images/favicon-32x32.png differ diff --git a/shirYahav/images/icon-document.svg b/shirYahav/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/shirYahav/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/shirYahav/images/icon-folder.svg b/shirYahav/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/shirYahav/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/shirYahav/images/icon-upload.svg b/shirYahav/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/shirYahav/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/shirYahav/images/logo.svg b/shirYahav/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/shirYahav/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/shirYahav/images/project-preview.png b/shirYahav/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/shirYahav/images/project-preview.png differ diff --git a/shirYahav/index.html b/shirYahav/index.html new file mode 100644 index 0000000..5ebbac6 --- /dev/null +++ b/shirYahav/index.html @@ -0,0 +1,63 @@ + + + + + + + + + + + + + Fylo data storage component + + + +
            + +
            + +
            +
            + +
            + + + + +
            + +
            +
            + Upload File +
            + +
            +

            You've used 0 of your storage

            + +
            +
            +
            +
            +
            +
            +
            +

            + 0 MB + 10 MB +

            + +
            +

            10 MB left

            +
            +
            +
            + + + + \ No newline at end of file diff --git a/shirYahav/index.js b/shirYahav/index.js new file mode 100644 index 0000000..b8229b0 --- /dev/null +++ b/shirYahav/index.js @@ -0,0 +1,82 @@ + +const fileInput = document.getElementById('fileInput'); +const fileSizeDisplay = document.getElementById('fileSizeDisplay'); +const MBLeftElement = document.getElementById('MBLeft'); + +//Progress Bar +function moveBar(size) { + const element = document.getElementById("gradient-bar-id"); + let currentWidth = parseFloat(element.style.width) || 3; + let targetWidth = size * 10; + let step = (targetWidth - currentWidth) / 100; + + let id = setInterval(frame, 5); + function frame() { + currentWidth+= step; + element.style.width = currentWidth + "%"; + if(currentWidth >= targetWidth) { + clearInterval(id); + } + } +} + +//Get total size from local storage +function getTotalFileSize() { + //gets size from local storage + //parseFloat is used to convert strings into floating-point numbers + return parseFloat(localStorage.getItem('totalFileSize')) || 0; +} + +//Update total size in local storage +function updateTotalFileSize(newSize, MBLeft) { + localStorage.setItem('totalFileSize', newSize); + localStorage.setItem('MBLeft', MBLeft); +} + +//Update progress bar based on total file size +function updateProgressBar(totalSize, previousSize) { + moveBar(totalSize, previousSize); + fileSizeDisplay.textContent = totalSize === 0 ? totalSize.toFixed(0) : totalSize.toFixed(2); + MBLeftElement.firstChild.textContent = (10 - totalSize).toFixed(2); +} + + +//Added event listener to my button +document.getElementById('upload-file').addEventListener('click', function(){ + //stimulating a user clicking the button, when the click event of the file input is triggered, it opens the file explorer + fileInput.click(); +}); + + +//this row listens for a 'change' which occurs when a user selects a file using the file explorer +fileInput.addEventListener('change', function(event) { + //event.target.files contains an array-like object that contains the file + const selectedFile = event.target.files[0]; + + if(!selectedFile) { + fileSizeDisplay.textContent = ''; + return; + } + + const fileSize = (selectedFile.size / (1024 * 1024)); + let totalSize = getTotalFileSize(); + if(totalSize + fileSize > 10) { + alert ("There is not enough space on the disk"); + return; + } + + totalSize += fileSize; + fileSizeDisplay.textContent = `${totalSize.toFixed(2)} MB`; + + updateProgressBar(totalSize); + updateTotalFileSize(totalSize, MBLeft); + moveBar(totalSize); + +}); + +updateProgressBar(getTotalFileSize()); + + + + + diff --git a/shirYahav/styles.css b/shirYahav/styles.css new file mode 100644 index 0000000..5584bfa --- /dev/null +++ b/shirYahav/styles.css @@ -0,0 +1,251 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} +body { + -ms-overflow-style: none; /* for Internet Explorer, Edge */ + scrollbar-width: none; /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + height: 7rem; + position: relative; + grid-area: b; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + filter: saturate(); + width: 4%; + height: 0.8rem; + position: relative; +} +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 2rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + .gb-left:after { + display: none; + } +} + +.upload-file-button { + background-color: transparent; + border: none; + cursor: pointer; +} + +.uploadFileText { + color: white; + font-size: 9px; + margin-left: 71px; + margin-top: -29px; +} diff --git a/talLevi/fylo-solution-main/LICENSE b/talLevi/fylo-solution-main/LICENSE new file mode 100644 index 0000000..7521f14 --- /dev/null +++ b/talLevi/fylo-solution-main/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Ekaterine (Catherine) Mitagvaria + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/talLevi/fylo-solution-main/README.md b/talLevi/fylo-solution-main/README.md new file mode 100644 index 0000000..58ff98e --- /dev/null +++ b/talLevi/fylo-solution-main/README.md @@ -0,0 +1,50 @@ +![Fylo data storage component](https://github.com/catherineisonline/fylo-data-storage-component-frontendmentor/blob/main/images/project-preview.png?raw=true) + + +

            Fylo data storage component

            + +
            + +[Live](https://catherineisonline.github.io/fylo-data-storage-component-frontendmentor/) +| [Solution](https://www.frontendmentor.io/solutions/fylo-data-storage-component-gpaJOs4EP) +| [Challenge](https://www.frontendmentor.io/challenges/fylo-data-storage-component-1dZPRbV5n) + +Solution for a challenge from [frontendmentor.io](https://www.frontendmentor.io/) +
            + + + +## About The Project + +This component has some interesting CSS challenges in the design. If you're looking to test your CSS skills, this will be a great project for you! +The main challenge is to build out this data storage component and get it looking as close to the design as possible. +You can use any tools you like to help you complete the challenge. So if you've got something you'd like to practice, feel free to give it a go. + +Your users should be able to: +1. View the optimal layout depending on their device's screen size

            + +I do not have access to the Figma sketch so the design is not pixel perfect.

            + + + + +## Built with + +- Semantic HTML5 markup +- CSS custom properties +- Grid +- Desktop-first workflow + +## What I learned + +This project helped me to practice some grid as it's a little difficult for me to make the grid responsive. My goal is to make grid change from 1 row to 2 rows without using media query however I lack enough experience in this. I decided to finish this project as it is and deepen my knowledge of the grid in another project that I plan to make, specifically - a photography portfolio website. + + +## Useful resources + +1. [Figma](https://www.figma.com/) - Paste your design image to check the size of containers, width, etc. +2. [Perfect Pixel](https://chrome.google.com/webstore/detail/perfectpixel-by-welldonec/dkaagdgjmgdmbnecmcefdhjekcoceebi) - Awesome Chrome extension that helps you to match the pixels of the provided design. + +## Acknowledgments + +A big thank you to anyone providing feedback on my [solution](https://www.frontendmentor.io/solutions/fylo-data-storage-component-gpaJOs4EP). It definitely helps to find new ways to code and find easier solutions! diff --git a/talLevi/fylo-solution-main/images/bg-desktop.png b/talLevi/fylo-solution-main/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/talLevi/fylo-solution-main/images/bg-desktop.png differ diff --git a/talLevi/fylo-solution-main/images/bg-mobile.png b/talLevi/fylo-solution-main/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/talLevi/fylo-solution-main/images/bg-mobile.png differ diff --git a/talLevi/fylo-solution-main/images/favicon-32x32.png b/talLevi/fylo-solution-main/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/talLevi/fylo-solution-main/images/favicon-32x32.png differ diff --git a/talLevi/fylo-solution-main/images/icon-document.svg b/talLevi/fylo-solution-main/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/talLevi/fylo-solution-main/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/talLevi/fylo-solution-main/images/icon-folder.svg b/talLevi/fylo-solution-main/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/talLevi/fylo-solution-main/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/talLevi/fylo-solution-main/images/icon-upload.svg b/talLevi/fylo-solution-main/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/talLevi/fylo-solution-main/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/talLevi/fylo-solution-main/images/logo.svg b/talLevi/fylo-solution-main/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/talLevi/fylo-solution-main/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/talLevi/fylo-solution-main/images/project-preview.png b/talLevi/fylo-solution-main/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/talLevi/fylo-solution-main/images/project-preview.png differ diff --git a/talLevi/fylo-solution-main/index.html b/talLevi/fylo-solution-main/index.html new file mode 100644 index 0000000..b4ad319 --- /dev/null +++ b/talLevi/fylo-solution-main/index.html @@ -0,0 +1,60 @@ + + + + + + + + + + + + + Fylo data storage component + + + +
            + +
            + +
            +
            + +
            +
            + +
            +
            + +
            +
            +
            + +
            +

            You've used 0 MB of your storage

            + +
            +
            +
            +
            +
            +
            +
            +

            + 0 MB + 100 MB +

            + +
            +

            100> MB left

            +
            +
            +
            + + + + \ No newline at end of file diff --git a/talLevi/fylo-solution-main/script.js b/talLevi/fylo-solution-main/script.js new file mode 100644 index 0000000..afefe60 --- /dev/null +++ b/talLevi/fylo-solution-main/script.js @@ -0,0 +1,81 @@ +document.addEventListener('DOMContentLoaded', function () { + initializeStorage(); +}); +document.getElementById('upload').addEventListener('click', uploadFile); + +function initializeStorage() { + // Check if the storage is already initialized + if (!localStorage.getItem('totalStorage')) { + // If not, set the initial storage to 100 MB + localStorage.setItem('totalStorage', 100); + } + // Initialize used storage to 0 + localStorage.setItem('usedStorage', 0); + + updateStorageUI(); +} + +function updateStorageOnUpload (fileSize) { + var totalStorage = parseInt(localStorage.getItem('totalStorage')); //this makes char to int + var usedStorage = parseInt(localStorage.getItem('usedStorage')); + + totalStorage -= fileSize; + usedStorage += Math.ceil(fileSize); + + localStorage.setItem('totalStorage' , totalStorage); + localStorage.setItem('usedStorage' , usedStorage); + + updateStorageUI(); +} + +function updateStorageUI() { + var totalStorage = parseInt(localStorage.getItem('totalStorage')); //this makes char to int + var usedStorage = parseInt(localStorage.getItem('usedStorage')); + + document.getElementById('remainingStorage').textContent = totalStorage; + document.getElementById('usedStorage').textContent = usedStorage; + + var remainingStorage = totalStorage - usedStorage; + var percentageUsed = (usedStorage) ; + var progressBar = document.getElementById('progressBar'); + progressBar.style.width = percentageUsed + '%'; + +} + +function checkFileFormat () { // this function checks the file format + var fileInput = document.getElementById('fileInput'); + var selectedFiles = fileInput.files; + + for (var i=0; itotalStorage) +{ + alert('There is not enough space on the disk') + return; +} +updateStorageOnUpload(fileSize); +} +function uploadFile() { + + checkFileFormat(); + + +} + + + \ No newline at end of file diff --git a/talLevi/fylo-solution-main/styles.css b/talLevi/fylo-solution-main/styles.css new file mode 100644 index 0000000..97fd52a --- /dev/null +++ b/talLevi/fylo-solution-main/styles.css @@ -0,0 +1,239 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} +body { + -ms-overflow-style: none; /* for Internet Explorer, Edge */ + scrollbar-width: none; /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + height: 7rem; + position: relative; + grid-area: b; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + filter: saturate(); + width: 74%; + height: 0.8rem; + position: relative; + transition: width 0.5s ease-in-out; +} +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 2.4rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + .gb-left:after { + display: none; + } +} diff --git a/yoavFridman/images/bg-desktop.png b/yoavFridman/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/yoavFridman/images/bg-desktop.png differ diff --git a/yoavFridman/images/bg-mobile.png b/yoavFridman/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/yoavFridman/images/bg-mobile.png differ diff --git a/yoavFridman/images/favicon-32x32.png b/yoavFridman/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/yoavFridman/images/favicon-32x32.png differ diff --git a/yoavFridman/images/icon-document.svg b/yoavFridman/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/yoavFridman/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yoavFridman/images/icon-folder.svg b/yoavFridman/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/yoavFridman/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yoavFridman/images/icon-upload.svg b/yoavFridman/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/yoavFridman/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yoavFridman/images/logo.svg b/yoavFridman/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/yoavFridman/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yoavFridman/images/project-preview.png b/yoavFridman/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/yoavFridman/images/project-preview.png differ diff --git a/yoavFridman/index.html b/yoavFridman/index.html new file mode 100644 index 0000000..3e13e97 --- /dev/null +++ b/yoavFridman/index.html @@ -0,0 +1,59 @@ + + + + + + + + + + + + + Fylo data storage component + + + + + +
            +
            + +
            +
            + +
            +
            + +
            +
            + + +
            +
            +
            + + +
            +

            You've used 0 GB of your storage

            + +
            +
            +
            +
            +
            +
            +
            +

            + 0 GB + 999 GB +

            + +
            +

            999 GB left

            +
            +
            +
            + + + \ No newline at end of file diff --git a/yoavFridman/index.js b/yoavFridman/index.js new file mode 100644 index 0000000..ccb3840 --- /dev/null +++ b/yoavFridman/index.js @@ -0,0 +1,35 @@ +var storageUsed = 0; +var maxStorage = 999; + +function openUploadFileDialog() { + var fileUpload = document.getElementById('fileUpload'); + fileUpload.click(); + fileUpload.addEventListener('change', handleNewFile); +} + +function handleNewFile() { + var file = fileUpload.files[0]; + if (file) { + var allowedExtensions = ['jpg', 'jpeg', 'gif', 'png']; + var fileExtension = file.name.split('.').pop().toLowerCase(); + + if (allowedExtensions.indexOf(fileExtension) === -1) { + alert('File format is not supported.'); + file.value = ''; + return; + } + else { + console.log('Uploaded file: ' + file.name); + var fileSize = parseInt(file.size / (1024 * 1024 * 1024)); // in GB + storageUsed += fileSize; + maxStorage -= fileSize; + changeStats(); + } + } +} + +function changeStats() { + document.getElementById('storage-span').innerHTML = storageUsed + ' GB'; + document.getElementById('gb-left-span').innerHTML = maxStorage + ' ' + 'GB left'; + document.getElementById('gradient-bar').style.width = (storageUsed / 999) * 100 + '%'; +} \ No newline at end of file diff --git a/yoavFridman/styles.css b/yoavFridman/styles.css new file mode 100644 index 0000000..74e9ecd --- /dev/null +++ b/yoavFridman/styles.css @@ -0,0 +1,248 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} + +body { + -ms-overflow-style: none; + /* for Internet Explorer, Edge */ + scrollbar-width: none; + /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; + /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + height: 7rem; + position: relative; + grid-area: b; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +.progress-bar { + position: relative; + display: flex; + align-items: center; + background-color: var(--background-color); + border-radius: 50px; + width: 100%; + height: 1rem; + margin-top: -5px; + padding: 1px; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + filter: saturate(); + width: 0%; + height: 0.8rem; + position: relative; +} + +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} + +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ + + +.gb-left p { + color: var(--dark-blue); + font-size: 2.4rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} + +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + + .gb-left:after { + display: none; + } +} \ No newline at end of file diff --git a/yossiZrihen/images/bg-desktop.png b/yossiZrihen/images/bg-desktop.png new file mode 100644 index 0000000..aa8ee6b Binary files /dev/null and b/yossiZrihen/images/bg-desktop.png differ diff --git a/yossiZrihen/images/bg-mobile.png b/yossiZrihen/images/bg-mobile.png new file mode 100644 index 0000000..9e6a539 Binary files /dev/null and b/yossiZrihen/images/bg-mobile.png differ diff --git a/yossiZrihen/images/favicon-32x32.png b/yossiZrihen/images/favicon-32x32.png new file mode 100644 index 0000000..1e2df7f Binary files /dev/null and b/yossiZrihen/images/favicon-32x32.png differ diff --git a/yossiZrihen/images/icon-document.svg b/yossiZrihen/images/icon-document.svg new file mode 100644 index 0000000..11f469f --- /dev/null +++ b/yossiZrihen/images/icon-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yossiZrihen/images/icon-folder.svg b/yossiZrihen/images/icon-folder.svg new file mode 100644 index 0000000..458df8d --- /dev/null +++ b/yossiZrihen/images/icon-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yossiZrihen/images/icon-upload.svg b/yossiZrihen/images/icon-upload.svg new file mode 100644 index 0000000..6d2b881 --- /dev/null +++ b/yossiZrihen/images/icon-upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yossiZrihen/images/logo.svg b/yossiZrihen/images/logo.svg new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/yossiZrihen/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yossiZrihen/images/project-preview.png b/yossiZrihen/images/project-preview.png new file mode 100644 index 0000000..2e16b33 Binary files /dev/null and b/yossiZrihen/images/project-preview.png differ diff --git a/yossiZrihen/index.html b/yossiZrihen/index.html new file mode 100644 index 0000000..846b6bf --- /dev/null +++ b/yossiZrihen/index.html @@ -0,0 +1,64 @@ + + + + + + + + + + + + + Fylo data storage component + + + +
            + +
            + +
            +
            + +
            +
            + +
            +
            + +
            +
            +
            +
            +
            +
            + + +
            +

            You've used 815 MB of your storage

            + +
            +
            +
            +
            +
            +
            +
            +
            +
            +
            +

            + 0 MB + 100 MB +

            + +
            +

            185 MB left

            +
            +
            +
            + + + + \ No newline at end of file diff --git a/yossiZrihen/index.js b/yossiZrihen/index.js new file mode 100644 index 0000000..9c0813f --- /dev/null +++ b/yossiZrihen/index.js @@ -0,0 +1,42 @@ + +const fileInput = document.getElementById('fileInput'); + +fileInput.addEventListener('change', (event) => { + const selectedFile = event.target.files[0]; + + if (selectedFile) { + const fileSize = selectedFile.size; + const fileExtension = selectedFile.name.spliה + if (fileSize > 10 * 1024 * 1024) { + alert('File size exceeds the limit of 10 MB.'); + return; + } + + document.getElementById('update-progress').style.width = `calc(100% * ${percentage})` + + uploadFile(selectedFile); + } +}); + +function uploadFile(file) { +} +var i = 0; +function move() { + if (i == 0) { + i = 1; + var elem = document.getElementById("myBar"); + var width = 1; + var id = setInterval(frame, 10); + function frame() { + if (width >= 100) { + clearInterval(id); + i = 0; + } else { + width++; + elem.style.width = width + "%"; + } + } + } +} + + diff --git a/yossiZrihen/styles.css b/yossiZrihen/styles.css new file mode 100644 index 0000000..00c2ec8 --- /dev/null +++ b/yossiZrihen/styles.css @@ -0,0 +1,254 @@ +@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"); + +:root { + --body-font: "Raleway", sans-serif; + --background-color: hsl(229, 57%, 11%); + --container-background-color: hsl(228, 56%, 26%); + --pale-blue: hsl(243, 100%, 93%); + --gradient: linear-gradient(90deg, rgba(255, 163, 153, 1) 36%, rgba(255, 77, 151, 1) 100%); + --gradient-bar: rgb(255, 163, 153); + --white: rgb(255, 255, 255); + --dark-blue: hsl(229, 57%, 11%); + --grayish-blue: hsl(229, 7%, 55%); +} + +html, +body { + overflow-x: hidden; +} +body { + -ms-overflow-style: none; /* for Internet Explorer, Edge */ + scrollbar-width: none; /* for Firefox */ + overflow-y: scroll; + min-height: 100vh; + box-sizing: border-box; + padding: 0; + margin: 0; + font-size: 97.5%; + font-family: var(--body-font); + background-color: var(--background-color); + background-image: url("images//bg-desktop.png"); + background-repeat: no-repeat; + background-position-y: bottom; + background-attachment: fixed; + background-size: contain; +} + +body::-webkit-scrollbar { + display: none; /* for Chrome, Safari, and Opera */ +} + +/** Main Container **/ +main { + display: grid; + grid-template-columns: 1fr 2fr; + grid-template-rows: 1fr; + grid-template-areas: "a b b"; + margin: 0 auto; + margin-top: 18.125rem; + width: 70%; + max-width: 57.5rem; + height: auto; + gap: 2rem; + justify-content: space-evenly; + align-items: end; +} + +/** Fylo Container **/ +.fylo-container, +.storage-container { + background-color: var(--container-background-color); +} + +.fylo-container { + display: flex; + flex-direction: column; + align-items: left; + border-radius: 15px 90px 15px 15px; + padding: 2.5rem; + padding-right: 8.3rem; + grid-area: a; + gap: 2rem; +} + +.logo { + width: 8.5rem; + height: auto; +} + +.icons { + display: flex; + flex-direction: row; + gap: 1rem; +} + +.icon-img { + background-color: var(--background-color); + border-radius: 10px; + padding: 0.8rem; +} + +.icon-img img { + width: 1.4rem; + height: 1.4rem; +} + +/** Storage Container **/ +.storage-container { + border-radius: 15px; + padding: 1.4rem 2.5rem; + height: 7rem; + position: relative; + grid-area: b; +} + +h1 { + font-size: 0.9rem; + font-weight: 400; + color: var(--pale-blue); + line-height: 2rem; +} + +h1 span { + font-weight: 700; +} + +/** Progress Bar **/ +#myProgress { + width: 100%; + background-color: rgb(16, 42, 172); +} + +#myBar { + width: 100%; + height: 30px; + background-color: green; +} + +.gradient-bar { + display: flex; + align-items: center; + background: var(--gradient-bar); + background: var(--gradient); + border-radius: 50px; + filter: saturate(); + width: 100%; + height: 0.8rem; + position: relative; + transition: all; +} +.dot-container { + position: relative; + display: inline-flex; + justify-content: flex-end; + align-content: flex-end; + width: 100%; + height: auto; +} +.dot { + position: relative; + background-color: var(--white); + height: 0.6rem; + width: 0.6rem; + border-radius: 50%; + margin-right: 2px; +} + +h2 { + color: var(--pale-blue); + font-size: 12px; + font-weight: 700; + display: flex; + justify-content: space-between; + margin-top: 9px; +} + +/** GB left **/ +.gb-left p { + color: var(--dark-blue); + font-size: 2.4rem; + font-weight: 700; + letter-spacing: 2px; + margin: 0; + display: inline-block; +} + +.gb-left span { + font-size: 0.8rem; + text-transform: uppercase; + color: var(--grayish-blue); + display: inline-block; + vertical-align: middle; + line-height: normal; + letter-spacing: 1px; +} + +.gb-left { + position: absolute; + border-radius: 10px 10px 0 10px; + max-width: 9.6rem; + min-width: 5rem; + width: 90%; + left: 76%; + top: -30%; + transform: translate(-50%, 0); + background-color: var(--white); + padding: 0.8rem; + text-align: right; +} +.gb-left:after { + content: ""; + position: absolute; + bottom: 0; + right: 0; + width: 0; + height: 0; + background-color: transparent; + margin-left: 10%; + margin-bottom: -10%; + border-top: 0; + border-bottom: 35px solid transparent; + border-right: 45px solid var(--white); +} + +/** Media Queries **/ +@media screen and (max-width: 1025px) { + body { + background-image: url("images/bg-mobile.png"); + background-size: cover; + } + + main { + margin-top: 8.125rem; + grid-template-areas: + "a a" + "b b"; + gap: 1rem; + } + + .gb-left { + position: relative; + left: 50%; + top: 5%; + text-align: center; + } + .gb-left:after { + display: none; + } +} +.progress-container { + width: 100px; /* Adjust width as needed */ + height: 10px; + background-color: #ddd; +} + +.progress-bar { + height: 60%; + background-color: #bd7413; + transition: width 1s ease-in-out; /* Add transition effect */ +} + +#update-progress { + /* JavaScript to update width based on percentage */ + width: calc(100% * percentage); +}