UNPKG

react-pdf-builder

Version:
56 lines (55 loc) 2.29 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Custom = exports.WithHref = exports.Pill = exports.Regular = void 0; const react_1 = __importDefault(require("react")); const Button_1 = require("../../components/button/Button"); const Box_1 = require("../../components/layout/Box"); const PDFThemeProvider_1 = require("../../components/theme/PDFThemeProvider"); const PDFStory_1 = require("../parts/PDFStory"); const StoryComponent = (props) => { var _a, _b, _c, _d, _e, _f; const theme = (0, PDFThemeProvider_1.usePDFThemeContext)(); const swatches = [ undefined, ...Object.keys((_b = (_a = theme.colorScheme) === null || _a === void 0 ? void 0 : _a.colors) !== null && _b !== void 0 ? _b : {}), ...Object.keys((_d = (_c = theme.colorScheme) === null || _c === void 0 ? void 0 : _c.theme) !== null && _d !== void 0 ? _d : {}), ...Object.keys((_f = (_e = theme.colorScheme) === null || _e === void 0 ? void 0 : _e.greyscale) !== null && _f !== void 0 ? _f : {}), 'link', ]; const elements = swatches.map((swatch) => (react_1.default.createElement(Button_1.Button, Object.assign({ wrap: false, key: swatch, swatch: swatch }, props), swatch ? swatch.substring(0, 1).toUpperCase() + swatch.substring(1) : 'Default'))); return (react_1.default.createElement(PDFStory_1.PDFStory, null, react_1.default.createElement(Box_1.Box, { className: "justify-content-center flex-wrap gap-3" }, elements))); }; // === Setup === const meta = { title: 'Stories/Button', // <-- Set to your story title component: StoryComponent, parameters: { options: { showPanel: false }, // Don't show addons panel }, }; exports.default = meta; // === Stories === exports.Regular = { args: {}, }; exports.Pill = { args: { pill: true }, }; exports.WithHref = { args: { href: 'https://github.com/justinmahar/react-pdf-builder' }, }; exports.Custom = { args: { style: { borderRadius: 20, width: 250, fontSize: 30, borderColor: 'black', borderWidth: 1, }, }, };