Skip to content

Commit

Permalink
Fix Search
Browse files Browse the repository at this point in the history
  • Loading branch information
maxtyson123 committed Jul 2, 2024
1 parent fd9649b commit 43c4b0c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions website/src/pages/api/plants/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default async function handler(
}


query += ` ${selector} (english_name LIKE '${name}%' OR maori_name LIKE '${name}%' OR latin_name LIKE '${name}%')`;
query += ` ${selector} (english_name LIKE '%${name}%' OR maori_name LIKE '%${name}%' OR latin_name LIKE '%${name}%')`;
selector = "AND";
}

Expand Down Expand Up @@ -133,7 +133,7 @@ export default async function handler(

if(getUsers){

query = `SELECT id FROM users WHERE ${tables.user_name} LIKE '${name}%'`
query = `SELECT id FROM users WHERE ${tables.user_name} LIKE '%${name}%'`
const users = await makeQuery(query, client)

// If there are no users, return an error
Expand All @@ -150,7 +150,7 @@ export default async function handler(


// Get the info
query = `SELECT id FROM posts WHERE ${tables.post_title} LIKE '${name}%' ORDER BY ${tables.post_date} DESC`
query = `SELECT id FROM posts WHERE ${tables.post_title} LIKE '%${name}%' ORDER BY ${tables.post_date} DESC`
if(getExtras){
query = `SELECT id, ${tables.post_title}, ${tables.post_date}, ${tables.post_user_id} FROM posts WHERE ${tables.post_title} LIKE '${name}%' ORDER BY ${tables.post_date} DESC`
}
Expand Down
7 changes: 7 additions & 0 deletions website/src/styles/media/cards.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
border-radius: 20px;
}

.mainImage > div > img{
opacity: 0;
}

.postHeader{
display: grid;
grid-template-columns: 0.2fr 0.75fr 0.25fr;
Expand Down Expand Up @@ -189,15 +193,18 @@

@keyframes popIn {
0% {
opacity: 0;
transform: scale(0);
}
30% {
opacity: 1;
transform: scale(1);
}
60% {
transform: scale(1);
}
100% {
opacity: 1;
transform: scale(0);
}
}

0 comments on commit 43c4b0c

Please sign in to comment.