Skip to content
Open
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
17,430 changes: 17,430 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,8 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"tailwindcss": "^3.4.1"
}
}
4 changes: 2 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />

<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />

<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Expand Down
19 changes: 17 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
import "./App.css";

import { Card } from "./components/Card";
import useFetch from "./hooks/useFetch";
function App() {
return <div></div>;
const [data] = useFetch("https://jsonplaceholder.typicode.com/users");

return (
<div>
{data.length === 0 ? (
<p>Loading...</p>
) : (
<div className="flex flex-wrap gap-5 justify-center items-center pt-10 ">
{data.map((user) => (
<Card key={user.id} user={user} />
))}
</div>
)}
</div>
);
}

export default App;
12 changes: 12 additions & 0 deletions src/components/Card.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const Card = ({ user }) => {
return (
<div className="bg-red-300 p-7 w-80 rounded-lg border-black border-2">
<div className="pb-5">
<h1 className="text-xl font-medium">{user.name}</h1>
<p className="font-">Email: {user.email}</p>
<p>Phone: {user.phone}</p>
<p>Company: {user.company.name}</p>
</div>
</div>
);
};
5 changes: 5 additions & 0 deletions src/components/CardDetails.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { useState } from "react";
import { Card } from "./Card";
export default function CardDetails() {
return <div></div>;
}
23 changes: 23 additions & 0 deletions src/hooks/useFetch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { useState, useEffect } from "react";

function useFetch(url) {
const [data, setData] = useState([]);

const fetching = async () => {
try {
const response = await fetch(url);
const data = await response.json();
setData(data);
} catch (error) {
console.log(error);
}
};

useEffect(() => {
fetching();
}, []);

return [data];
}

export default useFetch;
3 changes: 3 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
Expand Down
2 changes: 0 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React from "react";
import ReactDOM from "react-dom/client";

import App from "./App";

import "./index.css";

const root = ReactDOM.createRoot(document.getElementById("root"));
Expand Down
9 changes: 9 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [ "./src/**/*.{js,jsx,ts,tsx}"],
theme: {
extend: {},
},
plugins: [],
}

2,969 changes: 1,558 additions & 1,411 deletions yarn.lock

Large diffs are not rendered by default.