File tree Expand file tree Collapse file tree 7 files changed +392
-15
lines changed Expand file tree Collapse file tree 7 files changed +392
-15
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,12 @@ import ClayCard from './Card';
14
14
15
15
interface IProps {
16
16
actions ?: React . ComponentProps < typeof ClayDropDownWithItems > [ 'items' ] ;
17
+
18
+ /**
19
+ * Flag to indicate that all interactions on the card will be disabled.
20
+ */
21
+ disabled ?: boolean ;
22
+
17
23
/**
18
24
* Path or URL to item
19
25
*/
@@ -47,6 +53,7 @@ interface IProps {
47
53
48
54
export const ClayCardWithHorizontal : React . FunctionComponent < IProps > = ( {
49
55
actions,
56
+ disabled,
50
57
href,
51
58
onSelectChange,
52
59
selected = false ,
@@ -64,7 +71,11 @@ export const ClayCardWithHorizontal: React.FunctionComponent<IProps> = ({
64
71
</ div >
65
72
66
73
< div className = "autofit-col autofit-col-expand autofit-col-gutters" >
67
- < ClayCard . Description displayType = "title" href = { href } >
74
+ < ClayCard . Description
75
+ disabled = { disabled }
76
+ displayType = "title"
77
+ href = { href }
78
+ >
68
79
{ title }
69
80
</ ClayCard . Description >
70
81
</ div >
@@ -75,7 +86,10 @@ export const ClayCardWithHorizontal: React.FunctionComponent<IProps> = ({
75
86
items = { actions }
76
87
spritemap = { spritemap }
77
88
trigger = {
78
- < button className = "component-action" >
89
+ < button
90
+ className = "component-action"
91
+ disabled = { disabled }
92
+ >
79
93
< ClayIcon
80
94
spritemap = { spritemap }
81
95
symbol = "ellipsis-v"
@@ -94,8 +108,7 @@ export const ClayCardWithHorizontal: React.FunctionComponent<IProps> = ({
94
108
{ onSelectChange && (
95
109
< ClayCheckbox
96
110
checked = { selected }
97
- disabled = { false }
98
- indeterminate = { false }
111
+ disabled = { disabled }
99
112
onChange = { ( ) => onSelectChange ( ! selected ) }
100
113
>
101
114
{ content }
Original file line number Diff line number Diff line change @@ -25,6 +25,11 @@ interface IProps {
25
25
*/
26
26
description ?: React . ReactText ;
27
27
28
+ /**
29
+ * Flag to indicate that all interactions on the card will be disabled.
30
+ */
31
+ disabled ?: boolean ;
32
+
28
33
/**
29
34
* Flag to indicate if `aspect-ratio-item-flush` class should be
30
35
* applied to the image.
@@ -91,6 +96,7 @@ interface IProps {
91
96
export const ClayCardWithInfo : React . FunctionComponent < IProps > = ( {
92
97
actions,
93
98
description,
99
+ disabled,
94
100
flushHorizontal,
95
101
flushVertical,
96
102
href,
@@ -150,8 +156,7 @@ export const ClayCardWithInfo: React.FunctionComponent<IProps> = ({
150
156
{ onSelectChange && (
151
157
< ClayCheckbox
152
158
checked = { selected }
153
- disabled = { false }
154
- indeterminate = { false }
159
+ disabled = { disabled }
155
160
onChange = { ( ) => onSelectChange ( ! selected ) }
156
161
>
157
162
{ headerContent }
@@ -163,7 +168,11 @@ export const ClayCardWithInfo: React.FunctionComponent<IProps> = ({
163
168
< ClayCard . Body >
164
169
< ClayCard . Row >
165
170
< div className = "autofit-col autofit-col-expand" >
166
- < ClayCard . Description displayType = "title" href = { href } >
171
+ < ClayCard . Description
172
+ disabled = { disabled }
173
+ displayType = "title"
174
+ href = { href }
175
+ >
167
176
{ title }
168
177
</ ClayCard . Description >
169
178
@@ -188,7 +197,10 @@ export const ClayCardWithInfo: React.FunctionComponent<IProps> = ({
188
197
items = { actions }
189
198
spritemap = { spritemap }
190
199
trigger = {
191
- < button className = "component-action" >
200
+ < button
201
+ className = "component-action"
202
+ disabled = { disabled }
203
+ >
192
204
< ClayIcon
193
205
spritemap = { spritemap }
194
206
symbol = "ellipsis-v"
Original file line number Diff line number Diff line change @@ -24,6 +24,11 @@ interface IProps {
24
24
*/
25
25
description : string ;
26
26
27
+ /**
28
+ * Flag to indicate that all interactions on the card will be disabled.
29
+ */
30
+ disabled ?: boolean ;
31
+
27
32
/**
28
33
* Path or URL to user
29
34
*/
@@ -70,6 +75,7 @@ interface IProps {
70
75
export const ClayCardWithUser : React . FunctionComponent < IProps > = ( {
71
76
actions,
72
77
description,
78
+ disabled,
73
79
href,
74
80
labels,
75
81
name,
@@ -106,8 +112,7 @@ export const ClayCardWithUser: React.FunctionComponent<IProps> = ({
106
112
{ onSelectChange && (
107
113
< ClayCheckbox
108
114
checked = { selected }
109
- disabled = { false }
110
- indeterminate = { false }
115
+ disabled = { disabled }
111
116
onChange = { ( ) => onSelectChange ( ! selected ) }
112
117
>
113
118
{ content }
@@ -120,7 +125,11 @@ export const ClayCardWithUser: React.FunctionComponent<IProps> = ({
120
125
< ClayCard . Body >
121
126
< ClayCard . Row >
122
127
< div className = "autofit-col autofit-col-expand" >
123
- < ClayCard . Description displayType = "title" href = { href } >
128
+ < ClayCard . Description
129
+ disabled = { disabled }
130
+ displayType = "title"
131
+ href = { href }
132
+ >
124
133
{ name }
125
134
</ ClayCard . Description >
126
135
< ClayCard . Description displayType = "subtitle" >
@@ -143,7 +152,10 @@ export const ClayCardWithUser: React.FunctionComponent<IProps> = ({
143
152
items = { actions }
144
153
spritemap = { spritemap }
145
154
trigger = {
146
- < button className = "component-action" >
155
+ < button
156
+ className = "component-action"
157
+ disabled = { disabled }
158
+ >
147
159
< ClayIcon
148
160
spritemap = { spritemap }
149
161
symbol = "ellipsis-v"
Original file line number Diff line number Diff line change @@ -18,6 +18,11 @@ interface ICardDescriptionProps
18
18
*/
19
19
displayType : CardDescriptionDisplayType ;
20
20
21
+ /**
22
+ * Flag to indicate if href will be disabled.
23
+ */
24
+ disabled ?: boolean ;
25
+
21
26
/**
22
27
* Path or URL
23
28
*/
@@ -38,13 +43,14 @@ const CARD_TYPE_ELEMENTS = {
38
43
const ClayCardDescription : React . FunctionComponent < ICardDescriptionProps > = ( {
39
44
children,
40
45
className,
46
+ disabled,
41
47
displayType,
42
48
href,
43
49
truncate = true ,
44
50
...otherProps
45
51
} : ICardDescriptionProps ) => {
46
52
const OuterTag = CARD_TYPE_ELEMENTS [ displayType ] ;
47
- const InnerTag = href ? 'a' : 'span' ;
53
+ const InnerTag = href && ! disabled ? 'a' : 'span' ;
48
54
49
55
return (
50
56
< OuterTag
You can’t perform that action at this time.
0 commit comments