Skip to content

Commit

Permalink
Merge pull request #144 from sayinmehmet47/shadcn-for-components
Browse files Browse the repository at this point in the history
feat: tables with shadcn
  • Loading branch information
sayinmehmet47 authored Nov 26, 2023
2 parents 4fa43c6 + 33befc2 commit c352067
Show file tree
Hide file tree
Showing 36 changed files with 17,331 additions and 8,140 deletions.
Binary file modified .DS_Store
Binary file not shown.
27 changes: 25 additions & 2 deletions backend/routes/api/books.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ router.get('/searchBooks', async (req: Request, res: Response) => {
}
pagination.results = results;
cache.set(cacheKey, pagination); // store the result in the cache

res.json(pagination);
});

Expand Down Expand Up @@ -190,8 +191,6 @@ router.post(
async (req: Request, res: Response, next: NextFunction) => {
const id = req.body.id.toString().trim();

console.log(id);

try {
const data = await Books.findByIdAndRemove(id);

Expand Down Expand Up @@ -249,4 +248,28 @@ router.post('/updateBook', (req: Request, res: Response) => {
);
});

router.get('/getBookById/:id', (req: Request, res: Response) => {
const id = req.params.id;

console.log(id);

Books.findById(
id,
(
err: Error,
data: {
name: string;
url: string;
size: string;
uploader: string;
category: string[];
language: string;
}
) => {
if (err) console.log(err);
res.status(201).json(data);
}
);
});

module.exports = router;
76 changes: 76 additions & 0 deletions client/app/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
:root {
--background: 0 0% 100%;
--foreground: 222.2 84% 4.9%;

--card: 0 0% 100%;
--card-foreground: 222.2 84% 4.9%;

--popover: 0 0% 100%;
--popover-foreground: 222.2 84% 4.9%;

--primary: 222.2 47.4% 11.2%;
--primary-foreground: 210 40% 98%;

--secondary: 210 40% 96.1%;
--secondary-foreground: 222.2 47.4% 11.2%;

--muted: 210 40% 96.1%;
--muted-foreground: 215.4 16.3% 46.9%;

--accent: 210 40% 96.1%;
--accent-foreground: 222.2 47.4% 11.2%;

--destructive: 0 84.2% 60.2%;
--destructive-foreground: 210 40% 98%;

--border: 214.3 31.8% 91.4%;
--input: 214.3 31.8% 91.4%;
--ring: 222.2 84% 4.9%;

--radius: 0.5rem;
}

.dark {
--background: 222.2 84% 4.9%;
--foreground: 210 40% 98%;

--card: 222.2 84% 4.9%;
--card-foreground: 210 40% 98%;

--popover: 222.2 84% 4.9%;
--popover-foreground: 210 40% 98%;

--primary: 210 40% 98%;
--primary-foreground: 222.2 47.4% 11.2%;

--secondary: 217.2 32.6% 17.5%;
--secondary-foreground: 210 40% 98%;

--muted: 217.2 32.6% 17.5%;
--muted-foreground: 215 20.2% 65.1%;

--accent: 217.2 32.6% 17.5%;
--accent-foreground: 210 40% 98%;

--destructive: 0 62.8% 30.6%;
--destructive-foreground: 210 40% 98%;

--border: 217.2 32.6% 17.5%;
--input: 217.2 32.6% 17.5%;
--ring: 212.7 26.8% 83.9%;
}
}

@layer base {
* {
@apply border-border;
}
body {
@apply bg-background text-foreground;
}
}
16 changes: 16 additions & 0 deletions client/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "tailwind.config.js",
"css": "app/globals.css",
"baseColor": "slate",
"cssVariables": true
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}
Loading

1 comment on commit c352067

@vercel
Copy link

@vercel vercel bot commented on c352067 Nov 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.