-
Notifications
You must be signed in to change notification settings - Fork 0
feat: improve UI with shadcn components and new features #56
Merged
Merged
Changes from 21 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
d3476a1
refactor: use shadcn Button for FavoriteButton
hestro 6b4ee4f
refactor: use shadcn Card in BookCard
hestro aae070b
feat: add hover animations to BookCard
hestro f5fd7a4
feat: add shadcn pagination with page links
hestro 12a8b09
fix: Keep favorite button above book cover
hestro 90a77eb
feat: add hover style to pagination links
hestro 46f72f5
feat: add keyboard focus ring to BookCard
hestro 88d2696
feat: use shadcn input group in SearchBar
hestro 371da70
feat: add shadcn Popover component
hestro f7d3489
feat: add shadcn components for filters
hestro ce48cb2
fix: improve accessibility of language filter tooltip
hestro 46103d9
feat: add clear all filters button
hestro d8f5998
refactor: move pagination hover style to shared PaginationLink
hestro 78c285b
fix: reset to first page when search change
hestro 8b745d8
feat: add text-md font size to theme
hestro 6a801a5
feat: make main fill the screen
hestro 979e616
feat: add read more to book description
hestro 1e2142f
feat: update selected book page with shadcn components and new features
hestro 5ebbc59
fix: update project number in footer to 2
hestro 27acaa4
feat: add shadcn breadcrumb component
hestro e1a4fd4
style: add newline
hestro 7511bd6
feat: zoom book covers into frame on hover instead of scaling up
hestro 5e28ffb
refactor: use cn utility for favorite button class
hestro b5258a2
refactor: replace manually imported icons with lucide-react
hestro c82538d
refactor: move pointer cursor to buttonVariants base classes
hestro 24f85cb
refactor: rename pagination component to BookPagination
hestro 65d2590
refactor: rename breadcrumb component to PageBreadcrumb
hestro 6ee33b3
Merge branch 'main' into refactor/shadcn-ui
martakam f10bd83
fix: adjust FavoriteButton size and variant after merge with main
martakam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
frontend/app/components/BookDescription/BookDescription.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import { useState } from "react"; | ||
| import { Button } from "~/components/ui/Button"; | ||
| import { cn } from "~/lib/utils"; | ||
|
|
||
| const DESCRIPTION_PREVIEW_LENGTH = 650; | ||
|
|
||
| interface BookDescriptionProps { | ||
| description?: string | null; | ||
| } | ||
|
|
||
| function BookDescription({ description }: BookDescriptionProps) { | ||
| const [expanded, setExpanded] = useState(false); | ||
|
|
||
| const text = description ?? "No description available"; | ||
| const isLong = text.length > DESCRIPTION_PREVIEW_LENGTH; | ||
|
|
||
| return ( | ||
| <> | ||
| <p className={cn("leading-relaxed", isLong && !expanded && "line-clamp-8")}>{text}</p> | ||
| {isLong && ( | ||
| <Button | ||
| type="button" | ||
| variant="link" | ||
| className="px-0 text-foreground/80 hover:text-foreground" | ||
| aria-expanded={expanded} | ||
| onClick={() => setExpanded(!expanded)} | ||
| > | ||
| {expanded ? "Read less" : "Read more"} | ||
| </Button> | ||
| )} | ||
| </> | ||
| ); | ||
| } | ||
|
|
||
| export { BookDescription }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import { Fragment } from "react"; | ||
| import { Link, type To } from "react-router"; | ||
| import { | ||
| Breadcrumb as BreadcrumbRoot, | ||
| BreadcrumbList, | ||
| BreadcrumbItem, | ||
| BreadcrumbLink, | ||
| BreadcrumbPage, | ||
| BreadcrumbSeparator, | ||
| } from "~/components/ui/Breadcrumb"; | ||
|
|
||
| interface BreadcrumbProps { | ||
| items: { | ||
| label: string; | ||
| to?: To; // No "to" means that this is the current page, shown as plain text | ||
| }[]; | ||
| } | ||
|
|
||
| function Breadcrumb({ items }: BreadcrumbProps) { | ||
| return ( | ||
| <BreadcrumbRoot className="mx-auto w-full max-w-300 px-10 pt-6"> | ||
| <BreadcrumbList> | ||
| {items.map((item, index) => ( | ||
| <Fragment key={item.label}> | ||
| {index > 0 && <BreadcrumbSeparator />} | ||
| <BreadcrumbItem> | ||
| {item.to ? ( | ||
| <BreadcrumbLink render={<Link to={item.to} />}> | ||
| {item.label} | ||
| </BreadcrumbLink> | ||
| ) : ( | ||
| <BreadcrumbPage className="max-w-60 truncate"> | ||
| {item.label} | ||
| </BreadcrumbPage> | ||
| )} | ||
| </BreadcrumbItem> | ||
| </Fragment> | ||
| ))} | ||
| </BreadcrumbList> | ||
| </BreadcrumbRoot> | ||
| ); | ||
| } | ||
|
|
||
| export { Breadcrumb }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.