Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOP-5142: Remove border radius one dark mode images #1315

Merged
merged 3 commits into from
Dec 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions src/components/Image.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { useDarkMode } from '@leafygreen-ui/leafygreen-provider';
import { palette } from '@leafygreen-ui/palette';
import ImageContext from '../context/image-context';
import { getNestedValue } from '../utils/get-nested-value';
import { getPageSlug } from '../utils/get-page-slug';
import { removeLeadingSlash } from '../utils/remove-leading-slash';
import { theme } from '../theme/docsTheme';

Expand Down Expand Up @@ -38,8 +37,6 @@ const gatsbyContainerStyle = css`
function getImageProps({
altText,
userOptionStyle,
slug,
sectionDepth,
width,
height,
gatsbyImage,
Expand All @@ -63,7 +60,6 @@ function getImageProps({
imageProps['height'] = height;
}

const applyBorder = hasBorder || (darkMode && getPageSlug(slug) !== '/' && sectionDepth > 1);
const borderColor = darkMode && hasBorder ? palette.gray.dark2 : darkMode ? 'transparent' : palette.gray.light1;

if (gatsbyImage && loading === 'lazy') {
Expand All @@ -73,7 +69,7 @@ function getImageProps({
directiveClass,
customAlign,
className,
applyBorder ? borderContainerStyling : ''
hasBorder ? borderContainerStyling : ''
);
imageProps['imgStyle'] = {
'--border-color': borderColor,
Expand All @@ -83,7 +79,7 @@ function getImageProps({
imageProps['srcSet'] = srcSet;
imageProps['className'] = cx(
defaultImageStyling,
applyBorder ? borderStyling : '',
hasBorder ? borderStyling : '',
directiveClass,
customAlign,
className
Expand All @@ -96,7 +92,7 @@ function getImageProps({
return imageProps;
}

const Image = ({ nodeData, className, slug, sectionDepth }) => {
const Image = ({ nodeData, className }) => {
const scale = (parseInt(getNestedValue(['options', 'scale'], nodeData), 10) || 100) / 100;
const widthOption = getNestedValue(['options', 'width'], nodeData);
let height = getNestedValue(['options', 'height'], nodeData);
Expand Down Expand Up @@ -138,8 +134,6 @@ const Image = ({ nodeData, className, slug, sectionDepth }) => {
width,
height,
gatsbyImage,
slug,
sectionDepth,
hasBorder,
darkMode,
customAlign,
Expand Down
Loading