Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
title: Layer5 Academy vs Moocit
subtitle: Academy Comparison
date: 2025-08-18 08:00:00 -0530
thumbnail: ../../../../assets/images/academy/academy-layer5-light.png
darkthumbnail: ../../../../assets/images/academy/academy-layer5.png
thumbnail: ../../../../assets/images/academy/academy-layer5.svg
darkthumbnail: ../../../../assets/images/academy/academy-layer5.svg
description: "Layer5 Academy vs Moocit Comaprision"
type: Comparison
category: Academy
Expand Down
28 changes: 11 additions & 17 deletions src/components/Card/Card.style.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,40 +63,34 @@ export const CardWrapper = styled.div`
border-top-left-radius: 0.5rem;
border-bottom-left-radius: ${(props) => (props.$listView ? "0.5rem" : "0")};
flex-shrink: 0;
${(props) =>
props.$listView &&
`
display: flex;
align-items: center;
justify-content: center;
padding: 0.5rem;
`}
display: flex;
align-items: center;
justify-content: center;
padding: ${(props) =>
props.$listView ? "0.5rem" : "1rem 1rem 0.5rem 1rem"};

.gatsby-image-wrapper,
.old-gatsby-image-wrapper {
width: 100%;
height: 100%;
max-height: ${(props) => (props.$listView ? "100%" : "8.5rem")};
margin-top: 0;
transition: all 0.3s ease-in;
display: flex;
align-items: center;
justify-content: center;
${(props) =>
props.$listView &&
`
border-radius: 0.25rem;
overflow: hidden;
`}
border-radius: 0.25rem;
overflow: hidden;
}

.gatsby-image-wrapper img,
.old-gatsby-image-wrapper img {
max-width: 100%;
max-height: 100%;
width: ${(props) => (props.$listView ? "100%" : "auto")};
height: ${(props) => (props.$listView ? "100%" : "auto")};
width: 100%;
height: 100%;
display: block;
object-fit: ${(props) => (props.$listView ? "cover" : "contain")};
object-fit: contain;
object-position: center;
margin: 0 auto;
}
Expand Down
37 changes: 29 additions & 8 deletions src/components/Card/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,39 @@ const Card = ({
listView = false,
}) => {
const { isDark } = useStyledDarkMode();
const thumbnail =
isDark &&
frontmatter.darkthumbnail &&
frontmatter.darkthumbnail.publicURL !== frontmatter.thumbnail.publicURL
? frontmatter.darkthumbnail
: frontmatter.thumbnail;

const width = thumbnail?.childImageSharp?.gatsbyImageData?.width;
const height = thumbnail?.childImageSharp?.gatsbyImageData?.height;
const isSquareOrPortrait = width && height && width / height <= 1.25;

const isLogo =
thumbnail?.extension === "svg" ||
thumbnail?.publicURL?.endsWith(".svg") ||
isSquareOrPortrait ||
thumbnail?.publicURL?.toLowerCase()?.includes("logo") ||
thumbnail?.publicURL?.toLowerCase()?.includes("icon") ||
thumbnail?.publicURL?.toLowerCase()?.includes("cncf-landscape") ||
thumbnail?.publicURL?.toLowerCase()?.includes("academy") ||
thumbnail?.publicURL?.toLowerCase()?.includes("docker-swarm") ||
thumbnail?.publicURL?.toLowerCase()?.includes("smp");

return (
<CardWrapper fixed={!!frontmatter.abstract} $listView={listView}>
<div className="post-block">
<div className="post-thumb-block">
<Image
{...(isDark &&
frontmatter.darkthumbnail &&
frontmatter.darkthumbnail.publicURL !==
frontmatter.thumbnail.publicURL
? frontmatter.darkthumbnail
: frontmatter.thumbnail)}
imgStyle={{ objectFit: "cover" }}
{...thumbnail}
imgStyle={{
objectFit:
frontmatter.thumbnailFit || (isLogo ? "contain" : "cover"),
transform: isLogo ? "scale(0.92)" : "none",
}}
loading={loading}
fetchpriority={fetchpriority}
alt={frontmatter.title}
Expand Down Expand Up @@ -98,4 +119,4 @@ const Card = ({
);
};

export default Card;
export default Card;
44 changes: 29 additions & 15 deletions src/components/image.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,49 @@
import React from "react";
import { GatsbyImage } from "gatsby-plugin-image";

const Image = ({ childImageSharp, extension, publicURL, alt, imgStyle, ...rest }) => {

const Image = ({
childImageSharp,
extension,
publicURL,
alt,
imgStyle,
style,
...rest
}) => {
if (!childImageSharp && extension === "svg") {
return (
<div className="old-gatsby-image-wrapper" style={{ width: "100%", height: "auto" }}>
<div
className="old-gatsby-image-wrapper"
style={{ width: "100%", height: "100%", ...style }}
>
<img
src={publicURL}
alt={alt || "Blog image"}
width="100%"
height="auto"
height="100%"
style={{
objectFit: imgStyle?.objectFit || "cover",
...imgStyle
...imgStyle,
}}
{...rest}
/>
Comment thread
dhruveshmishra marked this conversation as resolved.
</div>
);
}

return <GatsbyImage
key={publicURL}
image={childImageSharp?.gatsbyImageData}
alt={alt || "Blog image"}
imgStyle={{
objectFit: imgStyle?.objectFit || "cover",
...imgStyle
}}
{...rest}
/>;
return (
<GatsbyImage
key={publicURL}
image={childImageSharp?.gatsbyImageData}
alt={alt || "Blog image"}
imgStyle={{
objectFit: imgStyle?.objectFit || "cover",
...imgStyle,
}}
style={style}
{...rest}
/>
);
};

export default Image;
Loading