Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search improvements #154

Merged
merged 12 commits into from
Oct 9, 2024
Merged

Search improvements #154

merged 12 commits into from
Oct 9, 2024

Conversation

deansallinen
Copy link
Contributor

@deansallinen deansallinen commented Oct 3, 2024

  • Adds search history. Shows last 10 searches for the session and the user can navigate between them with keyboard or select them with mouse
  • Adds button to close search dialog
  • Adds button to submit search
  • Fixes horizontal overflow of layout on mobile
  • Updates styles on search dialog
  • Updates styles on tables
  • Refactor button component
  • Refactor table components
  • Refactor $lib/utils with barrel export index.ts
  • Add util function to middle truncate string
  • Add tests for new string truncate function
  • Add JetBrains monospace font

Copy link

cloudflare-workers-and-pages bot commented Oct 3, 2024

Deploying 2nicove with  Cloudflare Pages  Cloudflare Pages

Latest commit: a4ba4ff
Status: ✅  Deploy successful!
Preview URL: https://7458faa4.unicove2.pages.dev
Branch Preview URL: https://search-history.unicove2.pages.dev

View logs

@deansallinen deansallinen marked this pull request as ready for review October 3, 2024 20:06
Base automatically changed from linting to dev October 3, 2024 22:29
Copy link
Contributor

@dafuga dafuga Oct 8, 2024

Choose a reason for hiding this comment

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

What was the reason to get rid of the table component? I saw that you added the global css, but I didn't mind using a Table component 😅

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess the native table element will be more familiar for most devs 🤔 My initial push back was because I always prefer not adding global css when possible, but maybe it's fine in this situation.

Copy link
Contributor Author

@deansallinen deansallinen Oct 8, 2024

Choose a reason for hiding this comment

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

The component pieces were mainly just applying styles right now. To get things like props, classes, onclick methods, and especially melt-ui builder functions to work it involved adding a lot of complexity with a layer of indirection that I felt wasn't needed.

Additionally, once I started needing "table styles" that weren't on a table element I would need to duplicate the table styles on another component and keep them in sync... Once that happened, it made sense to extract the table styles into a reusable class that could be applied on a <tr> or a <li> or <div class='subgrid'> or whatever.

And at that point, the <Table.Row> component was essentially just a <tr> anyways.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Styles are not automatically applied on all tables globally. A class is used on the root <table> to turn them on for all elements in table. And you can apply styles for just the row, or just the header, or just the hover effect (for example) which is what I needed in the search history component.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I think it's fine and like you said we can always go back to having a Table component if we need to in the future 👍

Copy link
Contributor

@dafuga dafuga left a comment

Choose a reason for hiding this comment

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

💪

@deansallinen deansallinen merged commit d92b3eb into dev Oct 9, 2024
4 checks passed
@deansallinen deansallinen deleted the search-history branch October 9, 2024 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search keyboard navigation of results Search results list Search mouse elements (close, search, etc)
3 participants