"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomizeUsage = void 0;
const react_1 = __importDefault(require("react"));
const react_native_1 = require("react-native");
const react_native_2 = require("@fluentui/react-native");
const theme_types_1 = require("@fluentui-react-native/theme-types");
const slider_1 = __importDefault(require("@react-native-community/slider"));
const styles_1 = require("./styles");
const styles_2 = require("../Common/styles");
const NativeSlider = slider_1.default;
const styles = react_native_1.StyleSheet.create({ slider: { ...styles_2.commonTestStyles.vmargin, flex: 1 } });
const StyledSlider = (props) => {
    const { title, min, max, initial, onChange, current, step } = props;
    const theme = (0, theme_types_1.useTheme)();
    return (react_1.default.createElement(react_native_1.View, { style: { flexDirection: 'row' } },
        react_1.default.createElement(react_native_1.Text, { style: { flex: 0.5, color: theme.colors.inputText } }, title),
        react_1.default.createElement(NativeSlider, { step: step || 1, minimumValue: min, maximumValue: max, value: initial, style: styles.slider, onValueChange: onChange }),
        react_1.default.createElement(react_native_1.Text, { style: { flex: 0.2, color: theme.colors.inputText } }, current)));
};
const StyledTextInput = (props) => {
    const theme = (0, theme_types_1.useTheme)();
    const textInputStyles = [
        styles_2.commonTestStyles.textBox,
        { flex: 1, marginHorizontal: 5, borderColor: theme.colors.disabledBodyText, color: theme.colors.inputText },
    ];
    return (react_1.default.createElement(react_native_1.TextInput, { accessibilityLabel: props.placeholder, style: textInputStyles, placeholderTextColor: theme.colors.disabledBodyText, blurOnSubmit: true, ...props }));
};
const StyledSwitch = (props) => {
    const { title, value, onChange } = props;
    const theme = (0, theme_types_1.useTheme)();
    return (react_1.default.createElement(react_native_1.View, { style: styles_2.commonTestStyles.switch },
        react_1.default.createElement(react_native_1.Text, { style: { color: theme.colors.inputText, flex: 1 } }, title),
        react_1.default.createElement(react_native_1.Switch, { style: { flex: 1 }, value: value, onValueChange: onChange })));
};
const CustomizeUsage = () => {
    const [showImage, setShowImage] = react_1.default.useState(true);
    const [showRings, setShowRings] = react_1.default.useState(true);
    const [showPresence, setShowPresence] = react_1.default.useState(true);
    const [showColoredBackground, setShowColoredBackground] = react_1.default.useState(false);
    const [transparent, setTransparent] = react_1.default.useState(false);
    const [coinColor, setCoinColor] = react_1.default.useState('green');
    const [textColor, setTextColor] = react_1.default.useState('white');
    const [coinSize, setCoinsize] = react_1.default.useState(88);
    const [ringThickness, setRingThickness] = react_1.default.useState(4);
    const [innerGap, setInnerGap] = react_1.default.useState(4);
    const [iconSize, setIconSize] = react_1.default.useState(20);
    const [iconStrokeWidth, setIconStrokeWidth] = react_1.default.useState(4);
    const [ringColor, setRingColor] = react_1.default.useState('green');
    const [ringBackgroundColor, setRingBackgroundColor] = react_1.default.useState(undefined);
    const CustomizedPersonaCoin = react_1.default.useMemo(() => {
        const tokens = {
            backgroundColor: coinColor,
            color: textColor,
            ring: { ringColor: 'red' },
            coinSize: coinSize,
            iconSize: iconSize,
            iconStrokeWidth: iconStrokeWidth,
        };
        return react_native_2.PersonaCoin.customize({ tokens });
    }, [coinColor, textColor, coinSize, iconSize, iconStrokeWidth]);
    return (react_1.default.createElement(react_native_1.View, { style: { flexDirection: 'column', padding: 10, backgroundColor: showColoredBackground ? 'gray' : 'transparent' } },
        react_1.default.createElement(react_native_1.View, { style: { flexDirection: 'row', padding: 20, alignItems: 'center' } },
            react_1.default.createElement(react_native_1.View, { style: { width: '35%', alignItems: 'center' } },
                react_1.default.createElement(CustomizedPersonaCoin, { initials: "SB", imageDescription: "Photo of Satya Nadella", imageUrl: showImage ? styles_1.steveBallmerPhotoUrl : undefined, presence: showPresence && iconSize ? 'away' : undefined, ring: showRings && ringThickness
                        ? {
                            ringColor,
                            ringBackgroundColor,
                            ringThickness,
                            innerGap,
                            transparent,
                        }
                        : undefined })),
            react_1.default.createElement(react_native_1.View, { style: { width: '50%', marginLeft: 30 } },
                react_1.default.createElement(StyledSwitch, { title: "Change Background", value: showColoredBackground, onChange: setShowColoredBackground }),
                react_1.default.createElement(StyledSwitch, { title: "Show Image", value: showImage, onChange: setShowImage }),
                react_1.default.createElement(StyledSwitch, { title: "Show Presence", value: showPresence, onChange: setShowPresence }),
                react_1.default.createElement(StyledSwitch, { title: "Show Rings", value: showRings, onChange: setShowRings }),
                react_1.default.createElement(StyledSwitch, { title: "Show transparent rings", value: transparent, onChange: setTransparent }))),
        react_1.default.createElement(react_native_1.View, null,
            react_1.default.createElement(StyledSlider, { min: 8, max: 120, initial: 88, onChange: setCoinsize, current: coinSize, step: 8, title: "coinSize" }),
            react_1.default.createElement(StyledSlider, { min: 0, max: 8, initial: 4, onChange: setRingThickness, current: ringThickness, title: "ringThickness" }),
            react_1.default.createElement(StyledSlider, { min: 0, max: 8, initial: 4, onChange: setInnerGap, current: innerGap, title: "innerGap" }),
            react_1.default.createElement(StyledSlider, { min: 0, max: 28, initial: 20, onChange: setIconSize, current: iconSize, step: 4, title: "iconSize" }),
            react_1.default.createElement(StyledSlider, { min: 2, max: 8, initial: 4, onChange: setIconStrokeWidth, current: iconStrokeWidth, title: "iconStrokeWidth" }),
            react_1.default.createElement(react_native_1.View, { style: { flexDirection: 'row' } },
                react_1.default.createElement(StyledTextInput, { placeholder: "Ring glow color", onSubmitEditing: (e) => {
                        setRingColor(e.nativeEvent.text);
                    } }),
                react_1.default.createElement(StyledTextInput, { placeholder: "Ring background color", onSubmitEditing: (e) => {
                        setRingBackgroundColor(e.nativeEvent.text);
                    } })),
            react_1.default.createElement(react_native_1.View, { style: { flexDirection: 'row' } },
                react_1.default.createElement(StyledTextInput, { placeholder: "Background color", onSubmitEditing: (e) => {
                        setCoinColor(e.nativeEvent.text);
                    } }),
                react_1.default.createElement(StyledTextInput, { placeholder: "Initials text color", onSubmitEditing: (e) => {
                        setTextColor(e.nativeEvent.text);
                    } })))));
};
exports.CustomizeUsage = CustomizeUsage;
//# sourceMappingURL=CustomizeUsage.mobile.js.map