From d34981be989c43f52fc733f067be2fd09dd44e74 Mon Sep 17 00:00:00 2001 From: Hale Rankin Date: Wed, 19 Apr 2023 10:00:33 -0700 Subject: [PATCH] Update: Modify Image Web Component Styles (#27567) * Updates story with better placeholder images. Updates styles to ensure that shadow, shape and border work correctly when fit is center. Sets default border-radius and updates storybook shape description with detail about the default border radius. * Yarn change * Reverts style changes. Adds only essential style adjustments to meet spec. Updates attribute descriptions in the story. * Removes pixel value in description for design token: borderRadiusMedium. --- ...-482b832c-2b9e-4712-a120-a20052caf778.json | 7 +++ .../web-components/src/image/image.stories.ts | 46 ++++++++++--------- .../web-components/src/image/image.styles.ts | 11 ++++- 3 files changed, 42 insertions(+), 22 deletions(-) create mode 100644 change/@fluentui-web-components-482b832c-2b9e-4712-a120-a20052caf778.json diff --git a/change/@fluentui-web-components-482b832c-2b9e-4712-a120-a20052caf778.json b/change/@fluentui-web-components-482b832c-2b9e-4712-a120-a20052caf778.json new file mode 100644 index 00000000000000..c7e5e479567e92 --- /dev/null +++ b/change/@fluentui-web-components-482b832c-2b9e-4712-a120-a20052caf778.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Image component style updates", + "packageName": "@fluentui/web-components", + "email": "harankin@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/packages/web-components/src/image/image.stories.ts b/packages/web-components/src/image/image.stories.ts index b5ed33ed14daa0..e81972f843abf2 100644 --- a/packages/web-components/src/image/image.stories.ts +++ b/packages/web-components/src/image/image.stories.ts @@ -17,7 +17,7 @@ const imageTemplate = html` ?shadow=${x => x.shadow} shape=${x => x.shape} > - Short image description + Short image description `; @@ -98,6 +98,10 @@ export default { defaultValue: { summary: 'square', }, + type: { + summary: + 'When shape `rounded` is used, default border radius is `borderRadiusMedium`. The dev may override the default border radius using one of the following: borderRadiusSmall, borderRadiusLarge, borderRadiusXLarge.', + }, }, options: Object.values(ImageShape), control: 'select', @@ -119,8 +123,8 @@ export const Image = renderComponent(imageTemplate).bind({}); const imageLayoutBlock = html`
- - + +
`; @@ -128,18 +132,18 @@ export const BlockLayout = renderComponent(imageLayoutBlock).bind({}); // Fit: None const imageFitNoneLarge = html` -
+
- +
`; export const ImageFitNoneLarge = renderComponent(imageFitNoneLarge).bind({}); const imageFitNoneSmall = html` -
+
- 200x100 placeholder + 200x100 placeholder
`; @@ -147,27 +151,27 @@ export const ImageFitNoneSmall = renderComponent(imageFitNoneSmall).bind({}); // Fit: Center const imageFitCenterLarge = html` -
- - +
+ +
`; export const ImageFitCenterLarge = renderComponent(imageFitCenterLarge).bind({}); const imageFitCenterSmall = html` -
- - image layout story +
+ + image layout story
`; export const ImageFitCenterSmall = renderComponent(imageFitCenterSmall).bind({}); const imageFitContain = html` -
+
- image layout story + image layout story
`; @@ -176,7 +180,7 @@ export const ImageFitContain = renderComponent(imageFitContain).bind({}); const imageFitContainTall = html`
- image layout story + image layout story
`; @@ -185,7 +189,7 @@ export const ImageFitContainTall = renderComponent(imageFitContainTall).bind({}) const imageFitContainWide = html`
- image layout story + image layout story
`; @@ -195,7 +199,7 @@ export const ImageFitContainWide = renderComponent(imageFitContainWide).bind({}) const imageFitCoverSmall = html`
- image layout story + image layout story
`; @@ -204,7 +208,7 @@ export const ImageFitCoverSmall = renderComponent(imageFitCoverSmall).bind({}); const imageFitCoverMedium = html`
- image layout story + image layout story
`; @@ -213,7 +217,7 @@ export const ImageFitCoverMedium = renderComponent(imageFitCoverMedium).bind({}) const imageFitCoverLarge = html`
- image layout story + image layout story
`; @@ -223,7 +227,7 @@ export const ImageFitCoverLarge = renderComponent(imageFitCoverLarge).bind({}); const imageFitDefault = html`
- image layout story + image layout story
`; diff --git a/packages/web-components/src/image/image.styles.ts b/packages/web-components/src/image/image.styles.ts index 8437b18943ef97..ee49997014ecf0 100644 --- a/packages/web-components/src/image/image.styles.ts +++ b/packages/web-components/src/image/image.styles.ts @@ -1,5 +1,11 @@ import { css } from '@microsoft/fast-element'; -import { borderRadiusCircular, colorNeutralStroke2, shadow4, strokeWidthThin } from '../theme/design-tokens.js'; +import { + borderRadiusCircular, + borderRadiusMedium, + colorNeutralStroke2, + shadow4, + strokeWidthThin, +} from '../theme/design-tokens.js'; /** Image styles * @@ -53,4 +59,7 @@ export const styles = css` :host([shape='circular']) ::slotted(img) { border-radius: ${borderRadiusCircular}; } + :host([shape='rounded']) ::slotted(img) { + border-radius: ${borderRadiusMedium}; + } `;