forked from M-Labs/web2019
17 lines
671 B
JavaScript
17 lines
671 B
JavaScript
import React from "react";
|
|
import {apply as json_logic_apply, add_operation as json_add_operation} from "json-logic-js";
|
|
|
|
|
|
json_add_operation("lower", (some_str) => some_str && some_str.toLowerCase(some_str));
|
|
json_add_operation("upper", (some_str) => some_str && some_str.toUpperCase(some_str));
|
|
json_add_operation("capitalize", (some_str) => some_str && some_str.capitalizeFirstLetter(some_str));
|
|
|
|
export function Label(target, id, data, {content}) {
|
|
const resulting_string = json_logic_apply(content, data).flat().join("");
|
|
|
|
return (
|
|
<div id={id+"label"} key={id+"label"} className="options-label">
|
|
{resulting_string}
|
|
</div>
|
|
)
|
|
} |