UNPKG

@revenuecat/purchases-ui-js

Version:

Web components for Paywalls. Powered by RevenueCat

20 lines (19 loc) 821 B
import { prefixObject, stringifyStyles } from "../../utils/style-utils"; export function getButtonStyles({ stack, zStackChildStyles }) { // Get the width of the inner stack to adjust to the outer button wrapper const width = stack?.size?.width?.type === "fill" ? "100%" : "fit-content"; // Define set of variables to be assigned to the button // Define width as an inline style const prefixedObject = prefixObject(zStackChildStyles || {}, "button"); const assignedVariables = { position: "var(--button-position, relative)", inset: "var(--button-inset, 0)", transform: "var(--button-transform, initial)", width, }; const buttonInlineStyles = stringifyStyles({ ...prefixedObject, ...assignedVariables, }); return buttonInlineStyles; }