1 | import classNames from 'classnames';
|
2 | import * as React from 'react';
|
3 | import { useBootstrapPrefix } from './ThemeProvider';
|
4 | import createWithBsPrefix from './createWithBsPrefix';
|
5 | import divWithClassName from './divWithClassName';
|
6 | import CardImg from './CardImg';
|
7 | import CardHeader from './CardHeader';
|
8 | import { jsx as _jsx } from "react/jsx-runtime";
|
9 | const DivStyledAsH5 = divWithClassName('h5');
|
10 | const DivStyledAsH6 = divWithClassName('h6');
|
11 | const CardBody = createWithBsPrefix('card-body');
|
12 | const CardTitle = createWithBsPrefix('card-title', {
|
13 | Component: DivStyledAsH5
|
14 | });
|
15 | const CardSubtitle = createWithBsPrefix('card-subtitle', {
|
16 | Component: DivStyledAsH6
|
17 | });
|
18 | const CardLink = createWithBsPrefix('card-link', {
|
19 | Component: 'a'
|
20 | });
|
21 | const CardText = createWithBsPrefix('card-text', {
|
22 | Component: 'p'
|
23 | });
|
24 | const CardFooter = createWithBsPrefix('card-footer');
|
25 | const CardImgOverlay = createWithBsPrefix('card-img-overlay');
|
26 | const defaultProps = {
|
27 | body: false
|
28 | };
|
29 | const Card = React.forwardRef(({
|
30 | bsPrefix,
|
31 | className,
|
32 | bg,
|
33 | text,
|
34 | border,
|
35 | body,
|
36 | children,
|
37 |
|
38 | as: Component = 'div',
|
39 | ...props
|
40 | }, ref) => {
|
41 | const prefix = useBootstrapPrefix(bsPrefix, 'card');
|
42 | return _jsx(Component, {
|
43 | ref: ref,
|
44 | ...props,
|
45 | className: classNames(className, prefix, bg && `bg-${bg}`, text && `text-${text}`, border && `border-${border}`),
|
46 | children: body ? _jsx(CardBody, {
|
47 | children: children
|
48 | }) : children
|
49 | });
|
50 | });
|
51 | Card.displayName = 'Card';
|
52 | Card.defaultProps = defaultProps;
|
53 | export default Object.assign(Card, {
|
54 | Img: CardImg,
|
55 | Title: CardTitle,
|
56 | Subtitle: CardSubtitle,
|
57 | Body: CardBody,
|
58 | Link: CardLink,
|
59 | Text: CardText,
|
60 | Header: CardHeader,
|
61 | Footer: CardFooter,
|
62 | ImgOverlay: CardImgOverlay
|
63 | }); |
\ | No newline at end of file |