@yorkjs/hive-ui 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
@import '../../styles/mixin.styl'
|
|
2
2
|
@import '../../styles/variable.styl'
|
|
3
3
|
|
|
4
|
-
.card
|
|
4
|
+
.card-container
|
|
5
5
|
border-radius 10PX
|
|
6
6
|
overflow hidden
|
|
7
7
|
background-color var(--containerCard)
|
|
8
8
|
margin-left $WING_BLANK
|
|
9
9
|
margin-right $WING_BLANK
|
|
10
|
-
transition background-color 0.1s
|
|
11
10
|
&.show-top-gutter
|
|
12
11
|
margin-top $GUTTER_BLANK
|
|
13
12
|
&.show-bottom-gutter
|
|
14
13
|
margin-bottom $GUTTER_BLANK
|
|
15
14
|
&.show-top-blank
|
|
16
15
|
margin-top $CARD_BLANK
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
background-color
|
|
16
|
+
|
|
17
|
+
:global
|
|
18
|
+
.card-inner
|
|
19
|
+
background-color var(--containerCard)
|
|
20
|
+
transition background-color 0.1s
|
|
21
|
+
|
|
22
|
+
&.is-clickable
|
|
23
|
+
cursor pointer
|
|
24
|
+
&:active
|
|
25
|
+
background-color rgba(0, 0, 0, 0.03)
|
|
@@ -5,6 +5,7 @@ import { formatClassNames } from '../../util/function'
|
|
|
5
5
|
import styles from './index.module.styl'
|
|
6
6
|
|
|
7
7
|
export interface CardProps {
|
|
8
|
+
warpClassName?: string
|
|
8
9
|
className?: string
|
|
9
10
|
showTopGutter?: boolean
|
|
10
11
|
showBottomGutter?: boolean
|
|
@@ -14,36 +15,46 @@ export interface CardProps {
|
|
|
14
15
|
onClick?: () => void
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
const
|
|
18
|
+
const Card: React.FC<CardProps> = ({
|
|
18
19
|
showTopGutter = false,
|
|
19
20
|
showBottomGutter = false,
|
|
20
21
|
showTopBlank = false,
|
|
21
22
|
clickable,
|
|
22
23
|
onClick,
|
|
24
|
+
warpClassName,
|
|
23
25
|
className,
|
|
24
26
|
children
|
|
25
27
|
}) => {
|
|
26
28
|
const isClickable = clickable !== undefined ? clickable : !!onClick
|
|
27
29
|
|
|
28
|
-
const
|
|
29
|
-
styles['card'],
|
|
30
|
+
const containerClass = formatClassNames(
|
|
31
|
+
styles['card-container'],
|
|
30
32
|
{
|
|
31
|
-
[styles['is-clickable']]: isClickable,
|
|
32
33
|
[styles['show-top-gutter']]: showTopGutter,
|
|
33
34
|
[styles['show-bottom-gutter']]: showBottomGutter,
|
|
34
35
|
[styles['show-top-blank']]: showTopBlank,
|
|
35
36
|
},
|
|
37
|
+
warpClassName
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
const innerClass = formatClassNames(
|
|
41
|
+
'card-inner',
|
|
42
|
+
{
|
|
43
|
+
'is-clickable': isClickable,
|
|
44
|
+
},
|
|
36
45
|
className
|
|
37
46
|
)
|
|
38
47
|
|
|
39
48
|
return (
|
|
40
|
-
<View
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
<View className={containerClass}>
|
|
50
|
+
<View
|
|
51
|
+
className={innerClass}
|
|
52
|
+
onClick={onClick}
|
|
53
|
+
>
|
|
54
|
+
{children}
|
|
55
|
+
</View>
|
|
45
56
|
</View>
|
|
46
57
|
)
|
|
47
58
|
}
|
|
48
59
|
|
|
49
|
-
export default
|
|
60
|
+
export default Card
|