Skip to content

Commit

Permalink
Merge pull request #84 from priyanshi-codes/priyanshi
Browse files Browse the repository at this point in the history
Added a profile card Component
  • Loading branch information
skmirajulislam authored Oct 6, 2024
2 parents 6aca50f + 4cc86c5 commit b0e6cce
Show file tree
Hide file tree
Showing 7 changed files with 4,242 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,4 +207,4 @@ All contributions are made through pull requests. To submit a pull request, foll
---
Happy Coding! 😄
Happy Coding! 😄
38 changes: 38 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import js from '@eslint/js'
import globals from 'globals'
import react from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'

export default [
{ ignores: ['dist'] },
{
files: ['**/*.{js,jsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
ecmaVersion: 'latest',
ecmaFeatures: { jsx: true },
sourceType: 'module',
},
},
settings: { react: { version: '18.3' } },
plugins: {
react,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...js.configs.recommended.rules,
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
...reactHooks.configs.recommended.rules,
'react/jsx-no-target-blank': 'off',
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
]
46 changes: 46 additions & 0 deletions frontend/src/components/profileCard/ProfileCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React from 'react';
import { useUser } from '../../UserContext';

const ProfileCard = () => {
const { user } = useUser();
const [isEditing, setIsEditing] = useState(false);

const handleEditToggle = () => {
setIsEditing(!isEditing);
};

const handleSave = () => {
setIsEditing(false);
}

return (
<div style={styles.card}>
<h2>Profile Information</h2>
<p><strong>Name:</strong> {user.name}</p>
<p><strong>Role:</strong> {user.role}</p>
<button style={styles.button}>Edit Profile</button>
</div>
);
};

const styles = {
card: {
padding: '20px',
border: '1px solid #ddd',
borderRadius: '5px',
width: '300px',
margin: '10px auto',
textAlign: 'center',
boxShadow: '0 4px 8px rgba(0, 0, 0, 0.1)',
},
button: {
padding: '10px 15px',
backgroundColor: '#6200ea',
color: '#fff',
border: 'none',
borderRadius: '5px',
cursor: 'pointer',
}
};

export default ProfileCard;
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
Loading

0 comments on commit b0e6cce

Please sign in to comment.