Skip to content

Commit

Permalink
Fix Library Grid Scaling issue.
Browse files Browse the repository at this point in the history
Fix for #257
Now each column can adjust it's height, and keeps it's aspect ratio, based on the cover images.
Only downside is that if the images are not the same size, they may not line up on the bottom edge. But this looks much more natural
  • Loading branch information
TheMadog24 authored and xgi committed Oct 12, 2023
1 parent daf2510 commit b159035
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/components/library/LibraryGrid.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
opacity: 0.8;
background-size: cover;
cursor: pointer;
text-align: center;
}

.coverContainer:hover {
Expand Down
18 changes: 12 additions & 6 deletions src/components/library/LibraryGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,17 +187,23 @@ const LibraryGrid: React.FC<Props> = (props: Props) => {
<div
className={styles.coverContainer}
onClick={() => viewFunc(series)}
style={{
height: `calc(105vw / ${libraryColumns})`,
}}
// style={{
// height: `calc(105vw / ${libraryColumns})`,

Check failure on line 191 in src/components/library/LibraryGrid.tsx

View workflow job for this annotation

GitHub Actions / build (18, macos-latest)

Delete `··`
// }}
>
<ExtensionImage
url={coverSource}
series={series}
alt={series.title}
width="100%"
height="100%"
style={{ objectFit: 'cover' }}
// width="100%"
// height="100%"
style={{
objectFit: 'cover',

Check failure on line 201 in src/components/library/LibraryGrid.tsx

View workflow job for this annotation

GitHub Actions / build (18, macos-latest)

Replace `↹↹↹↹↹↹` with `······················`
width: '100%',

Check failure on line 202 in src/components/library/LibraryGrid.tsx

View workflow job for this annotation

GitHub Actions / build (18, macos-latest)

Replace `↹↹↹↹↹↹` with `······················`
height: '100%'

Check failure on line 203 in src/components/library/LibraryGrid.tsx

View workflow job for this annotation

GitHub Actions / build (18, macos-latest)

Replace `↹↹↹↹↹↹··height:·'100%'` with `························height:·'100%',`
// maxWidth: '100%',

Check failure on line 204 in src/components/library/LibraryGrid.tsx

View workflow job for this annotation

GitHub Actions / build (18, macos-latest)

Replace `↹↹↹↹↹↹` with `······················`
// maxHeight: '100%'

Check failure on line 205 in src/components/library/LibraryGrid.tsx

View workflow job for this annotation

GitHub Actions / build (18, macos-latest)

Replace `↹↹↹↹↹↹··//·maxHeight:·'100%'↹↹↹↹↹↹··⏎↹↹↹↹↹` with `························//·maxHeight:·'100%'⏎··················`
}}
/>
{renderUnreadBadge(series)}
{libraryView === LibraryView.GridCompact ? (
Expand Down
1 change: 1 addition & 0 deletions src/components/search/SearchGrid.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
position: relative;
opacity: 0.8;
background-size: cover;
text-align: center;
}

.coverContainer:hover {
Expand Down
14 changes: 10 additions & 4 deletions src/components/search/SearchGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const SearchGrid: React.FC<Props> = (props: Props) => {
setShowingContextMenu(true);
}}
style={{
height: `calc(105vw / ${libraryColumns})`,
// height: `calc(105vw / ${libraryColumns})`,
cursor: inLibrary ? 'not-allowed' : 'pointer',
}}
>
Expand All @@ -79,9 +79,15 @@ const SearchGrid: React.FC<Props> = (props: Props) => {
url={series.remoteCoverUrl}
series={series}
alt={series.title}
width="100%"
height="100%"
style={{ objectFit: 'cover' }}
// width="100%"
// height="100%"

Check failure on line 83 in src/components/search/SearchGrid.tsx

View workflow job for this annotation

GitHub Actions / build (18, macos-latest)

Replace `↹↹↹` with `············`
style={{

Check failure on line 84 in src/components/search/SearchGrid.tsx

View workflow job for this annotation

GitHub Actions / build (18, macos-latest)

Delete `·`
objectFit: 'cover',

Check failure on line 85 in src/components/search/SearchGrid.tsx

View workflow job for this annotation

GitHub Actions / build (18, macos-latest)

Replace `↹↹↹↹` with `··············`
width: '100%',

Check failure on line 86 in src/components/search/SearchGrid.tsx

View workflow job for this annotation

GitHub Actions / build (18, macos-latest)

Replace `↹↹↹↹` with `··············`
height: '100%'
// maxWidth: '100%',
// maxHeight: '100%'
}}
/>
{inLibrary ? <Overlay opacity={0.5} color="#2B8A3E" /> : ''}
<Title className={styles.seriesTitle} order={5} lineClamp={3} p={4}>
Expand Down

0 comments on commit b159035

Please sign in to comment.