@nutui/nutui-react
Version:
京东风格的轻量级移动端 React 组件库,支持一套代码生成 H5 和小程序
32 lines (31 loc) • 1.26 kB
JavaScript
import React__default from "react";
import classNames from "classnames";
import { D as DataContext } from "./UserContext.js";
import { C as ComponentDefaults } from "./typings.js";
const classPrefix = "nut-row";
const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { type: "", justify: "start", align: "flex-start", wrap: "nowrap", gutter: "0" });
const Row = (props) => {
const { className, style, children, type, justify, align, wrap, gutter, onClick } = Object.assign(Object.assign({}, defaultProps), props);
const getClass = (prefix, type2) => {
const classType = type2 ? `nut-row-${prefix}-${type2}` : "";
const className2 = prefix ? classType : `nut-row-${type2}`;
return className2;
};
const getClasses = () => {
return classNames(classPrefix, getClass("", type), getClass("justify", justify), getClass("align", align), getClass("flex", wrap));
};
const parentRow = {
gutter
};
return React__default.createElement(DataContext.Provider, { value: parentRow }, React__default.createElement("div", {
className: classNames(getClasses(), className),
style,
onClick: (e) => {
onClick && onClick(e, "row");
}
}, children));
};
Row.displayName = "NutRow";
export {
Row as default
};