2024-03-29 20:08:34 -04:00
|
|
|
import { TemplateOptions, Question } from './types';
|
2024-09-23 15:55:37 -04:00
|
|
|
import textType from './TextType';
|
2024-03-29 20:08:34 -04:00
|
|
|
import { state } from '.';
|
|
|
|
|
import { theme } from '../constants';
|
|
|
|
|
|
|
|
|
|
interface GlobalFeedbackOptions extends TemplateOptions {
|
|
|
|
|
feedback: Question['globalFeedback'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default function GlobalFeedback({ feedback }: GlobalFeedbackOptions): string {
|
|
|
|
|
const Container = `
|
|
|
|
|
position: relative;
|
|
|
|
|
margin-top: 1rem;
|
|
|
|
|
padding: 0 1rem;
|
|
|
|
|
background-color: ${theme(state.theme, 'beige100', 'black400')};
|
|
|
|
|
color: ${theme(state.theme, 'beige900', 'gray200')};
|
|
|
|
|
border: ${theme(state.theme, 'beige300', 'black300')} ${state.theme === 'light' ? 1 : 2}px solid;
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
box-shadow: 0px 2px 5px ${theme(state.theme, 'gray400', 'black800')};
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
return feedback !== null
|
|
|
|
|
? `<div style="${Container}">
|
2024-09-23 15:55:37 -04:00
|
|
|
<p>${textType({ text: feedback })}</p>
|
2024-03-29 20:08:34 -04:00
|
|
|
</div>`
|
|
|
|
|
: ``;
|
|
|
|
|
}
|