@onereach/channel-transformer
Version:
Convert data model between different channels (Slack, Microsoft Teams, Generic...)
32 lines (26 loc) • 762 B
text/typescript
import { IGenericSelect, IGenericSection } from '../../../generic/types';
import { IOption, IBoolean } from '../../types';
import { transformText } from './text';
import { transformMenuOptions } from './options';
export const transformBoolean = (msg: IBoolean): IGenericSection => {
const result: IGenericSection = {
type: 'section',
children: []
};
const text = msg.label;
if (text) {
result.children.push(transformText(text));
}
const options: Array<IOption> = [
{ label: "Yes", value: "true" },
{ label: "No", value: "false" }
];
const selectSection: IGenericSelect = {
type: 'select',
props: {
options: transformMenuOptions(options)
}
};
result.children.push(selectSection);
return result;
};