fix(ui-toolkit): test toast configuration (#3877)

This commit is contained in:
Art 2023-05-22 18:34:02 +02:00 committed by GitHub
parent a4512e6064
commit 48109b584c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -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]
);

View File

@ -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,