Skip to content

Commit

Permalink
improve/search
Browse files Browse the repository at this point in the history
  • Loading branch information
ArunGovil committed Jan 14, 2023
1 parent 416a078 commit 52f9337
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 17 deletions.
4 changes: 2 additions & 2 deletions components/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ export default function Hero() {
<div className="flex flex-col justify-center items-center p-4 w-full h-[70vh] max-w-5xl">
<p className="text-5xl font-semibold">every command ever!</p>
<p className="text-md font-thin mt-6">
I don&apos;t need to know everything, I just need to know where to find
it, when I need it.
You don&apos;t need to know everything, you just need to know where to
find it, when you need it.
</p>
<DemoSearch />
</div>
Expand Down
9 changes: 2 additions & 7 deletions components/Listing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,8 @@ export default function Listing() {
<div className="min-h-[50vh] flex justify-center items-center w-full">
{code.length > 0 ? (
<ul className="mb-8 w-full">
{code.map((item: any) => (
<CodeCard
key={item.id}
id={item.id}
title={item.title}
code={item.code}
/>
{code.map((item: any, id: any) => (
<CodeCard key={id} id={id} title={item.title} code={item.code} />
))}
</ul>
) : (
Expand Down
6 changes: 3 additions & 3 deletions components/SearchListing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ export default function SearchListing({ searchData }: SearchListingProps) {
<div className="min-h-[45vh] flex items-center justify-center w-full">
{searchData.length > 0 ? (
<ul className="mb-8 min-h-[80vh] w-full">
{searchData.map((item: any) => (
{searchData.map((item: any, id: any) => (
<CodeCard
key={item.id}
id={item.id}
key={id}
id={id}
title={item.title}
code={item.code}
/>
Expand Down
1 change: 0 additions & 1 deletion components/SecondarySearch.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Link from "next/link";
import React, { useEffect, useState, useRef } from "react";
import { placeholders } from "../utils";

Expand Down
60 changes: 60 additions & 0 deletions content/content.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,70 @@
"technology": "git",
"tags": ["git", "remote"]
},
{
"title": "Git view current status",
"code": "git status",
"technology": "git",
"tags": ["git", "status"]
},
{
"title": "Git view changes/difference made",
"code": "git diff file-path",
"technology": "git",
"tags": ["git", "difference"]
},
{
"title": "Git create new branch",
"code": "git checkout -b branch-name",
"technology": "git",
"tags": ["git", "branch"]
},
{
"title": "Git push new branch",
"code": "git push -u origin branch-name",
"technology": "git",
"tags": ["git", "branch"]
},
{
"title": "Generate React Native release apk build",
"code": "cd android ./gradlew assembleRealease",
"technology": "reactnative",
"tags": ["reactnative", "apk", "build"]
},
{
"title": "Create vite project using npm",
"code": "npm create vite@latest",
"technology": "vite",
"tags": ["vite", "npm"]
},
{
"title": "Create vite project using yarn",
"code": "yarn create vite",
"technology": "vite",
"tags": ["vite", "yarn"]
},
{
"title": "Give a file executable permission",
"code": "chmod +x file-path",
"technology": "linux",
"tags": ["permission", "linux"]
},
{
"title": "Switch to superuser mode",
"code": "sudo su",
"technology": "linux",
"tags": ["sudo", "linux"]
},
{
"title": "Create nextjs app using npm",
"code": "npx create-next-app@latest",
"technology": "nextjs",
"tags": ["netxjs", "npm"]
},
{
"title": "Create nextjs app using yarn",
"code": "yarn create next-app",
"technology": "nextjs",
"tags": ["netxjs", "yarn"]
}
]
11 changes: 8 additions & 3 deletions pages/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ import content from "../content/content.json";
export default function Details() {
const [data, setData] = useState(content);
const filterData = (query: string) => {
const filtered = content.filter((item: any) =>
item.title.toLowerCase().includes(query)
);
const filtered = content.filter((item: any) => {
const keyword = query.toLowerCase();
const result =
item.title.toLowerCase().includes(keyword) ||
item.code.toLowerCase().includes(keyword) ||
item.technology.toLowerCase().includes(keyword);
return result;
});
setData(filtered);
};

Expand Down
6 changes: 5 additions & 1 deletion utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ export const tabs = [
},
{
id: 4,
title: "django",
title: "vite",
},
{
id: 5,
title: "reactnative",
},
{
id: 6,
title: "linux",
},
];

export const placeholders = [
Expand Down

1 comment on commit 52f9337

@vercel
Copy link

@vercel vercel bot commented on 52f9337 Jan 14, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

cmdr – ./

cmdr-git-main-arungovil.vercel.app
cmdr-arungovil.vercel.app
cmdr.vercel.app

Please sign in to comment.