import { QDialog, QInput, QSelect, QScrollArea, QCard } from "quasar";
import { defineBoot } from "#q-app/wrappers";

/**
 * Set some default properties on a component
 */
const SetComponentDefaults = (component, defaults) => {
  Object.keys(defaults).forEach((prop) => {
    component.props[prop] =
      Array.isArray(component.props[prop]) === true ||
      typeof component.props[prop] === "function"
        ? { type: component.props[prop], default: defaults[prop] }
        : { ...component.props[prop], default: defaults[prop] };
  });
};

export default defineBoot(() => {
  SetComponentDefaults(QDialog, {
    transitionShow: "slide-up",
    transitionHide: "slide-down",
  });
  SetComponentDefaults(QInput, {
    rounded: true,
    dark: false,
    standout: true,
    dense: true,
  });
  SetComponentDefaults(QSelect, {
    rounded: true,
    standout: true,
    dark: false,
    dense: true,
  });
  SetComponentDefaults(QCard, {
    flat: true,
  });
  SetComponentDefaults(QScrollArea, {
    thumbStyle: {
      borderRadius: "4px",
      background: "#A6A6A6",
      width: "6px",
      opacity: 0.6,
    },
    verticalOffset: [4, 2],
    horizontalOffset: [0, 2],
  });
});
