Compare commits
2 commits
Devlopment
...
main
Author | SHA1 | Date | |
---|---|---|---|
Sumit Kumar | b06b041e8e | ||
mihir_dml | fc7beaddc3 |
71
README.md
71
README.md
|
@ -1,3 +1,70 @@
|
||||||
# Assigment4
|
# Getting Started with Create React App
|
||||||
|
|
||||||
Random User Directory
|
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
||||||
|
|
||||||
|
## Available Scripts
|
||||||
|
|
||||||
|
In the project directory, you can run:
|
||||||
|
|
||||||
|
### `npm start`
|
||||||
|
|
||||||
|
Runs the app in the development mode.\
|
||||||
|
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
|
||||||
|
|
||||||
|
The page will reload when you make changes.\
|
||||||
|
You may also see any lint errors in the console.
|
||||||
|
|
||||||
|
### `npm test`
|
||||||
|
|
||||||
|
Launches the test runner in the interactive watch mode.\
|
||||||
|
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
||||||
|
|
||||||
|
### `npm run build`
|
||||||
|
|
||||||
|
Builds the app for production to the `build` folder.\
|
||||||
|
It correctly bundles React in production mode and optimizes the build for the best performance.
|
||||||
|
|
||||||
|
The build is minified and the filenames include the hashes.\
|
||||||
|
Your app is ready to be deployed!
|
||||||
|
|
||||||
|
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
||||||
|
|
||||||
|
### `npm run eject`
|
||||||
|
|
||||||
|
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
|
||||||
|
|
||||||
|
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
||||||
|
|
||||||
|
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
|
||||||
|
|
||||||
|
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
|
||||||
|
|
||||||
|
## Learn More
|
||||||
|
|
||||||
|
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
||||||
|
|
||||||
|
To learn React, check out the [React documentation](https://reactjs.org/).
|
||||||
|
|
||||||
|
### Code Splitting
|
||||||
|
|
||||||
|
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
|
||||||
|
|
||||||
|
### Analyzing the Bundle Size
|
||||||
|
|
||||||
|
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
|
||||||
|
|
||||||
|
### Making a Progressive Web App
|
||||||
|
|
||||||
|
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
|
||||||
|
|
||||||
|
### Advanced Configuration
|
||||||
|
|
||||||
|
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
|
||||||
|
|
||||||
|
### Deployment
|
||||||
|
|
||||||
|
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
|
||||||
|
|
||||||
|
### `npm run build` fails to minify
|
||||||
|
|
||||||
|
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
|
||||||
|
|
506
src/App.css
506
src/App.css
|
@ -1,250 +1,256 @@
|
||||||
/* Global Styles */
|
/* Global Styles */
|
||||||
body {
|
body {
|
||||||
font-family: 'Arial', sans-serif;
|
font-family: 'Arial', sans-serif;
|
||||||
background-color: #f4f7fc;
|
background-color: #f4f7fc;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
line-height: 1.6;
|
||||||
|
}
|
||||||
.App {
|
|
||||||
text-align: center;
|
.App {
|
||||||
}
|
text-align: center;
|
||||||
|
}
|
||||||
/* Header */
|
|
||||||
.App-header {
|
/* Header */
|
||||||
background-color: #282c34;
|
.App-header {
|
||||||
padding: 40px 20px;
|
background-color: #282c34;
|
||||||
color: white;
|
padding: 40px 20px;
|
||||||
border-bottom: 4px solid #0056b3;
|
color: white;
|
||||||
}
|
border-bottom: 4px solid #0056b3;
|
||||||
|
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
|
||||||
.App-header h1 {
|
}
|
||||||
font-size: 2.5rem;
|
|
||||||
letter-spacing: 2px;
|
.App-header h1 {
|
||||||
margin: 0;
|
font-size: 2.5rem;
|
||||||
text-transform: uppercase;
|
letter-spacing: 2px;
|
||||||
}
|
margin: 0;
|
||||||
|
text-transform: uppercase;
|
||||||
/* Search and Filter Section */
|
}
|
||||||
.search-filter-container {
|
|
||||||
display: flex;
|
/* Search and Filter Section */
|
||||||
justify-content: center;
|
.search-filter-container {
|
||||||
align-items: center;
|
display: flex;
|
||||||
gap: 15px;
|
justify-content: center;
|
||||||
margin: 30px 0;
|
align-items: center;
|
||||||
flex-wrap: wrap;
|
gap: 15px;
|
||||||
padding: 0 20px;
|
margin: 30px 0;
|
||||||
}
|
flex-wrap: wrap;
|
||||||
|
padding: 0 20px;
|
||||||
.search-filter-container input,
|
}
|
||||||
.search-filter-container select,
|
|
||||||
.sort-options select {
|
.search-filter-container input,
|
||||||
padding: 12px;
|
.search-filter-container select,
|
||||||
font-size: 16px;
|
.sort-options select {
|
||||||
border-radius: 8px;
|
padding: 12px;
|
||||||
border: 1px solid #ccc;
|
font-size: 16px;
|
||||||
width: 200px;
|
border-radius: 8px;
|
||||||
box-sizing: border-box;
|
border: 1px solid #ccc;
|
||||||
transition: border-color 0.3s ease, background-color 0.3s ease;
|
width: 200px;
|
||||||
}
|
box-sizing: border-box;
|
||||||
|
transition: border-color 0.3s ease, background-color 0.3s ease;
|
||||||
.search-filter-container input:focus,
|
}
|
||||||
.search-filter-container select:focus,
|
|
||||||
.sort-options select:focus{
|
.search-filter-container input:focus,
|
||||||
border-color: #007bff;
|
.search-filter-container select:focus,
|
||||||
outline: none;
|
.sort-options select:focus {
|
||||||
}
|
border-color: #007bff;
|
||||||
|
outline: none;
|
||||||
/* User Grid Styles */
|
background-color: #e9f5ff;
|
||||||
.user-grid {
|
}
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
|
/* User Grid Styles */
|
||||||
gap: 20px;
|
.user-grid {
|
||||||
padding: 0 20px;
|
display: grid;
|
||||||
margin-top: 30px;
|
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
|
||||||
transition: all 0.3s ease;
|
gap: 20px;
|
||||||
}
|
padding: 0 20px;
|
||||||
|
margin-top: 30px;
|
||||||
.user-card {
|
transition: all 0.3s ease;
|
||||||
background-color: #fff;
|
}
|
||||||
border-radius: 12px;
|
|
||||||
padding: 15px;
|
.user-card {
|
||||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
background-color: #fff;
|
||||||
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
border-radius: 12px;
|
||||||
cursor: pointer;
|
padding: 15px;
|
||||||
text-align: center;
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
||||||
}
|
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
||||||
|
cursor: pointer;
|
||||||
.user-card:hover {
|
text-align: center;
|
||||||
transform: translateY(-5px);
|
}
|
||||||
box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
|
|
||||||
}
|
.user-card:hover {
|
||||||
|
transform: translateY(-5px);
|
||||||
.user-card img {
|
box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
|
||||||
width: 100px;
|
}
|
||||||
height: 100px;
|
|
||||||
border-radius: 50%;
|
.user-card img {
|
||||||
margin-bottom: 10px;
|
width: 100px;
|
||||||
object-fit: cover;
|
height: 100px;
|
||||||
}
|
border-radius: 50%;
|
||||||
|
margin-bottom: 10px;
|
||||||
.user-info h3 {
|
object-fit: cover;
|
||||||
font-size: 1.2rem;
|
}
|
||||||
color: #333;
|
|
||||||
margin: 10px 0;
|
.user-info h3 {
|
||||||
}
|
font-size: 1.2rem;
|
||||||
|
color: #333;
|
||||||
.user-info p {
|
margin: 10px 0;
|
||||||
color: #555;
|
}
|
||||||
font-size: 14px;
|
|
||||||
margin-bottom: 15px;
|
.user-info p {
|
||||||
}
|
color: #555;
|
||||||
|
font-size: 14px;
|
||||||
/* View Details Button */
|
margin-bottom: 15px;
|
||||||
.view-details-btn {
|
}
|
||||||
background-color: #007bff;
|
|
||||||
color: white;
|
/* View Details Button */
|
||||||
padding: 10px 20px;
|
.view-details-btn {
|
||||||
text-decoration: none;
|
background-color: #007bff;
|
||||||
border-radius: 25px;
|
color: white;
|
||||||
font-weight: bold;
|
padding: 10px 20px;
|
||||||
display: inline-block;
|
text-decoration: none;
|
||||||
transition: background-color 0.3s ease;
|
border-radius: 25px;
|
||||||
}
|
font-weight: bold;
|
||||||
|
display: inline-block;
|
||||||
.view-details-btn:hover {
|
transition: background-color 0.3s ease, transform 0.2s ease;
|
||||||
background-color: #0056b3;
|
}
|
||||||
}
|
|
||||||
|
.view-details-btn:hover {
|
||||||
/* Pagination Styles */
|
background-color: #0056b3;
|
||||||
.pagination {
|
transform: translateY(-2px);
|
||||||
display: flex;
|
}
|
||||||
justify-content: center;
|
|
||||||
gap: 15px;
|
/* Pagination Styles */
|
||||||
margin-top: 30px;
|
.pagination {
|
||||||
}
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
.pagination button {
|
gap: 15px;
|
||||||
padding: 10px 20px;
|
margin-top: 30px;
|
||||||
background-color: #fff;
|
}
|
||||||
border: 1px solid #ddd;
|
|
||||||
border-radius: 25px;
|
.pagination button {
|
||||||
cursor: pointer;
|
padding: 10px 20px;
|
||||||
color: #333;
|
background-color: #fff;
|
||||||
font-size: 14px;
|
border: 1px solid #ddd;
|
||||||
font-weight: bold;
|
border-radius: 25px;
|
||||||
transition: background-color 0.3s ease, transform 0.2s ease;
|
cursor: pointer;
|
||||||
}
|
color: #333;
|
||||||
|
font-size: 14px;
|
||||||
.pagination button:hover {
|
font-weight: bold;
|
||||||
background-color: #007bff;
|
transition: background-color 0.3s ease, transform 0.2s ease;
|
||||||
color: white;
|
}
|
||||||
transform: translateY(-3px);
|
|
||||||
}
|
.pagination button:hover {
|
||||||
|
background-color: #007bff;
|
||||||
.pagination button.active {
|
color: white;
|
||||||
background-color: #4caf50;
|
transform: translateY(-3px);
|
||||||
color: white;
|
}
|
||||||
}
|
|
||||||
|
.pagination button.active {
|
||||||
.pagination button:disabled {
|
background-color: #4caf50;
|
||||||
background-color: #ccc;
|
color: white;
|
||||||
cursor: not-allowed;
|
}
|
||||||
color: #fff;
|
|
||||||
}
|
.pagination button:disabled {
|
||||||
|
background-color: #ccc;
|
||||||
/* User Details Page Styles */
|
cursor: not-allowed;
|
||||||
.user-details {
|
color: #fff;
|
||||||
max-width: 900px;
|
}
|
||||||
margin: 40px auto;
|
|
||||||
padding: 20px;
|
/* User Details Page Styles */
|
||||||
background-color: #fff;
|
.user-details {
|
||||||
border-radius: 12px;
|
max-width: 900px;
|
||||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
margin: 40px auto;
|
||||||
top: 160px;
|
padding: 20px;
|
||||||
width: 100%;
|
background-color: #fff;
|
||||||
}
|
border-radius: 12px;
|
||||||
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
||||||
.user-details h2 {
|
top: 160px;
|
||||||
text-align: center;
|
width: 100%;
|
||||||
color: #333;
|
}
|
||||||
font-size: 2rem;
|
|
||||||
margin-bottom: 30px;
|
.user-details h2 {
|
||||||
}
|
text-align: center;
|
||||||
|
color: #333;
|
||||||
.user-image {
|
font-size: 2rem;
|
||||||
display: block;
|
margin-bottom: 30px;
|
||||||
margin: 0 auto 20px;
|
}
|
||||||
border-radius: 50%;
|
|
||||||
width: 150px;
|
.user-image {
|
||||||
height: 150px;
|
display: block;
|
||||||
object-fit: cover;
|
margin: 0 auto 20px;
|
||||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
border-radius: 50%;
|
||||||
}
|
width: 150px;
|
||||||
|
height: 150px;
|
||||||
.user-info {
|
object-fit: cover;
|
||||||
font-size: 16px;
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
||||||
color: #555;
|
}
|
||||||
line-height: 1.6;
|
|
||||||
}
|
.user-info {
|
||||||
|
font-size: 16px;
|
||||||
.user-info div {
|
color: #555;
|
||||||
margin-bottom: 15px;
|
line-height: 1.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-info strong {
|
.user-info div {
|
||||||
font-weight: bold;
|
margin-bottom: 15px;
|
||||||
color: #333;
|
}
|
||||||
}
|
|
||||||
|
.user-info strong {
|
||||||
/* Back to User List Button */
|
font-weight: bold;
|
||||||
.back-btn ,.export-btn{
|
color: #333;
|
||||||
display: inline-block;
|
}
|
||||||
|
|
||||||
margin-top: 30px;
|
/* Back to User List Button */
|
||||||
text-decoration: none;
|
.back-btn,
|
||||||
background-color: #4CAF50;
|
.export-btn {
|
||||||
color: #fff;
|
display: inline-block;
|
||||||
padding: 12px 20px;
|
margin-top: 30px;
|
||||||
border-radius: 30px;
|
text-decoration: none;
|
||||||
font-size: 16px;
|
background-color: #4CAF50;
|
||||||
text-align: center;
|
color: #fff;
|
||||||
transition: background-color 0.3s ease;
|
padding: 12px 20px;
|
||||||
border-width: 0;
|
border-radius: 30px;
|
||||||
}
|
font-size: 16px;
|
||||||
|
text-align: center;
|
||||||
.back-btn:hover,.export-btn:hover {
|
transition: background-color 0.3s ease, transform 0.2s ease;
|
||||||
background-color: #45a049;
|
border-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.back-btn:hover,
|
||||||
.view-detail
|
.export-btn:hover {
|
||||||
{
|
background-color: #45a049;
|
||||||
background-color: #007bff;
|
transform: translateY(-2px);
|
||||||
width: 120px;
|
}
|
||||||
margin-left: 50px;
|
|
||||||
padding: 8px 20px;
|
/* Enhanced Buttons */
|
||||||
border-radius: 40px;
|
.view-detail {
|
||||||
}
|
background-color: #007bff;
|
||||||
.view-detail:hover
|
width: 120px;
|
||||||
{
|
margin-left: 50px;
|
||||||
color: #fdfbfb;
|
padding: 8px 20px;
|
||||||
background-color: #0056b3;
|
border-radius: 40px;
|
||||||
}
|
transition: background-color 0.3s ease, transform 0.2s ease;
|
||||||
|
}
|
||||||
.hero-section button{
|
|
||||||
background-color: #6aabf1;
|
.view-detail:hover {
|
||||||
width: 120px;
|
color: #fdfbfb;
|
||||||
margin-left: 50px;
|
background-color: #0056b3;
|
||||||
padding: 8px 20px;
|
transform: translateY(-2px);
|
||||||
border-radius: 40px;
|
}
|
||||||
border-width: 0;
|
|
||||||
}
|
.hero-section button {
|
||||||
.hero-section button:hover
|
background-color: #6aabf1;
|
||||||
{
|
width: 120px;
|
||||||
color: #fdfbfb;
|
margin-left: 50px;
|
||||||
background-color: #0056b3;
|
padding: 8px 20px;
|
||||||
transform: translateY(-3px);
|
border-radius: 40px;
|
||||||
}
|
border-width: 0;
|
||||||
|
transition: background-color 0.3s ease, transform 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-section button:hover {
|
||||||
|
color: #fdfbfb;
|
||||||
|
background-color: #0056b3;
|
||||||
|
transform: translateY(-3px);
|
||||||
|
}
|
||||||
|
|
67
src/App.js
67
src/App.js
|
@ -1,30 +1,37 @@
|
||||||
// src/App.js
|
// src/App.js
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
|
import { BrowserRouter as Router, Routes, Route,useNavigate } from 'react-router-dom';
|
||||||
import './App.css';
|
import './App.css';
|
||||||
import Home from './Home'; // Import the Home component
|
import Home from './Home'; // Import the Home component
|
||||||
import UserDetails from './UserDetail';
|
import UserDetails from './UserDetail';
|
||||||
|
|
||||||
function App() {
|
const Header = () =>{
|
||||||
return (
|
const navigate = useNavigate();
|
||||||
<Router>
|
return (
|
||||||
<div className="App">
|
<header className="App-header">
|
||||||
<header className="App-header">
|
<h1>Random Users</h1>
|
||||||
<h1>Random Users</h1>
|
<p>Explore a diverse set of random users from all over the world!</p>
|
||||||
<p>Explore a diverse set of random users from all over the world!</p>
|
<div className="hero-section">
|
||||||
<div className="hero-section">
|
<button onClick={() => navigate('/home')}>View Users</button>
|
||||||
<button onClick={() => window.location.href = '/home'}>View Users</button>
|
</div>
|
||||||
</div>
|
</header>
|
||||||
</header>
|
);
|
||||||
|
}
|
||||||
<Routes>
|
|
||||||
<Route path="/" element={<div>Landing Page</div>} />
|
function App() {
|
||||||
<Route path="/home" element={<Home />} />
|
return (
|
||||||
<Route path="/user-details" element={<UserDetails />} />
|
<Router>
|
||||||
</Routes>
|
<div className="App">
|
||||||
</div>
|
<Header/>
|
||||||
</Router>
|
|
||||||
);
|
<Routes>
|
||||||
}
|
<Route path="/" element={<div>Landing Page</div>} />
|
||||||
|
<Route path="/home" element={<Home />} />
|
||||||
export default App;
|
<Route path="/user-details/:username" element={<UserDetails />} />
|
||||||
|
</Routes>
|
||||||
|
</div>
|
||||||
|
</Router>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default App;
|
||||||
|
|
336
src/Home.js
336
src/Home.js
|
@ -1,167 +1,169 @@
|
||||||
// src/Home.js
|
// src/Home.js
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import UserCard from './UserCard';
|
import UserCard from './UserCard';
|
||||||
import SearchFilter from './SearchFilter';
|
import SearchFilter from './SearchFilter';
|
||||||
|
|
||||||
function Home() {
|
function Home() {
|
||||||
const [data, setData] = useState([]);
|
const [data, setData] = useState([]);
|
||||||
const [filteredData, setFilteredData] = useState([]);
|
const [filteredData, setFilteredData] = useState([]);
|
||||||
const [currentPage, setCurrentPage] = useState(1);
|
const [currentPage, setCurrentPage] = useState(1);
|
||||||
const [searchQuery, setSearchQuery] = useState('');
|
const [searchQuery, setSearchQuery] = useState('');
|
||||||
const [selectedGender, setSelectedGender] = useState('');
|
const [selectedGender, setSelectedGender] = useState('');
|
||||||
const [selectedAgeRange, setSelectedAgeRange] = useState('');
|
const [selectedAgeRange, setSelectedAgeRange] = useState('');
|
||||||
const [selectedNationality, setSelectedNationality] = useState('');
|
const [selectedNationality, setSelectedNationality] = useState('');
|
||||||
const [sortBy, setSortBy] = useState('name'); // Default sort by name
|
const [sortBy, setSortBy] = useState('name'); // Default sort by name
|
||||||
const [sortOrder, setSortOrder] = useState('asc'); // Default sort order: ascending
|
const [sortOrder, setSortOrder] = useState('asc'); // Default sort order: ascending
|
||||||
const [setUserDetail] = useState(null);
|
const [error, setError] = useState(null); // State to hold error messages
|
||||||
const usersPerPage = 12;
|
const usersPerPage = 12;
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
// Fetch data from the API
|
// Fetch data from the API
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetch('https://randomuser.me/api/?results=200')
|
const fetchData = async () => {
|
||||||
.then(response => response.json())
|
try {
|
||||||
.then(data => {
|
const response = await fetch('https://randomuser.me/api/?results=200');
|
||||||
setData(data.results);
|
if (!response.ok) {
|
||||||
setFilteredData(data.results); // Set initial filtered data as the full list
|
throw new Error('Network response was not ok');
|
||||||
});
|
}
|
||||||
}, []);
|
const result = await response.json();
|
||||||
|
setData(result.results);
|
||||||
// Filter users based on search query and selected filters
|
setFilteredData(result.results); // Set initial filtered data as the full list
|
||||||
useEffect(() => {
|
} catch (error) {
|
||||||
let filtered = data;
|
setError(error.message); // Set the error message
|
||||||
|
}
|
||||||
// Search by name, email, or location
|
};
|
||||||
if (searchQuery) {
|
|
||||||
filtered = filtered.filter(user =>
|
fetchData();
|
||||||
user.name.first.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
}, []);
|
||||||
user.name.last.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
|
||||||
user.email.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
// Filter users based on search query and selected filters
|
||||||
`${user.location.city} ${user.location.country}`.toLowerCase().includes(searchQuery.toLowerCase())
|
useEffect(() => {
|
||||||
);
|
let filtered = data;
|
||||||
}
|
|
||||||
|
// Search by name, email, or location
|
||||||
// Filter by gender
|
if (searchQuery) {
|
||||||
if (selectedGender) {
|
filtered = filtered.filter(user =>
|
||||||
filtered = filtered.filter(user => user.gender === selectedGender);
|
user.name?.first?.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||||
}
|
user.name?.last?.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||||
|
user.email?.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||||
// Filter by age range
|
`${user.location?.city} ${user.location?.country}`.toLowerCase().includes(searchQuery.toLowerCase())
|
||||||
if (selectedAgeRange) {
|
);
|
||||||
const [minAge, maxAge] = selectedAgeRange.split('-').map(Number);
|
}
|
||||||
filtered = filtered.filter(user => {
|
|
||||||
const userAge = new Date().getFullYear() - new Date(user.dob.date).getFullYear();
|
// Filter by gender
|
||||||
return userAge >= minAge && userAge <= maxAge;
|
if (selectedGender) {
|
||||||
});
|
filtered = filtered.filter(user => user.gender === selectedGender);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter by nationality
|
// Filter by age range
|
||||||
if (selectedNationality) {
|
if (selectedAgeRange) {
|
||||||
filtered = filtered.filter(user => user.nat === selectedNationality);
|
const [minAge, maxAge] = selectedAgeRange.split('-').map(Number);
|
||||||
}
|
filtered = filtered.filter(user => {
|
||||||
|
const userAge = new Date().getFullYear() - new Date(user.dob?.date).getFullYear();
|
||||||
// Sorting logic
|
return userAge >= minAge && userAge <= maxAge;
|
||||||
if (sortBy === 'name') {
|
});
|
||||||
filtered = filtered.sort((a, b) => {
|
}
|
||||||
const nameA = `${a.name.first} ${a.name.last}`.toLowerCase();
|
|
||||||
const nameB = `${b.name.first} ${b.name.last}`.toLowerCase();
|
// Filter by nationality
|
||||||
if (sortOrder === 'asc') {
|
if (selectedNationality) {
|
||||||
return nameA.localeCompare(nameB);
|
filtered = filtered.filter(user => user.nat === selectedNationality);
|
||||||
} else {
|
}
|
||||||
return nameB.localeCompare(nameA);
|
|
||||||
}
|
// Sorting logic
|
||||||
});
|
// Sorting logic
|
||||||
} else if (sortBy === 'age') {
|
if (sortBy === 'name') {
|
||||||
filtered = filtered.sort((a, b) => {
|
filtered = filtered.sort((personA, personB) => {
|
||||||
const ageA = new Date().getFullYear() - new Date(a.dob.date).getFullYear();
|
const fullNameA = `${personA.name?.first} ${personA.name?.last}`.toLowerCase();
|
||||||
const ageB = new Date().getFullYear() - new Date(b.dob.date).getFullYear();
|
const fullNameB = `${personB.name?.first} ${personB.name?.last}`.toLowerCase();
|
||||||
if (sortOrder === 'asc') {
|
return sortOrder === 'asc' ? fullNameA.localeCompare(fullNameB) : fullNameB.localeCompare(fullNameA);
|
||||||
return ageA - ageB;
|
});
|
||||||
} else {
|
} else if (sortBy === 'age') {
|
||||||
return ageB - ageA;
|
filtered = filtered.sort((personA, personB) => {
|
||||||
}
|
const currentYear = new Date().getFullYear();
|
||||||
});
|
const ageA = currentYear - new Date(personA.dob?.date).getFullYear();
|
||||||
}
|
const ageB = currentYear - new Date(personB.dob?.date).getFullYear();
|
||||||
|
return sortOrder === 'asc' ? ageA - ageB : ageB - ageA;
|
||||||
setFilteredData(filtered);
|
});
|
||||||
setCurrentPage(1); // Reset to first page whenever filters or sorting change
|
}
|
||||||
}, [searchQuery, selectedGender, selectedAgeRange, selectedNationality, sortBy, sortOrder, data]);
|
|
||||||
|
setFilteredData(filtered);
|
||||||
// Pagination logic
|
setCurrentPage(1); // Reset to first page whenever filters or sorting change
|
||||||
const indexOfLastUser = currentPage * usersPerPage;
|
}, [searchQuery, selectedGender, selectedAgeRange, selectedNationality, sortBy, sortOrder, data]);
|
||||||
const currentUsers = filteredData.slice(indexOfLastUser - usersPerPage, indexOfLastUser);
|
|
||||||
const totalPages = Math.ceil(filteredData.length / usersPerPage);
|
// Pagination logic
|
||||||
|
const indexOfLastUser = currentPage * usersPerPage;
|
||||||
const pageNumbers = [];
|
const currentUsers = filteredData.slice(indexOfLastUser - usersPerPage, indexOfLastUser);
|
||||||
const maxPageRange = 2;
|
const totalPages = Math.ceil(filteredData.length / usersPerPage);
|
||||||
|
|
||||||
for (let i = 1; i <= totalPages; i++) {
|
const pageNumbers = [];
|
||||||
if (i <= 2 || i > totalPages - 2 || (i >= currentPage - maxPageRange && i <= currentPage + maxPageRange)) {
|
const maxPageRange = 2;
|
||||||
pageNumbers.push(i);
|
|
||||||
} else if (pageNumbers[pageNumbers.length - 1] !== '...') {
|
for (let i = 1; i <= totalPages; i++) {
|
||||||
pageNumbers.push('...');
|
if (i <= 2 || i > totalPages - 2 || (i >= currentPage - maxPageRange && i <= currentPage + maxPageRange)) {
|
||||||
}
|
pageNumbers.push(i);
|
||||||
}
|
} else if (pageNumbers[pageNumbers.length - 1] !== '...') {
|
||||||
|
pageNumbers.push('...');
|
||||||
// Function to handle clicking on More Info
|
}
|
||||||
const handleMoreInfo = (user) => {
|
}
|
||||||
setUserDetail(user);
|
|
||||||
navigate(`/user-details`);
|
// Function to handle clicking on More Info
|
||||||
};
|
const handleMoreInfo = (user) => {
|
||||||
|
navigate(`/user-details`,{state:{user}});
|
||||||
return (
|
};
|
||||||
<div className="Home">
|
|
||||||
<SearchFilter
|
return (
|
||||||
searchQuery={searchQuery}
|
<div className="Home">
|
||||||
setSearchQuery={setSearchQuery}
|
{error && <div className="error">Error: {error}</div>} {/* Display error message if exists */}
|
||||||
selectedGender={selectedGender}
|
<SearchFilter
|
||||||
setSelectedGender={setSelectedGender}
|
searchQuery={searchQuery}
|
||||||
selectedAgeRange={selectedAgeRange}
|
setSearchQuery={setSearchQuery}
|
||||||
setSelectedAgeRange={setSelectedAgeRange}
|
selectedGender={selectedGender}
|
||||||
selectedNationality={selectedNationality}
|
setSelectedGender={setSelectedGender}
|
||||||
setSelectedNationality={setSelectedNationality}
|
selectedAgeRange={selectedAgeRange}
|
||||||
/>
|
setSelectedAgeRange={setSelectedAgeRange}
|
||||||
|
selectedNationality={selectedNationality}
|
||||||
{/* Sort Options UI */}
|
setSelectedNationality={setSelectedNationality}
|
||||||
<div className="sort-options">
|
/>
|
||||||
<select onChange={(e) => setSortBy(e.target.value)} value={sortBy}>
|
|
||||||
<option value="name">Sort by Name</option>
|
{/* Sort Options UI */}
|
||||||
<option value="age">Sort by Age</option>
|
<div className="sort-options">
|
||||||
</select>
|
<select onChange={(e) => setSortBy(e.target.value)} value={sortBy}>
|
||||||
<select onChange={(e) => setSortOrder(e.target.value)} value={sortOrder}>
|
<option value="name">Sort by Name</option>
|
||||||
<option value="asc">Ascending</option>
|
<option value="age">Sort by Age</option>
|
||||||
<option value="desc">Descending</option>
|
</select>
|
||||||
</select>
|
<select onChange={(e) => setSortOrder(e.target.value)} value={sortOrder}>
|
||||||
</div>
|
<option value="asc">Ascending</option>
|
||||||
|
<option value="desc">Descending</option>
|
||||||
{filteredData.length > 0 ? (
|
</select>
|
||||||
<>
|
</div>
|
||||||
<div className="user-grid">
|
|
||||||
{currentUsers.map(user => (
|
{filteredData.length > 0 ? (
|
||||||
<UserCard key={user.email} user={user} handleMoreInfo={handleMoreInfo} />
|
<>
|
||||||
))}
|
<div className="user-grid">
|
||||||
</div>
|
{currentUsers.map(user => (
|
||||||
<div className="pagination">
|
<UserCard key={user.email} user={user} handleMoreInfo={handleMoreInfo} />
|
||||||
<button onClick={() => setCurrentPage(prev => Math.max(prev - 1, 1))} disabled={currentPage === 1}>Prev</button>
|
))}
|
||||||
{pageNumbers.map((number, index) => (
|
</div>
|
||||||
<button
|
<div className="pagination">
|
||||||
key={index}
|
<button onClick={() => setCurrentPage(prev => Math.max(prev - 1, 1))} disabled={currentPage === 1}>Prev</button>
|
||||||
onClick={() => number !== '...' && setCurrentPage(number)}
|
{pageNumbers.map((number, index) => (
|
||||||
className={currentPage === number ? 'active' : ''}
|
<button
|
||||||
disabled={number === '...'}
|
key={index}
|
||||||
>
|
onClick={() => number !== '...' && setCurrentPage(number)}
|
||||||
{number}
|
className={currentPage === number ? 'active' : ''}
|
||||||
</button>
|
disabled={number === '...'}
|
||||||
))}
|
>
|
||||||
<button onClick={() => setCurrentPage(prev => Math.min(prev + 1, totalPages))} disabled={currentPage === totalPages}>Next</button>
|
{number}
|
||||||
</div>
|
</button>
|
||||||
</>
|
))}
|
||||||
) : (
|
<button onClick={() => setCurrentPage(prev => Math.min(prev + 1, totalPages))} disabled={currentPage === totalPages}>Next</button>
|
||||||
<p>Loading...</p>
|
</div>
|
||||||
)}
|
</>
|
||||||
</div>
|
) : (
|
||||||
);
|
<p>Loading...</p>
|
||||||
}
|
)}
|
||||||
|
</div>
|
||||||
export default Home;
|
);
|
||||||
|
}
|
||||||
|
export default Home;
|
||||||
|
|
|
@ -1,37 +1,37 @@
|
||||||
// src/SearchFilter.js
|
// src/SearchFilter.js
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
const SearchFilter = ({ searchQuery, setSearchQuery, selectedGender, setSelectedGender, selectedAgeRange, setSelectedAgeRange, selectedNationality, setSelectedNationality }) => {
|
const SearchFilter = ({ searchQuery, setSearchQuery, selectedGender, setSelectedGender, selectedAgeRange, setSelectedAgeRange, selectedNationality, setSelectedNationality }) => {
|
||||||
return (
|
return (
|
||||||
<div className="search-filter-container">
|
<div className="search-filter-container">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Search by name, email, or location"
|
placeholder="Search by name, email, or location"
|
||||||
value={searchQuery}
|
value={searchQuery}
|
||||||
onChange={(e) => setSearchQuery(e.target.value)}
|
onChange={(e) => setSearchQuery(e.target.value)}
|
||||||
/>
|
/>
|
||||||
<select value={selectedGender} onChange={(e) => setSelectedGender(e.target.value)}>
|
<select value={selectedGender} onChange={(e) => setSelectedGender(e.target.value)}>
|
||||||
<option value="">All Genders</option>
|
<option value="">All Genders</option>
|
||||||
<option value="male">Male</option>
|
<option value="male">Male</option>
|
||||||
<option value="female">Female</option>
|
<option value="female">Female</option>
|
||||||
</select>
|
</select>
|
||||||
<select value={selectedAgeRange} onChange={(e) => setSelectedAgeRange(e.target.value)}>
|
<select value={selectedAgeRange} onChange={(e) => setSelectedAgeRange(e.target.value)}>
|
||||||
<option value="">All Ages</option>
|
<option value="">All Ages</option>
|
||||||
<option value="18-30">18-30</option>
|
<option value="18-30">18-30</option>
|
||||||
<option value="31-45">31-45</option>
|
<option value="31-45">31-45</option>
|
||||||
<option value="46-60">46-60</option>
|
<option value="46-60">46-60</option>
|
||||||
<option value="61+">61+</option>
|
<option value="61+">61+</option>
|
||||||
</select>
|
</select>
|
||||||
<select value={selectedNationality} onChange={(e) => setSelectedNationality(e.target.value)}>
|
<select value={selectedNationality} onChange={(e) => setSelectedNationality(e.target.value)}>
|
||||||
<option value="">All Nationalities</option>
|
<option value="">All Nationalities</option>
|
||||||
<option value="US">US</option>
|
<option value="US">US</option>
|
||||||
<option value="GB">GB</option>
|
<option value="GB">GB</option>
|
||||||
<option value="IN">IN</option>
|
<option value="IN">IN</option>
|
||||||
<option value="CA">CA</option>
|
<option value="CA">CA</option>
|
||||||
{/* Add more nationality options as needed */}
|
{/* Add more nationality options as needed */}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default SearchFilter;
|
export default SearchFilter;
|
||||||
|
|
|
@ -1,28 +1,27 @@
|
||||||
// src/UserCard.js
|
import React from 'react';
|
||||||
import React from 'react';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { useNavigate } from 'react-router-dom';
|
|
||||||
|
const UserCard = ({ user }) => {
|
||||||
const UserCard = ({ user }) => {
|
const navigate = useNavigate();
|
||||||
const navigate = useNavigate();
|
console.log('usersss', user);
|
||||||
console.log('usersss', user)
|
|
||||||
|
const onClickHandler = () => {
|
||||||
const onClickHandler = () => {
|
// Navigate to UserDetails with username in the URL
|
||||||
navigate(`/user-details`, { state: user});
|
navigate(`/user-details/${user.login.username}`, { state: user });
|
||||||
}
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="user-card" key={user.email}>
|
<div className="user-card" key={user.email}>
|
||||||
<img src={user.picture.medium} alt={user.name.first} />
|
<img src={user.picture.medium} alt={user.name.first} />
|
||||||
<div className="user-info">
|
<div className="user-info">
|
||||||
<h3>{user.name.first} {user.name.last}</h3>
|
<h3>{user.name.first} {user.name.last}</h3>
|
||||||
<p>{user.email}</p>
|
<p>{user.email}</p>
|
||||||
{/* Link to the UserDetails page, passing the user data via state */}
|
<p className='view-detail' onClick={onClickHandler}>
|
||||||
<p className='view-detail' onClick={() => onClickHandler()}>
|
View Details
|
||||||
View Details
|
</p>
|
||||||
</p>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
);
|
||||||
);
|
};
|
||||||
};
|
|
||||||
|
export default UserCard;
|
||||||
export default UserCard;
|
|
||||||
|
|
|
@ -1,84 +1,73 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useLocation, Link } from 'react-router-dom'; // useLocation to access state passed through the router
|
import { useLocation, Link } from 'react-router-dom';
|
||||||
import './App.css'; // Import the CSS for styling
|
import './App.css';
|
||||||
|
|
||||||
const UserDetails = () => {
|
const UserDetails = () => {
|
||||||
// Use useLocation to access the user data passed from UserCard
|
const location = useLocation();
|
||||||
const location = useLocation();
|
if (!location.state) {
|
||||||
if (!location.state) {
|
return <p>No user data available!</p>;
|
||||||
return <p>No user data available!</p>;
|
}
|
||||||
}
|
|
||||||
|
const user = location.state;
|
||||||
const user = location.state;
|
const userLocation = user.location || {};
|
||||||
|
const userName = user.name || {};
|
||||||
// Function to export user data to CSV
|
|
||||||
const exportToCSV = () => {
|
const exportToCSV = () => {
|
||||||
// Create a CSV string with the user details
|
const userData = [
|
||||||
const userData = [
|
['First Name', 'Last Name', 'Email', 'Phone', 'Cell', 'Address', 'Date of Birth', 'Nationality', 'Timezone', 'Coordinates', 'Username'],
|
||||||
['First Name', 'Last Name', 'Email', 'Phone', 'Cell', 'Address', 'Date of Birth', 'Nationality', 'Timezone', 'Coordinates', 'Username'],
|
[
|
||||||
[
|
userName.first || 'N/A',
|
||||||
user.name.first,
|
userName.last || 'N/A',
|
||||||
user.name.last,
|
user.email || 'N/A',
|
||||||
user.email,
|
user.phone || 'N/A',
|
||||||
user.phone,
|
user.cell || 'N/A',
|
||||||
user.cell,
|
`${userLocation.street?.number || ''} ${userLocation.street?.name || ''}, ${userLocation.city || 'N/A'}, ${userLocation.state || 'N/A'}, ${userLocation.country || 'N/A'} - ${userLocation.postcode || 'N/A'}`,
|
||||||
`${user.location.street.number} ${user.location.street.name}, ${user.location.city}, ${user.location.state}, ${user.location.country} - ${user.location.postcode}`,
|
new Date(user.dob?.date).toLocaleDateString('en-US') || 'N/A',
|
||||||
new Date(user.dob.date).toLocaleDateString(),
|
user.nat || 'N/A',
|
||||||
user.nat,
|
userLocation.timezone?.description || 'N/A',
|
||||||
user.location.timezone.description,
|
`${userLocation.coordinates?.latitude || 'N/A'}, ${userLocation.coordinates?.longitude || 'N/A'}`,
|
||||||
`${user.location.coordinates.latitude}, ${user.location.coordinates.longitude}`,
|
user.login?.username || 'N/A'
|
||||||
user.login.username
|
]
|
||||||
]
|
];
|
||||||
];
|
|
||||||
|
const csvContent = userData.map(row => row.join(',')).join('\n');
|
||||||
// Convert to CSV format
|
const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
|
||||||
const csvContent = userData.map(row => row.join(',')).join('\n');
|
const link = document.createElement('a');
|
||||||
|
const url = URL.createObjectURL(blob);
|
||||||
// Create a Blob from the CSV data
|
link.setAttribute('href', url);
|
||||||
const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
|
link.setAttribute('download', `${userName.first || 'User'}_${userName.last || 'Details'}.csv`);
|
||||||
|
link.style.visibility = 'hidden';
|
||||||
// Create a link to download the CSV file
|
|
||||||
const link = document.createElement('a');
|
document.body.appendChild(link);
|
||||||
const url = URL.createObjectURL(blob);
|
link.click();
|
||||||
link.setAttribute('href', url);
|
document.body.removeChild(link);
|
||||||
link.setAttribute('download', `${user.name.first}_${user.name.last}_details.csv`);
|
};
|
||||||
link.style.visibility = 'hidden';
|
|
||||||
|
return (
|
||||||
// Append the link to the document body and trigger the download
|
<div className="user-details">
|
||||||
document.body.appendChild(link);
|
<h2>{userName.first || 'Unknown'} {userName.last || 'User'}</h2>
|
||||||
link.click();
|
<img src={user.picture?.large} alt={userName.first || 'User'} className="user-image" />
|
||||||
document.body.removeChild(link);
|
|
||||||
};
|
<div className="user-info">
|
||||||
|
<div><strong>Email:</strong> {user.email || 'N/A'}</div>
|
||||||
return (
|
<div><strong>Phone:</strong> {user.phone || 'N/A'}</div>
|
||||||
<div className="user-details">
|
<div><strong>Cell:</strong> {user.cell || 'N/A'}</div>
|
||||||
<h2>{user.name.first} {user.name.last}</h2>
|
<div>
|
||||||
<img src={user.picture.large} alt={user.name.first} className="user-image" />
|
<strong>Location:</strong> {`${userLocation.street?.number || ''} ${userLocation.street?.name || ''}, ${userLocation.city || 'N/A'}, ${userLocation.state || 'N/A'}, ${userLocation.country || 'N/A'} - ${userLocation.postcode || 'N/A'}`}
|
||||||
|
</div>
|
||||||
{/* Display user details */}
|
<div><strong>Date of Birth:</strong> {new Date(user.dob?.date).toLocaleDateString('en-US') || 'N/A'}</div>
|
||||||
<div className="user-info">
|
<div><strong>Nationality:</strong> {user.nat || 'N/A'}</div>
|
||||||
<div><strong>Email:</strong> {user.email}</div>
|
<div><strong>Timezone:</strong> {userLocation.timezone?.description || 'N/A'}</div>
|
||||||
<div><strong>Phone:</strong> {user.phone}</div>
|
<div>
|
||||||
<div><strong>Cell:</strong> {user.cell}</div>
|
<strong>Coordinates:</strong> {`${userLocation.coordinates?.latitude || 'N/A'}, ${userLocation.coordinates?.longitude || 'N/A'}`}
|
||||||
<div>
|
</div>
|
||||||
<strong>Location:</strong> {user.location.street.number} {user.location.street.name}, {user.location.city}, {user.location.state}, {user.location.country} - {user.location.postcode}
|
<div><strong>Username:</strong> {user.login?.username || 'N/A'}</div>
|
||||||
</div>
|
</div>
|
||||||
<div><strong>Date of Birth:</strong> {new Date(user.dob.date).toLocaleDateString()}</div>
|
|
||||||
<div><strong>Nationality:</strong> {user.nat}</div>
|
<Link to="/home" className="back-btn">Back to User List</Link>
|
||||||
<div><strong>Timezone:</strong> {user.location.timezone.description}</div>
|
<button onClick={exportToCSV} className="export-btn">Export to CSV</button>
|
||||||
<div>
|
</div>
|
||||||
<strong>Coordinates:</strong> {user.location.coordinates.latitude}, {user.location.coordinates.longitude}
|
);
|
||||||
</div>
|
};
|
||||||
<div><strong>Username:</strong> {user.login.username}</div>
|
|
||||||
</div>
|
export default UserDetails;
|
||||||
|
|
||||||
{/* Link to go back to the user list */}
|
|
||||||
<Link to="/home" className="back-btn">Back to User List</Link>
|
|
||||||
|
|
||||||
{/* Export Button to download user data as CSV */}
|
|
||||||
<button onClick={exportToCSV} className="export-btn">Export to CSV</button>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default UserDetails;
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||||
sans-serif;
|
sans-serif;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
code {
|
code {
|
||||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||||
monospace;
|
monospace;
|
||||||
}
|
}
|
22
src/index.js
22
src/index.js
|
@ -1,12 +1,12 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReactDOM from 'react-dom/client';
|
import ReactDOM from 'react-dom/client';
|
||||||
import './index.css';
|
import './index.css';
|
||||||
import App from './App';
|
import App from './App';
|
||||||
|
|
||||||
|
|
||||||
const root = ReactDOM.createRoot(document.getElementById('root'));
|
const root = ReactDOM.createRoot(document.getElementById('root'));
|
||||||
root.render(
|
root.render(
|
||||||
<React.StrictMode>
|
<React.StrictMode>
|
||||||
<App />
|
<App />
|
||||||
</React.StrictMode>
|
</React.StrictMode>
|
||||||
);
|
);
|
Loading…
Reference in a new issue