@konturio/ui-kit
Advanced tools
Comparing version 3.9.0 to 3.9.1
{ | ||
"name": "@konturio/ui-kit", | ||
"version": "3.9.0", | ||
"version": "3.9.1", | ||
"repository": { | ||
@@ -34,3 +34,3 @@ "type": "git", | ||
}, | ||
"gitHead": "509e3454fdec1a604a29365f1c036addaf0d84b5" | ||
"gitHead": "c5400bec68da33bd2dc0c5ef8057f770b674d6ed" | ||
} |
/// <reference types="react" /> | ||
declare type HeadingTypes = 'heading-01' | 'heading-02' | 'heading-03' | 'heading-04' | 'heading-05' | 'heading-06'; | ||
export declare function Heading({ children, type }: React.PropsWithChildren<{ | ||
export declare function Heading({ children, type, tag, }: React.PropsWithChildren<{ | ||
type: HeadingTypes; | ||
tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'; | ||
}>): import("react").ReactElement<{ | ||
@@ -6,0 +7,0 @@ className: string; |
import { isValidElement, cloneElement, createElement } from 'react'; | ||
const typeToClass = (type) => `k-font-${type}`; | ||
export function Heading({ children, type }) { | ||
export function Heading({ children, type, tag, }) { | ||
if (isValidElement(children)) { | ||
return cloneElement(children, { className: `${typeToClass(type)} ${children.props.className}` }); | ||
} | ||
return createElement('h' + type.slice(-1), { className: typeToClass(type) }, children); | ||
return createElement(tag ? tag : 'h' + type.slice(-1), { className: typeToClass(type) }, children); | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
433373
7925
420