forked from akai/readest
layout: fix insets for double borders and add book spine decorator (#1688)
This commit is contained in:
@@ -61,12 +61,17 @@ const BookItem: React.FC<BookItemProps> = ({
|
||||
>
|
||||
<div
|
||||
className={clsx(
|
||||
'relative flex aspect-[28/41] items-center justify-center',
|
||||
coverFit === 'crop' && 'overflow-hidden shadow-md',
|
||||
'relative flex items-end justify-center',
|
||||
coverFit === 'crop' && 'aspect-[28/41] overflow-hidden shadow-md',
|
||||
mode === 'list' && 'min-w-20',
|
||||
)}
|
||||
>
|
||||
<BookCover mode={mode} book={book} coverFit={coverFit} />
|
||||
<BookCover
|
||||
mode={mode}
|
||||
book={book}
|
||||
coverFit={coverFit}
|
||||
showSpine={book.format !== 'PDF' || !!book.metadata?.publisher}
|
||||
/>
|
||||
{bookSelected && (
|
||||
<div className='absolute inset-0 bg-black opacity-30 transition-opacity duration-300'></div>
|
||||
)}
|
||||
|
||||
@@ -153,7 +153,7 @@ const BooksGrid: React.FC<BooksGridProps> = ({ bookKeys, onCloseBook }) => {
|
||||
showFooter={showFooter}
|
||||
borderColor={viewSettings.borderColor}
|
||||
horizontalGap={horizontalGapPercent}
|
||||
contentInsets={contentInsets}
|
||||
insets={viewInsets}
|
||||
/>
|
||||
)}
|
||||
{showHeader && (
|
||||
|
||||
@@ -5,7 +5,7 @@ interface DoubleBorderProps {
|
||||
horizontalGap: number;
|
||||
showHeader: boolean;
|
||||
showFooter: boolean;
|
||||
contentInsets: Insets;
|
||||
insets: Insets;
|
||||
}
|
||||
|
||||
const paddingPx = 10;
|
||||
@@ -14,7 +14,7 @@ const DoubleBorder: React.FC<DoubleBorderProps> = ({
|
||||
borderColor,
|
||||
showHeader,
|
||||
showFooter,
|
||||
contentInsets,
|
||||
insets,
|
||||
}) => {
|
||||
return (
|
||||
<div>
|
||||
@@ -23,10 +23,10 @@ const DoubleBorder: React.FC<DoubleBorderProps> = ({
|
||||
className={'borderframe pointer-events-none absolute'}
|
||||
style={{
|
||||
border: `4px solid ${borderColor}`,
|
||||
height: `calc(100% - ${contentInsets.top + contentInsets.bottom}px + ${paddingPx * 2}px)`,
|
||||
top: `calc(${contentInsets.top}px - ${paddingPx}px)`,
|
||||
left: `calc(${contentInsets.left}px - ${paddingPx}px)`,
|
||||
right: `calc(${contentInsets.right}px - ${paddingPx}px)`,
|
||||
height: `calc(100% - ${insets.top + insets.bottom}px + ${paddingPx * 2}px)`,
|
||||
top: `calc(${insets.top}px - ${paddingPx}px)`,
|
||||
left: `calc(${insets.left}px - ${paddingPx}px)`,
|
||||
right: `calc(${insets.right}px - ${paddingPx}px)`,
|
||||
}}
|
||||
></div>
|
||||
{/* inner frame */}
|
||||
@@ -34,10 +34,10 @@ const DoubleBorder: React.FC<DoubleBorderProps> = ({
|
||||
className={'borderframe pointer-events-none absolute'}
|
||||
style={{
|
||||
border: `1px solid ${borderColor}`,
|
||||
height: `calc(100% - ${contentInsets.top + contentInsets.bottom}px)`,
|
||||
top: `${contentInsets.top}px`,
|
||||
left: `calc(${contentInsets.left + (showFooter ? 32 : 0)}px`,
|
||||
right: `calc(${contentInsets.right + (showHeader ? 32 : 0)}px`,
|
||||
height: `calc(100% - ${insets.top + insets.bottom}px)`,
|
||||
top: `${insets.top}px`,
|
||||
left: `calc(${insets.left + (showFooter ? 32 : 0)}px`,
|
||||
right: `calc(${insets.right + (showHeader ? 32 : 0)}px`,
|
||||
}}
|
||||
/>
|
||||
{/* footer */}
|
||||
@@ -49,9 +49,9 @@ const DoubleBorder: React.FC<DoubleBorderProps> = ({
|
||||
borderBottom: `1px solid ${borderColor}`,
|
||||
borderLeft: `1px solid ${borderColor}`,
|
||||
width: '32px',
|
||||
height: `calc(100% - ${contentInsets.top + contentInsets.bottom}px)`,
|
||||
top: `${contentInsets.top}px`,
|
||||
left: `calc(${contentInsets.left}px)`,
|
||||
height: `calc(100% - ${insets.top + insets.bottom}px)`,
|
||||
top: `${insets.top}px`,
|
||||
left: `calc(${insets.left}px)`,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
@@ -64,9 +64,9 @@ const DoubleBorder: React.FC<DoubleBorderProps> = ({
|
||||
borderBottom: `1px solid ${borderColor}`,
|
||||
borderRight: `1px solid ${borderColor}`,
|
||||
width: '32px',
|
||||
height: `calc(100% - ${contentInsets.top + contentInsets.bottom}px)`,
|
||||
top: `${contentInsets.top}px`,
|
||||
left: `calc(100% - ${contentInsets.right}px - 32px)`,
|
||||
height: `calc(100% - ${insets.top + insets.bottom}px)`,
|
||||
top: `${insets.top}px`,
|
||||
left: `calc(100% - ${insets.right}px - 32px)`,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user