-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Inverted appearance Adds the `appearance` prop to `Toast` and adds inverted styles to all Toast components. Renames the ToastContext to ToastContainerContext to avoid the clash with the context that is actually being used by the Toast (i.e. ToastContext) that holds the appearance value for the component. * add extra VR tests * update example * improve types * use shared context * update types * Update packages/react-components/react-toast/src/components/Toast/renderToast.tsx Co-authored-by: Oleksandr Fediashov <[email protected]> --------- Co-authored-by: Oleksandr Fediashov <[email protected]>
- Loading branch information
1 parent
0cbd837
commit dde753d
Showing
22 changed files
with
292 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 11 additions & 2 deletions
13
packages/react-components/react-toast/src/components/Toast/Toast.types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,24 @@ | ||
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities'; | ||
import { BackgroundAppearanceContextValue } from '@fluentui/react-shared-contexts'; | ||
|
||
export type ToastSlots = { | ||
root: Slot<'div'>; | ||
}; | ||
|
||
export type ToastContextValues = { | ||
backgroundAppearance: BackgroundAppearanceContextValue; | ||
}; | ||
|
||
/** | ||
* Toast Props | ||
*/ | ||
export type ToastProps = ComponentProps<ToastSlots> & {}; | ||
export type ToastProps = ComponentProps<ToastSlots> & { | ||
appearance?: BackgroundAppearanceContextValue; | ||
}; | ||
|
||
/** | ||
* State used in rendering Toast | ||
*/ | ||
export type ToastState = ComponentState<ToastSlots>; | ||
export type ToastState = ComponentState<ToastSlots> & { | ||
backgroundAppearance: BackgroundAppearanceContextValue; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
packages/react-components/react-toast/src/components/Toast/useToastContextValues.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { ToastContextValues, ToastState } from './Toast.types'; | ||
|
||
export function useToastContextValues_unstable(state: ToastState): ToastContextValues { | ||
const { backgroundAppearance } = state; | ||
|
||
return { | ||
backgroundAppearance, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.