fix(ui-toolkit): test toast configuration (#3877)
This commit is contained in:
parent
a4512e6064
commit
48109b584c
@ -7,10 +7,11 @@ import { ToastPosition, useToastsConfiguration, useToasts } from './use-toasts';
|
||||
import { useCallback } from 'react';
|
||||
import { Intent } from '../../utils/intent';
|
||||
|
||||
const testToast = {
|
||||
const TEST_TOAST = {
|
||||
id: 'test-toast',
|
||||
intent: Intent.Primary,
|
||||
content: <>{t('This is an example of a toast notification')}</>,
|
||||
onClose: () => useToasts.getState().remove('test-toast'),
|
||||
};
|
||||
|
||||
export const ToastPositionSetter = () => {
|
||||
@ -20,7 +21,7 @@ export const ToastPositionSetter = () => {
|
||||
const handleChange = useCallback(
|
||||
(position: ToastPosition) => {
|
||||
setPostion(position);
|
||||
setToast(testToast);
|
||||
setToast(TEST_TOAST);
|
||||
},
|
||||
[setToast, setPostion]
|
||||
);
|
||||
|
@ -109,12 +109,12 @@ export enum ToastPosition {
|
||||
BottomCenter,
|
||||
}
|
||||
|
||||
type ToastConfiguration = {
|
||||
type ToastsConfiguration = {
|
||||
position: ToastPosition;
|
||||
setPosition: (position: ToastPosition) => void;
|
||||
};
|
||||
|
||||
export const useToastsConfiguration = create<ToastConfiguration>()(
|
||||
export const useToastsConfiguration = create<ToastsConfiguration>()(
|
||||
persist(
|
||||
immer((set) => ({
|
||||
position: ToastPosition.BottomRight,
|
||||
|
Loading…
Reference in New Issue
Block a user