Skip to content

Commit

Permalink
fix(): entry image styling (#1520)
Browse files Browse the repository at this point in the history
  • Loading branch information
quininez committed Dec 15, 2021
1 parent 9e22b30 commit 14261c5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions ui/design/src/components/Editor/image-gallery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const StyledImg = styled.img<{ singleImage?: boolean; isMobile?: boolean }>`
`;

const StyledImgContainer = styled.div`
display: flex;
position: relative;
border: 1px solid ${props => props.theme.colors.border};
border-radius: ${props => props.theme.shapes.smallBorderRadius};
Expand Down
14 changes: 14 additions & 0 deletions ui/design/src/components/EntryCard/entry-image-gallery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const StyledImg = styled.img<{ singleImage?: boolean }>`
`;

const StyledImgContainer = styled.div`
display: flex;
position: relative;
border-radius: ${props => props.theme.shapes.smallBorderRadius};
border: 1px solid ${props => props.theme.colors.border};
Expand All @@ -40,6 +41,10 @@ const StyledPill = styled(Box)`
z-index: 1;
`;

const SingleImageContainer = styled.div`
display: flex;
`;

export interface ImageObject {
src: string;
size: { width: number; height: number; naturalWidth: number; naturalHeight: number };
Expand Down Expand Up @@ -129,6 +134,15 @@ const EntryImageGallery: React.FC<IImageGallery> = props => {
// limit shown images to 4
const displayedImages = images.slice(0, 4);

if (images.length === 1) {
return (
<SingleImageContainer>
{images.map((image, index) => (
<ImageGridItem image={image} key={index} />
))}
</SingleImageContainer>
);
}
return (
<StyledGrid>
{displayedImages.map((image, index) => (
Expand Down

0 comments on commit 14261c5

Please sign in to comment.