Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

FIX: Default Avatar #831

Merged
merged 5 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"pnpm": "^8.10.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.21.1",
"react-scripts": "5.0.1",
"web-vitals": "^3.5.0"
},
Expand Down
Binary file added public/default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 9 additions & 2 deletions src/components/Profile/Profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { faXTwitter } from '@fortawesome/free-brands-svg-icons';
import { faGithub } from '@fortawesome/free-brands-svg-icons';
import { faLinkedinIn } from '@fortawesome/free-brands-svg-icons';


function Profile({ data }) {
return (
<div className="profile-container">
Expand All @@ -15,7 +16,8 @@ function Profile({ data }) {

function Card({ data }) {
const cardRef = React.useRef();
const handleWheel = (event) => {
const [avatarSrc, setAvatarSrc] = React.useState(data.avatar);
const handleWheel = (event) => {
event.stopPropagation();
event.preventDefault();
let container = event.target;
Expand All @@ -33,11 +35,16 @@ function Profile({ data }) {
cardRef.current.addEventListener('wheel', handleWheel, { passive: false });
}, []);


return (
<div className="profile-card">
<div className="top-container">
<div className="profile-photo">
<img src={data.avatar} alt="User logo" />
<img
src={avatarSrc}
alt="User logo"
onError={() => setAvatarSrc('default.png')}
/>
</div>
<div className="profile-details">
<h3>
Expand Down
3 changes: 2 additions & 1 deletion src/components/Sidebar/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import './Sidebar.css';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faCode, faMoon, faSun } from '@fortawesome/free-solid-svg-icons';
import useTheme from '../../hooks/useTheme';
// import {UserForm} from '../UserFrom/UserFrom';

function Sidebar() {
const { theme, toogleTheme } = useTheme();
Expand All @@ -29,7 +30,7 @@ function Sidebar() {
</div>
</div>
<div className="headline">Discover and Connect with Skilled Developers.</div>
<div className="description">
<div className="description">
<a href=" https://github.com/shyamtawli/devFind#how-to-add-your-profile-" target="_blank" rel="noreferrer">
<button className="link_button"> Add your profile </button>
</a>
Expand Down
Loading