diff --git a/apps/vr-tests-react-components/src/stories/Link/AnchorLink.stories.tsx b/apps/vr-tests-react-components/src/stories/Link/AnchorLink.stories.tsx index 82bb6a566432ec..347e07e9116ef1 100644 --- a/apps/vr-tests-react-components/src/stories/Link/AnchorLink.stories.tsx +++ b/apps/vr-tests-react-components/src/stories/Link/AnchorLink.stories.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import type { Meta } from '@storybook/react'; import { Link, LinkProps } from '@fluentui/react-link'; -import { InvertedBackground, steps } from './utils'; +import { InvertedBackground, BrandBackground, steps } from './utils'; import { DARK_MODE, getStoryVariant, HIGH_CONTRAST, RTL } from '../../utilities'; import type { StoryParameters } from 'storywright'; @@ -70,6 +70,15 @@ export const InvertedDisabled = () => ( ); InvertedDisabled.storyName = 'Inverted disabled'; +export const Brand = () => ( + + Link on brand background + +); + +export const BrandDarkMode = getStoryVariant(Brand, DARK_MODE); +export const BrandHighContrast = getStoryVariant(Brand, HIGH_CONTRAST); + export const InvertedDisabledHighContrast = getStoryVariant(InvertedDisabled, HIGH_CONTRAST); export const InvertedDisabledDarkMode = getStoryVariant(InvertedDisabled, DARK_MODE); diff --git a/apps/vr-tests-react-components/src/stories/Link/ButtonLink.stories.tsx b/apps/vr-tests-react-components/src/stories/Link/ButtonLink.stories.tsx index 19ea19098ab67e..01edbf9125d2d5 100644 --- a/apps/vr-tests-react-components/src/stories/Link/ButtonLink.stories.tsx +++ b/apps/vr-tests-react-components/src/stories/Link/ButtonLink.stories.tsx @@ -3,7 +3,7 @@ import * as React from 'react'; import type { Meta } from '@storybook/react'; import { Link, LinkProps } from '@fluentui/react-link'; -import { InvertedBackground, steps } from './utils'; +import { InvertedBackground, BrandBackground, steps } from './utils'; import { DARK_MODE, getStoryVariant, HIGH_CONTRAST, RTL } from '../../utilities'; import type { StoryParameters } from 'storywright'; @@ -63,6 +63,15 @@ export const InvertedDisabled = () => ( ); InvertedDisabled.storyName = 'Inverted disabled'; +export const Brand = () => ( + + Link on brand background + +); + +export const BrandDarkMode = getStoryVariant(Brand, DARK_MODE); +export const BrandHighContrast = getStoryVariant(Brand, HIGH_CONTRAST); + export const InvertedDisabledHighContrast = getStoryVariant(InvertedDisabled, HIGH_CONTRAST); export const InvertedDisabledDarkMode = getStoryVariant(InvertedDisabled, DARK_MODE); diff --git a/apps/vr-tests-react-components/src/stories/Link/SpanLink.stories.tsx b/apps/vr-tests-react-components/src/stories/Link/SpanLink.stories.tsx index 1e1ca6bd270d36..2a0e978822a046 100644 --- a/apps/vr-tests-react-components/src/stories/Link/SpanLink.stories.tsx +++ b/apps/vr-tests-react-components/src/stories/Link/SpanLink.stories.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import type { Meta } from '@storybook/react'; import { Link, LinkProps } from '@fluentui/react-link'; -import { InvertedBackground, steps } from './utils'; +import { InvertedBackground, BrandBackground, steps } from './utils'; import { DARK_MODE, getStoryVariant, HIGH_CONTRAST, RTL } from '../../utilities'; import type { StoryParameters } from 'storywright'; @@ -42,7 +42,6 @@ export const InlineDisabledFocusable = () => ( used alongside other text content. ); - export const Inverted = () => ( Link on inverted background @@ -72,4 +71,14 @@ export const WrapsCorrectlyAsAnInlineElement = () => ( expected. ); + +export const Brand = () => ( + + Link on brand background + +); + +export const BrandDarkMode = getStoryVariant(Brand, DARK_MODE); +export const BrandHighContrast = getStoryVariant(Brand, HIGH_CONTRAST); + WrapsCorrectlyAsAnInlineElement.storyName = 'Wraps correctly as an inline element'; diff --git a/apps/vr-tests-react-components/src/stories/Link/utils.tsx b/apps/vr-tests-react-components/src/stories/Link/utils.tsx index dcb45302663bfe..8e2446b802963d 100644 --- a/apps/vr-tests-react-components/src/stories/Link/utils.tsx +++ b/apps/vr-tests-react-components/src/stories/Link/utils.tsx @@ -11,6 +11,13 @@ const useInvertedBackgroundStyles = makeStyles({ }, }); +const useBrandBackgroundStyles = makeStyles({ + root: { + ...shorthands.padding('14px'), + backgroundColor: tokens.colorBrandBackgroundStatic, + }, +}); + export const InvertedBackground: React.FC<{ children: React.ReactNode }> = ({ children }) => { const styles = useInvertedBackgroundStyles(); return ( @@ -20,6 +27,15 @@ export const InvertedBackground: React.FC<{ children: React.ReactNode }> = ({ ch ); }; +export const BrandBackground: React.FC<{ children: React.ReactNode }> = ({ children }) => { + const styles = useBrandBackgroundStyles(); + return ( +
+ {children} +
+ ); +}; + export const steps = new Steps() .snapshot('default') .hover('.fui-Link') diff --git a/change/@fluentui-react-link-be0dc59d-3e7e-4f18-b070-9f094e989eda.json b/change/@fluentui-react-link-be0dc59d-3e7e-4f18-b070-9f094e989eda.json new file mode 100644 index 00000000000000..fbfcbf23a9a4dd --- /dev/null +++ b/change/@fluentui-react-link-be0dc59d-3e7e-4f18-b070-9f094e989eda.json @@ -0,0 +1,7 @@ +{ + "type": "minor", + "comment": "feat: add brand appearance variant", + "packageName": "@fluentui/react-link", + "email": "vgenaev@gmail.com", + "dependentChangeType": "patch" +} diff --git a/change/@fluentui-react-shared-contexts-c6042978-85d9-480f-a2b0-67d6c410a7bc.json b/change/@fluentui-react-shared-contexts-c6042978-85d9-480f-a2b0-67d6c410a7bc.json new file mode 100644 index 00000000000000..138b126daa34d6 --- /dev/null +++ b/change/@fluentui-react-shared-contexts-c6042978-85d9-480f-a2b0-67d6c410a7bc.json @@ -0,0 +1,7 @@ +{ + "type": "minor", + "comment": "feat: add brand appearance variant for background context", + "packageName": "@fluentui/react-shared-contexts", + "email": "vgenaev@gmail.com", + "dependentChangeType": "patch" +} diff --git a/packages/react-components/react-link/library/src/components/Link/useLinkStyles.styles.ts b/packages/react-components/react-link/library/src/components/Link/useLinkStyles.styles.ts index 5d2c05bcd5acba..fab8c7cdef2f1d 100644 --- a/packages/react-components/react-link/library/src/components/Link/useLinkStyles.styles.ts +++ b/packages/react-components/react-link/library/src/components/Link/useLinkStyles.styles.ts @@ -91,8 +91,16 @@ const useStyles = makeStyles({ color: tokens.colorNeutralForegroundDisabled, }, }, - inverted: { + color: tokens.colorNeutralForegroundInverted2, + ':hover': { + color: tokens.colorNeutralForegroundInverted2, + }, + ':active': { + color: tokens.colorNeutralForegroundInverted2, + }, + }, + brand: { color: tokens.colorNeutralForegroundInvertedLink, ':hover': { color: tokens.colorNeutralForegroundInvertedLinkHover, @@ -117,6 +125,7 @@ export const useLinkStyles_unstable = (state: LinkState): LinkState => { root.as === 'button' && styles.button, appearance === 'subtle' && styles.subtle, backgroundAppearance === 'inverted' && styles.inverted, + backgroundAppearance === 'brand' && styles.brand, inline && styles.inline, disabled && styles.disabled, state.root.className, diff --git a/packages/react-components/react-shared-contexts/library/etc/react-shared-contexts.api.md b/packages/react-components/react-shared-contexts/library/etc/react-shared-contexts.api.md index b159393377e917..32323a2d71971f 100644 --- a/packages/react-components/react-shared-contexts/library/etc/react-shared-contexts.api.md +++ b/packages/react-components/react-shared-contexts/library/etc/react-shared-contexts.api.md @@ -28,7 +28,7 @@ export { AnnounceProvider } export { AnnounceProvider as AnnounceProvider_unstable } // @internal (undocumented) -export type BackgroundAppearanceContextValue = 'inverted' | undefined; +export type BackgroundAppearanceContextValue = 'inverted' | 'brand' | undefined; // @internal (undocumented) export const BackgroundAppearanceProvider: React_2.Provider; diff --git a/packages/react-components/react-shared-contexts/library/src/BackgroundAppearanceContext/BackgroundAppearanceContext.ts b/packages/react-components/react-shared-contexts/library/src/BackgroundAppearanceContext/BackgroundAppearanceContext.ts index dee4d3e5b6e2f4..674ac9eff69abe 100644 --- a/packages/react-components/react-shared-contexts/library/src/BackgroundAppearanceContext/BackgroundAppearanceContext.ts +++ b/packages/react-components/react-shared-contexts/library/src/BackgroundAppearanceContext/BackgroundAppearanceContext.ts @@ -5,7 +5,7 @@ import * as React from 'react'; /** * @internal */ -export type BackgroundAppearanceContextValue = 'inverted' | undefined; +export type BackgroundAppearanceContextValue = 'inverted' | 'brand' | undefined; /** * @internal