tonsz

search notes ~ 2025-01-21

html

Workaround with JS: I used date.toLocaleDateString('en-ca') when I fetched a date from Postgres and plugged it in the value attribute. There is a list in this Stackoverflow thread with all the language specific formats. I just picked en-ca deliberately because they use YYYY-mm-dd. Of course, the solution is to use date picker or something.

css

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr;
  grid-gap: 16px;
}
.card {
  min-width: 400px;
  max-height: max-content;
  padding: 12px 8px;
  display: flex;
  align-items: start;
  border: 1px solid #d4d4d4;
  border-radius: 6px;
}

min-width: 400px - This sets a width if in the case of the cards count not divisible by 3.
max-height: max-content - This gives the effect that each card's height may vary, depending on the length of the text inside the card.

I think I'm content with this solution. I've been manually testing the length of the card by manipulating it in the devtools. The past week, it has been overflowing and stuff. The inspiration for using grid is brought about by my need to have the cards display more dynamically. I know there are other tons of solutions, of course. I'll get to them sometime.

js

postgres


All searches done in progress of a CRUD project - Book Notes - from Angela Yu's web development course.

#notes #postgresql #search-notes #web