UNPKG

@lobehub/ui

Version:

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

1 lines 2.96 kB
{"version":3,"file":"GuideCard.mjs","names":["Flexbox","ActionIcon","Img"],"sources":["../../src/GuideCard/GuideCard.tsx"],"sourcesContent":["'use client';\n\nimport { cx, useThemeMode } from 'antd-style';\nimport { X } from 'lucide-react';\nimport { memo, useState } from 'react';\n\nimport ActionIcon from '@/ActionIcon';\nimport { Flexbox } from '@/Flex';\nimport Img from '@/Img';\n\nimport { styles, variants } from './style';\nimport type { GuideCardProps } from './type';\n\nconst GuideCard = memo<GuideCardProps>(\n ({\n cover,\n onClose,\n shadow,\n closable = true,\n afterClose,\n alt,\n className,\n title,\n desc,\n width,\n styles: customStyles,\n height,\n coverProps,\n variant = 'filled',\n closeIconProps,\n classNames,\n ref,\n ...rest\n }) => {\n const [show, setShow] = useState(true);\n const { isDarkMode } = useThemeMode();\n\n if (!show) return null;\n\n return (\n <Flexbox\n className={cx(variants({ isDarkMode, shadow, variant }), className)}\n ref={ref}\n {...rest}\n >\n {closable && (\n <ActionIcon\n size={'small'}\n {...closeIconProps}\n className={cx(styles.close, closeIconProps?.className)}\n icon={X}\n onClick={(e) => {\n setShow(false);\n onClose?.(e);\n afterClose?.();\n }}\n />\n )}\n {cover && (\n <Img\n alt={alt}\n className={cx(styles.cover, classNames?.cover)}\n height={height}\n src={cover}\n style={customStyles?.cover}\n width={width}\n {...coverProps}\n />\n )}\n <Flexbox\n className={cx(styles.content, classNames?.content)}\n gap={8}\n style={customStyles?.content}\n >\n {title && <div className={styles.title}>{title}</div>}\n {desc && <div className={styles.desc}>{desc}</div>}\n </Flexbox>\n </Flexbox>\n );\n },\n);\n\nGuideCard.displayName = 'GuideCard';\n\nexport default GuideCard;\n"],"mappings":";;;;;;;;;;;;AAaA,MAAM,YAAY,MACf,EACC,OACA,SACA,QACA,WAAW,MACX,YACA,KACA,WACA,OACA,MACA,OACA,QAAQ,cACR,QACA,YACA,UAAU,UACV,gBACA,YACA,KACA,GAAG,WACC;CACJ,MAAM,CAAC,MAAM,WAAW,SAAS,KAAK;CACtC,MAAM,EAAE,eAAe,cAAc;AAErC,KAAI,CAAC,KAAM,QAAO;AAElB,QACE,qBAACA;EACC,WAAW,GAAG,SAAS;GAAE;GAAY;GAAQ;GAAS,CAAC,EAAE,UAAU;EAC9D;EACL,GAAI;;GAEH,YACC,oBAACC;IACC,MAAM;IACN,GAAI;IACJ,WAAW,GAAG,OAAO,OAAO,gBAAgB,UAAU;IACtD,MAAM;IACN,UAAU,MAAM;AACd,aAAQ,MAAM;AACd,eAAU,EAAE;AACZ,mBAAc;;KAEhB;GAEH,SACC,oBAACC;IACM;IACL,WAAW,GAAG,OAAO,OAAO,YAAY,MAAM;IACtC;IACR,KAAK;IACL,OAAO,cAAc;IACd;IACP,GAAI;KACJ;GAEJ,qBAACF;IACC,WAAW,GAAG,OAAO,SAAS,YAAY,QAAQ;IAClD,KAAK;IACL,OAAO,cAAc;eAEpB,SAAS,oBAAC;KAAI,WAAW,OAAO;eAAQ;MAAY,EACpD,QAAQ,oBAAC;KAAI,WAAW,OAAO;eAAO;MAAW;KAC1C;;GACF;EAGf;AAED,UAAU,cAAc;AAExB,wBAAe"}