Skip to content

Commit

Permalink
Fix search functionality on mobile
Browse files Browse the repository at this point in the history
Also edit blog card css

Signed-off-by: Randy <randymoralesg@gmail.com>
  • Loading branch information
randymorales committed Apr 5, 2021
1 parent 28103eb commit 81a3cdc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cache/data.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pages/blog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function BlogIndex({ allLocalePostsData }) {

const searchEndpoint = query => `/api/search?q=${query}`

const onChange = useCallback(event => {
const onKeyup = useCallback(event => {
const query = event.target.value
setQuery(query)
if (query.length) {
Expand Down Expand Up @@ -69,7 +69,7 @@ export default function BlogIndex({ allLocalePostsData }) {
{/* Search bar */}
<input
className={styles.search}
onChange={onChange}
onKeyup={onKeyup}
onFocus={onFocus}
placeholder={t('search-posts')}
type='text'
Expand Down
3 changes: 2 additions & 1 deletion styles/blog.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
.search {
border: 1px solid #666;
box-sizing: border-box;
cursor: 'pointer';
font-size: 1.3rem;
margin-bottom: 1rem;
padding: 0.9rem;
Expand All @@ -32,7 +33,7 @@
margin: 0.5rem;
position: static;
transition: 250ms all ease-in-out;
width: 45%;
width: 400px;
}

.card:hover {
Expand Down

1 comment on commit 81a3cdc

@vercel
Copy link

@vercel vercel bot commented on 81a3cdc Apr 5, 2021

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.