export const TABLE_MENU_WIDTH = {
  default: 180,
  three: 180,
  four: 320,
};

export const resolveTableMenuWidth = buttonCount => {
  if (buttonCount >= 4) return TABLE_MENU_WIDTH.four;
  if (buttonCount === 3) return TABLE_MENU_WIDTH.three;
  return TABLE_MENU_WIDTH.default;
};

export const applyTableMenuWidth = (option, buttonCount) => ({
  ...option,
  menuWidth: Math.max(Number(option.menuWidth) || 0, resolveTableMenuWidth(buttonCount)),
});
