react-pdf-builder
Version:
Build beautiful PDF documents in React.
58 lines (57 loc) • 2.27 kB
JavaScript
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FullExample = exports.WithSwatch = exports.CustomX = exports.NoX = exports.WithX = void 0;
const react_1 = __importDefault(require("react"));
const Signature_1 = require("../../components/signature/Signature");
const PDFStory_1 = require("../parts/PDFStory");
const renderer_1 = require("@react-pdf/renderer");
const Paragraph_1 = require("../../components/typography/Paragraph");
const StoryComponent = (_a) => {
var { paragraphText } = _a, props = __rest(_a, ["paragraphText"]);
renderer_1.Font.registerEmojiSource({
format: 'png',
url: 'https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/72x72/',
});
return (react_1.default.createElement(PDFStory_1.PDFStory, null,
react_1.default.createElement(Signature_1.Signature, Object.assign({}, props, { className: "mb-1" })),
paragraphText && react_1.default.createElement(Paragraph_1.Paragraph, null, paragraphText)));
};
// === Setup ===
const meta = {
title: 'Stories/Signature', // <-- Set to your story title
component: StoryComponent,
parameters: {
options: { showPanel: false }, // Don't show addons panel
},
};
exports.default = meta;
// === Stories ===
exports.WithX = {
args: { x: true },
};
exports.NoX = {
args: {},
};
exports.CustomX = {
args: { x: true, xValue: '❌', xProps: { style: { fontSize: 20, marginBottom: 5, marginLeft: 10 } } },
};
exports.WithSwatch = {
args: { x: true, swatch: 'primary' },
};
exports.FullExample = {
args: { x: true, className: 'mb-0', paragraphText: 'Sign here' },
};
;