How to use the @ui5/webcomponents-react-base/lib/Optional.Optional.of function in @ui5/webcomponents-react-base

To help you get started, we’ve selected a few @ui5/webcomponents-react-base examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SAP / ui5-webcomponents-react / packages / charts / src / internal / ChartLegend.ts View on Github external
const getSymbolForDataset = (type, dataset) => {
  const datasetMeta: any = dataset.hasOwnProperty('_meta') ? Object.values(dataset._meta)[0] : null;
  const elementType = Optional.of(datasetMeta, 'type').orElse(type);
  switch (elementType) {
    case 'line':
      return `
        <div style="width: 5px; height: 2px; background-color: ${dataset.backgroundColor}; border-top-left-radius: 2px; border-bottom-left-radius: 2px; margin-right: 2px"></div>
        <div style="width: 10px; height: 10px; background-color: ${dataset.backgroundColor}; border-radius: 50%;"></div>
        <div style="width: 5px; height: 2px; background-color: ${dataset.backgroundColor}; border-top-right-radius: 2px; border-bottom-right-radius: 2px; margin-left: 2px; margin-right: 8px"></div>
      `;
    default:
      return `<div style="width: 14px; height: 14px; border-radius: 2px; background-color: ${dataset.backgroundColor}; margin-right: 8px"></div>`;
  }
};