@pnp/spfx-controls-react
Version:
Reusable React controls for SharePoint Framework solutions
40 lines • 2.4 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SelectUploadLocation = void 0;
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var ControlStrings_1 = tslib_1.__importDefault(require("ControlStrings"));
var react_components_1 = require("@fluentui/react-components");
var react_icons_1 = require("@fluentui/react-icons");
var EUploadLocations_1 = require("../constants/EUploadLocations");
var useStyles = (0, react_components_1.makeStyles)({
root: tslib_1.__assign({ display: "flex", flexDirection: "row", alignItems: "center", justifyContent: "start" }, react_components_1.shorthands.gap("5px")),
iconStyles: {
width: "18px",
height: "18px",
color: react_components_1.tokens.colorBrandForeground1,
},
});
var RenderLabel = function () {
var styles = useStyles();
return (React.createElement("div", { className: styles.root },
React.createElement(react_icons_1.WebAssetRegular, { className: styles.iconStyles }),
React.createElement(react_components_1.Body1, null, ControlStrings_1.default.ImagePickerUploadLocationLabel)));
};
var SelectUploadLocation = function (props) {
var _a = React.useState(EUploadLocations_1.EUploadLocations.CurrentSite), value = _a[0], setValue = _a[1];
var onSelectedLocation = props.onSelectedLocation;
var onChange = React.useCallback(function (data) {
setValue(data.value);
if (onSelectedLocation) {
onSelectedLocation(data.value);
}
}, []);
return (React.createElement(React.Fragment, null,
React.createElement(react_components_1.Field, { label: React.createElement(RenderLabel, null), style: { paddingBottom: 10 } },
React.createElement(react_components_1.RadioGroup, { value: value, onChange: function (_, data) { return onChange(data); }, layout: "horizontal" },
React.createElement(react_components_1.Radio, { value: EUploadLocations_1.EUploadLocations.OneDrive, label: ControlStrings_1.default.ImagePickerUploadLocationOndriveLabel }),
React.createElement(react_components_1.Radio, { value: EUploadLocations_1.EUploadLocations.CurrentSite, label: ControlStrings_1.default.ImagePickerUploadLocationSharePointLabel })))));
};
exports.SelectUploadLocation = SelectUploadLocation;
//# sourceMappingURL=SelectUploadLocation.js.map