diff --git a/CHANGELOG.md b/CHANGELOG.md index 11a3e56e3a..340fb86821 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixes - Remove space between `Button.Group` items without `circular` prop @Bugaa92 ([#973](https://github.com/stardust-ui/react/pull/973)) - Fix allow `Text` component when rendered as div to behave as block element in Teams theme @mnajdova ([#940](https://github.com/stardust-ui/react/pull/940)) +- Fix font-based `Icon` styles in Teams theme @kuzhelov ([#976](https://github.com/stardust-ui/react/pull/976)) - Refactor the `ListItem` component to use the `Flex` components instead of `ItemLayout` @mnajdova ([#886](https://github.com/stardust-ui/react/pull/886)) diff --git a/packages/react/src/themes/teams/components/Avatar/avatarStyles.ts b/packages/react/src/themes/teams/components/Avatar/avatarStyles.ts index d64e1c8ba7..d6a849d6c2 100644 --- a/packages/react/src/themes/teams/components/Avatar/avatarStyles.ts +++ b/packages/react/src/themes/teams/components/Avatar/avatarStyles.ts @@ -17,6 +17,7 @@ const avatarStyles: ComponentSlotStylesInput = { const sizeInRem = pxToRem(sizeToPxValue[size]) return { + boxSizing: 'border-box', position: 'relative', backgroundColor: 'inherit', display: 'inline-block', @@ -26,6 +27,7 @@ const avatarStyles: ComponentSlotStylesInput = { } }, image: ({ variables: v }): ICSSInJSStyle => ({ + boxSizing: 'border-box', borderColor: v.avatarBorderColor, borderStyle: 'solid', borderWidth: `${v.avatarBorderWidth}px`, @@ -38,6 +40,7 @@ const avatarStyles: ComponentSlotStylesInput = { label: ({ props: { size } }): ICSSInJSStyle => { const sizeInRem = pxToRem(sizeToPxValue[size]) return { + boxSizing: 'border-box', display: 'inline-block', width: sizeInRem, height: sizeInRem, diff --git a/packages/react/src/themes/teams/components/Icon/iconStyles.ts b/packages/react/src/themes/teams/components/Icon/iconStyles.ts index 23b3a7a334..29eceda75b 100644 --- a/packages/react/src/themes/teams/components/Icon/iconStyles.ts +++ b/packages/react/src/themes/teams/components/Icon/iconStyles.ts @@ -34,13 +34,16 @@ const getFontStyles = ( fontFamily, fontSize: sizeInRems, lineHeight: 1, - textAlign: 'center', + + display: 'inline-flex', + justifyContent: 'center', + alignItems: 'center', + + width: sizeInRems, + height: sizeInRems, '::before': { content, - display: 'block', - width: sizeInRems, - height: sizeInRems, }, } } @@ -96,7 +99,7 @@ const iconStyles: ComponentSlotStylesInput = { }): ICSSInJSStyle => { const iconSpec = theme.icons[name] const rtl = theme.rtl - const isFontBased = !iconSpec || !iconSpec.isSvg + const isFontBased = name && (!iconSpec || !iconSpec.isSvg) return { backgroundColor: v.backgroundColor, @@ -104,6 +107,8 @@ const iconStyles: ComponentSlotStylesInput = { speak: 'none', verticalAlign: 'middle', + ...(!isFontBased && { boxSizing: 'border-box' }), + ...(isFontBased && getFontStyles(getIconSize(size, v.sizeModifier), name)), ...(isFontBased && { diff --git a/packages/react/src/themes/teams/components/Image/imageStyles.ts b/packages/react/src/themes/teams/components/Image/imageStyles.ts index 066e4e3d37..63a606a1b1 100644 --- a/packages/react/src/themes/teams/components/Image/imageStyles.ts +++ b/packages/react/src/themes/teams/components/Image/imageStyles.ts @@ -4,6 +4,7 @@ import { ImageProps } from '../../../../components/Image/Image' export default { root: ({ props, variables }): ICSSInJSStyle => ({ + boxSizing: 'border-box', display: 'inline-block', verticalAlign: 'middle', width: (props.fluid && '100%') || variables.width,