import { __extends } from "tslib";
import * as React from 'react';
import { useTheme, ThemeContext, ThemeProvider } from '@fluentui/react/lib/Theme';
export default {
    title: 'ThemeProvider',
};
var lightTheme = {
    semanticColors: {
        bodyBackground: 'white',
        bodyText: 'black',
    },
};
var darkTheme = {
    semanticColors: {
        bodyBackground: 'black',
        bodyText: 'white',
    },
};
export var ApplyThemeToBody = function () {
    var _a = React.useState(true), isLight = _a[0], setIsLight = _a[1];
    return (React.createElement(ThemeProvider, { className: "root", applyTo: "body", theme: isLight ? lightTheme : darkTheme },
        React.createElement("button", { onClick: function () { return setIsLight(function (l) { return !l; }); } }, "Toggle theme"),
        React.createElement("div", null,
            "I am ",
            isLight ? 'light theme' : 'dark theme'),
        React.createElement(ThemeProvider, { theme: isLight ? darkTheme : lightTheme },
            React.createElement("div", null,
                "I am a nested ",
                isLight ? 'dark theme' : 'light theme'))));
};
var ThemedContentFC = function () {
    var theme = useTheme();
    console.log('theme from useTheme', theme);
    return null;
};
var ThemedContent = /** @class */ (function (_super) {
    __extends(ThemedContent, _super);
    function ThemedContent() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ThemedContent.prototype.render = function () {
        return (React.createElement(ThemeContext.Consumer, null, function (theme) {
            console.log('theme from context consumer', theme);
            return null;
        }));
    };
    return ThemedContent;
}(React.Component));
export var AccessTheme = function () { return (React.createElement(ThemeProvider, null,
    React.createElement(ThemedContent, null),
    React.createElement(ThemedContentFC, null),
    React.createElement("div", null, "See console log"))); };
//# sourceMappingURL=ThemeProvider.stories.js.map