UNPKG

@dynamic-labs/sdk-react-core

Version:

A React SDK for implementing wallet web3 authentication and authorization to your website.

37 lines (34 loc) 2.08 kB
'use client' import { __rest } from '../../../../_virtual/_tslib.js'; import { jsxs, jsx } from 'react/jsx-runtime'; import { Button, defaultButtonVariant } from '../Button/Button.js'; import { Typography } from '../Typography/Typography.js'; import { classNames } from '../../utils/functions/classNames/classNames.js'; const defaultTypographyVariantMap = { 'brand-primary': 'button_primary', card: 'body_normal', danger: 'button_primary', primary: 'button_primary', secondary: 'button_secondary', tertiary: 'button_tertiary', }; const defaultTypographyColorMap = { 'brand-primary': 'primary', card: 'primary', danger: 'white', primary: 'primary', secondary: 'primary', tertiary: 'secondary', }; const TypographyButton = (_a) => { var _b; var { children, typographyProps, copykey, disabled, leading, trailing, buttonVariant = defaultButtonVariant, description } = _a, props = __rest(_a, ["children", "typographyProps", "copykey", "disabled", "leading", "trailing", "buttonVariant", "description"]); const defaultTypographyVariant = defaultTypographyVariantMap[buttonVariant]; const defaultTypographyColor = defaultTypographyColorMap[buttonVariant]; return (jsxs(Button, Object.assign({}, props, { disabled: disabled, buttonVariant: buttonVariant, children: [leading, jsxs("div", { className: classNames('typography-button__content', { 'typography-button__content--with-description': Boolean(description), }), children: [jsx(Typography, Object.assign({ variant: defaultTypographyVariant, as: 'span' }, typographyProps, { color: disabled ? 'tertiary' : (_b = typographyProps === null || typographyProps === void 0 ? void 0 : typographyProps.color) !== null && _b !== void 0 ? _b : defaultTypographyColor, copykey: copykey, children: children })), description && (jsx(Typography, { variant: 'body_small', color: 'secondary', weight: 'medium', children: description }))] }), trailing] }))); }; export { TypographyButton };