Skip to content

Commit 7077de0

Browse files
committed
fix: adjust icon container scaling and alignment issues
1 parent c0af7e2 commit 7077de0

File tree

5 files changed

+13
-3
lines changed

5 files changed

+13
-3
lines changed

packages/pluggableWidgets/image-web/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- We fixed an issue where showing icons as datasource would scale the icon container disproportionately and cause alignment issues.
12+
913
## [1.5.0] - 2025-08-29
1014

1115
### Added

packages/pluggableWidgets/image-web/src/components/Image/Image.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ export const Image: FunctionComponent<ImageProps> = ({
129129
<ImageUi.Wrapper
130130
className={className}
131131
responsive={responsive}
132+
type={type}
132133
hasImage={image !== undefined && image.length > 0}
133134
>
134135
{content}

packages/pluggableWidgets/image-web/src/components/Image/ui.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export interface ImageWrapperProps {
1919
className?: string;
2020
responsive: boolean;
2121
hasImage: boolean;
22+
type: string;
2223
children:
2324
| ReactElement<ImageContentIcon | ImageContentImage>
2425
| [ReactElement<ImageContentIcon | ImageContentImage>, ReactElement<LightboxProps> | false];
@@ -37,6 +38,7 @@ function Wrapper(props: ImageWrapperProps): ReactElement {
3738
className={classNames(
3839
"mx-image-viewer",
3940
{ "mx-image-viewer-responsive": props.responsive },
41+
{ "mx-image-viewer-icon": props.type === "glyph" || props.type === "icon" },
4042
props.className,
4143
{ hidden: !props.hasImage }
4244
)}
@@ -67,7 +69,7 @@ function ContentIcon(props: ImageContentIcon): ReactElement {
6769
return (
6870
<span
6971
className={classNames(props.icon, { glyphicon: props.isGlyph })}
70-
style={{ ...props.style, fontSize: `${props.size}px` }}
72+
style={{ fontSize: `${props.size}px` }}
7173
{...accessibilityProps}
7274
{...onClickProps}
7375
/>

packages/pluggableWidgets/image-web/src/components/__tests__/__snapshots__/Image.spec.tsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ exports[`Image renders the structure as a background image 1`] = `
1616
exports[`Image renders the structure with a glyph icon 1`] = `
1717
<DocumentFragment>
1818
<div
19-
class="mx-image-viewer mx-image-viewer-responsive"
19+
class="mx-image-viewer mx-image-viewer-responsive mx-image-viewer-icon"
2020
>
2121
<span
2222
class="glyphicon-asterisk glyphicon"
@@ -30,7 +30,7 @@ exports[`Image renders the structure with a glyph icon 1`] = `
3030
exports[`Image renders the structure with an icon 1`] = `
3131
<DocumentFragment>
3232
<div
33-
class="mx-image-viewer mx-image-viewer-responsive"
33+
class="mx-image-viewer mx-image-viewer-responsive mx-image-viewer-icon"
3434
>
3535
<span
3636
class="mx-icon mx-icon-asterisk"

packages/pluggableWidgets/image-web/src/ui/Image.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
.mx-image-viewer {
22
width: 100%;
33
height: 100%;
4+
&-icon {
5+
height: unset;
6+
}
47
}
58

69
.mx-image-viewer-responsive img {

0 commit comments

Comments
 (0)