mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-06 00:07:44 +01:00
dbb62631a6
* refactor: add screen-reader-only util class * refactor: move FeedbackNPS component * feat: add FeedbackCES component * refactor: improve hidden checkbox styles * refactor: fix IFeedbackEndpointRequestBody source type * refactor: remove unnecessary event.persist() calls * refactor: remove disableEscapeKeyDown from FeedbackCES modal * refactor: make textarea label customizable * refactor: store feedback state on the backend * refactor: add FeedbackCESForm snapshot test * refactor: use extant IAuthFeedback type * refactor: fix showNPSFeedback logic for multiple feedback types
30 lines
782 B
TypeScript
30 lines
782 B
TypeScript
import React, { createContext } from 'react';
|
|
|
|
export type ShowFeedbackCES = React.Dispatch<
|
|
React.SetStateAction<IFeedbackCESState | undefined>
|
|
>;
|
|
|
|
export interface IFeedbackCESContext {
|
|
showFeedbackCES: ShowFeedbackCES;
|
|
hideFeedbackCES: () => void;
|
|
}
|
|
|
|
export interface IFeedbackCESState {
|
|
path: `/${string}`;
|
|
title: string;
|
|
text: string;
|
|
}
|
|
|
|
const showFeedbackCESPlaceholder = () => {
|
|
throw new Error('showFeedbackCES called outside feedbackCESContext');
|
|
};
|
|
|
|
const hideFeedbackCESPlaceholder = () => {
|
|
throw new Error('hideFeedbackCES called outside feedbackCESContext');
|
|
};
|
|
|
|
export const feedbackCESContext = createContext<IFeedbackCESContext>({
|
|
showFeedbackCES: showFeedbackCESPlaceholder,
|
|
hideFeedbackCES: hideFeedbackCESPlaceholder,
|
|
});
|