diff --git a/src/App.css b/src/App.css index 4bce2dd7..3aadc777 100644 --- a/src/App.css +++ b/src/App.css @@ -1,5 +1,27 @@ +.App { + display: flex; + flex-direction: row; + overflow-y: auto; +} + +.container { + height: 100vh; + overflow-y: scroll; +} + +.main-profile-container { + z-index: 0; +} + + @media (max-width: 768px) { - .App > div { - margin-left: 0px; + + .App { + flex-direction: column; + } + + .container { + height: 70vh; } } + diff --git a/src/App.js b/src/App.js index 2f68bce1..daf4b585 100644 --- a/src/App.js +++ b/src/App.js @@ -8,6 +8,7 @@ import Pagination from './components/Pagination/Pagination'; import './App.css'; import './components/Pagination/Pagination.css'; import filenames from './ProfilesList.json'; +import { useRef } from 'react'; function App() { const [profiles, setProfiles] = useState([]); @@ -16,6 +17,7 @@ function App() { const [currentPage, setCurrentPage] = useState(1); const [shuffledProfiles, setShuffledProfiles] = useState([]); const recordsPerPage = 20; + const overFlowingContainerRef = useRef(null); const currentUrl = window.location.pathname; @@ -87,10 +89,10 @@ function App() { }; useEffect(() => { - window.scrollTo({ - top: 0, - behavior: 'smooth', - }); + const currentTop = overFlowingContainerRef.current.scrollTop; + if (currentTop !== 0) { + overFlowingContainerRef.current.scrollTop = 0; + } }, [currentPage]); const getPaginatedData = () => { @@ -108,20 +110,28 @@ function App() { return (
- - {currentUrl === '/' ? ( - <> - {profiles.length === 0 && searching ? : renderProfiles()} - - - ) : ( - - )} +
+ + {currentUrl === '/' ? ( + <> + {profiles.length === 0 && searching ? ( + + ) : ( +
+ {renderProfiles()} + +
+ )} + + ) : ( + + )} +
); } diff --git a/src/assets/dummyLogo.jpg b/src/assets/dummyLogo.jpg new file mode 100644 index 00000000..0bf1473e Binary files /dev/null and b/src/assets/dummyLogo.jpg differ diff --git a/src/components/Pagination/Pagination.css b/src/components/Pagination/Pagination.css index 8a2d0026..250a0f96 100644 --- a/src/components/Pagination/Pagination.css +++ b/src/components/Pagination/Pagination.css @@ -1,19 +1,22 @@ .pagination { - margin-left: 12rem; - padding: 1rem 1rem 1rem 1rem; + display: flex; + justify-content: center; + padding: 1rem; height: auto; text-align: center; + position: sticky; + bottom: -18px; + background-color: #141d2f; + z-index: 2; } .pagination-button { background-color: inherit; padding: 1rem; - margin-left: 3rem; align-items: center; justify-content: space-between; border-radius: 8px; border: none; - width: 60px; } .pagination-text { diff --git a/src/components/Profile/Profile.css b/src/components/Profile/Profile.css index 7a351d33..31bd4a34 100644 --- a/src/components/Profile/Profile.css +++ b/src/components/Profile/Profile.css @@ -1,7 +1,7 @@ @import url(https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.css); .profile-container { - margin-left: 20rem; + /* margin-left: 20rem; */ padding: 0rem 1.5rem; } @@ -177,9 +177,17 @@ } } + +@media only screen and (max-width:755px) { + .profile-container { + margin-left: 0px; + } +} + /* Add this CSS to specifically target Safari */ @media screen and (-webkit-min-device-pixel-ratio:0) { .social-icons i { -webkit-backface-visibility : hidden; } -} \ No newline at end of file +} + diff --git a/src/components/Profile/Profile.jsx b/src/components/Profile/Profile.jsx index 067b64e1..555af3ba 100644 --- a/src/components/Profile/Profile.jsx +++ b/src/components/Profile/Profile.jsx @@ -1,7 +1,8 @@ -import React from 'react'; +import React , {useState} from 'react'; import './Profile.css'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faLocationDot } from '@fortawesome/free-solid-svg-icons'; +import dummyProfileLogo from '../../assets/dummyLogo.jpg'; function Profile({ data }) { return ( @@ -12,6 +13,7 @@ function Profile({ data }) { function Card({ data }) { const cardRef = React.useRef(); + const [cardImg,setCardImg] = useState(data?.avatar) // Save image in state and later update if there is an error. const handleWheel = (event) => { event.stopPropagation(); event.preventDefault(); @@ -34,7 +36,7 @@ function Profile({ data }) {
- User logo + setCardImg(dummyProfileLogo)} alt="User logo" />

{data.name}

diff --git a/src/components/Search/Search.css b/src/components/Search/Search.css index 23566756..96bfccab 100644 --- a/src/components/Search/Search.css +++ b/src/components/Search/Search.css @@ -1,12 +1,12 @@ .search-bar { display: flex; align-items: center; - justify-content: flex-end; - margin-left: 20rem; - margin-top: 2rem; - margin-bottom: 2rem; - padding: 0px 1.5rem; - position: relative; + justify-content: end; + padding: 2rem 1.5rem; + background-color: #141d2f; + position: sticky; + top: -2px; + z-index: 1; } .search-bar input { diff --git a/src/components/Sidebar/Sidebar.css b/src/components/Sidebar/Sidebar.css index 389b81f9..63b69e4a 100644 --- a/src/components/Sidebar/Sidebar.css +++ b/src/components/Sidebar/Sidebar.css @@ -3,10 +3,7 @@ margin-top: 30px; margin-bottom: 30px; padding: 0px 30px; - position: fixed; - top: 0; - left: 0; - width: 20rem; + min-width: 20rem; height: 90vh; border-right: 2px solid rgba(194, 183, 183, 0.1); }