Skip to content

Commit

Permalink
Add objectFit to Thumbnail
Browse files Browse the repository at this point in the history
Fixes #842
  • Loading branch information
lyzadanger committed May 18, 2023
1 parent 75e525b commit 6eed7e1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/data/Thumbnail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ type ComponentProps = {
borderless?: boolean;
loading?: boolean;

/**
* How should AspectRatio fit the contained content?
*/
objectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';

/**
* Custom content to show if there are no children, and not in a loading state
*/
Expand Down Expand Up @@ -44,6 +49,7 @@ const Thumbnail = function Thumbnail({

borderless = false,
loading = false,
objectFit = 'cover',
placeholder,
ratio = '16/9',
size = 'md',
Expand Down Expand Up @@ -78,7 +84,7 @@ const Thumbnail = function Thumbnail({
})}
>
<div className="bg-white h-full w-full flex items-center justify-center overflow-hidden">
<AspectRatio ratio={ratio}>
<AspectRatio ratio={ratio} objectFit={objectFit}>
{loading ? (
<div>
<Spinner size={size} />
Expand Down

0 comments on commit 6eed7e1

Please sign in to comment.