UNPKG

@lobehub/ui

Version:

Lobe UI is an open-source UI component library for building AIGC web apps

1 lines 1.66 kB
{"version":3,"file":"SkeletonTitle.mjs","names":["SkeletonTitle: FC<SkeletonTitleProps>","SkeletonBlock"],"sources":["../../src/Skeleton/SkeletonTitle.tsx"],"sourcesContent":["'use client';\n\nimport { useTheme } from 'antd-style';\nimport { type FC } from 'react';\n\nimport SkeletonBlock from './SkeletonBlock';\nimport type { SkeletonTitleProps } from './type';\n\nconst DEFAULT_FONT_SIZE = 18;\n\nconst SkeletonTitle: FC<SkeletonTitleProps> = ({\n active,\n fontSize,\n lineHeight,\n height,\n width = '60%',\n style,\n className,\n ...rest\n}) => {\n const theme = useTheme();\n const baseFontSize = fontSize ?? theme.fontSize ?? DEFAULT_FONT_SIZE;\n const resolvedLineHeight = lineHeight ?? 1.6;\n const computedHeight = height ? height : Math.round(baseFontSize * resolvedLineHeight);\n const marginBlock = computedHeight - baseFontSize;\n\n return (\n <SkeletonBlock\n active={active}\n className={className}\n height={Math.round(baseFontSize + marginBlock * 0.5)}\n style={{\n marginBlock: Math.round((marginBlock * 0.5) / 2),\n ...style,\n }}\n width={width}\n {...rest}\n />\n );\n};\n\nSkeletonTitle.displayName = 'SkeletonTitle';\n\nexport default SkeletonTitle;\n"],"mappings":";;;;;;;AAQA,MAAM,oBAAoB;AAE1B,MAAMA,iBAAyC,EAC7C,QACA,UACA,YACA,QACA,QAAQ,OACR,OACA,WACA,GAAG,WACC;CACJ,MAAM,QAAQ,UAAU;CACxB,MAAM,eAAe,YAAY,MAAM,YAAY;CACnD,MAAM,qBAAqB,cAAc;CAEzC,MAAM,eADiB,SAAS,SAAS,KAAK,MAAM,eAAe,mBAAmB,IACjD;AAErC,QACE,oBAACC;EACS;EACG;EACX,QAAQ,KAAK,MAAM,eAAe,cAAc,GAAI;EACpD,OAAO;GACL,aAAa,KAAK,MAAO,cAAc,KAAO,EAAE;GAChD,GAAG;GACJ;EACM;EACP,GAAI;GACJ;;AAIN,cAAc,cAAc;AAE5B,4BAAe"}