File tree Expand file tree Collapse file tree 4 files changed +28
-0
lines changed Expand file tree Collapse file tree 4 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,16 @@ var Card = require('react-toolbox/components/card');
23
23
| ** image** | String | | Sets a background image url.|
24
24
| ** text** | String | | Sets a complementary text.|
25
25
| ** legend** | String | | Sets a legend text.|
26
+ | ** loading** | Boolean | | If true, component will be disabled and show a loading animation.|
26
27
| ** onClick** | Function | | Callback function that is fired when the components's is clicked.|
27
28
| ** title** | String | "text" | Sets the title of the component.|
28
29
| ** type** | String | "text" | Type of the component, overwrite this property if you need set a different stylesheet.|
30
+
31
+ ## Methods
32
+
33
+ #### loading
34
+ If true, component will be disabled and show a loading animation.
35
+
36
+ ```
37
+ card_instance.loading(true);
38
+ ```
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ module.exports = React.createClass
11
11
image : React .PropTypes .string
12
12
text : React .PropTypes .string
13
13
legend : React .PropTypes .string
14
+ loading : React .PropTypes .bool
14
15
onClick : React .PropTypes .func
15
16
title : React .PropTypes .string
16
17
type : React .PropTypes .string
@@ -43,6 +44,7 @@ module.exports = React.createClass
43
44
className += " touch" if @props .onClick ?
44
45
className += " image" if @props .image ?
45
46
className += " color" if @props .color ?
47
+ className += " loading" if @state .loading ?
46
48
style = {}
47
49
style .backgroundImage = " url(#{ @props .image } )" if @props .image ?
48
50
style .backgroundColor = @props .color if @props .color
@@ -60,3 +62,7 @@ module.exports = React.createClass
60
62
{ <Navigation actions = {@props .actions } /> if @props .actions }
61
63
{ <Ripple origin = {@state .ripple } loading = {@state .loading } /> }
62
64
</div >
65
+
66
+ # -- Extends
67
+ loading : (value ) ->
68
+ @ setState loading : value
Original file line number Diff line number Diff line change @@ -51,6 +51,14 @@ OFFSET = (SPACE / 1.25)
51
51
& .image , & .color
52
52
> figure
53
53
color : WHITE
54
+ & .loading
55
+ cursor : none
56
+ -webkit- filter : grayscale (100% )
57
+ & , & :hover
58
+ box-shadow : 0 0 0 1px DIVIDER
59
+ > [data-component-ripple ]
60
+ width : SIZE = (SIZE * 2 )
61
+ height : SIZE
54
62
55
63
// -- Extends
56
64
[data-component-card = "small" ]
Original file line number Diff line number Diff line change @@ -29,13 +29,17 @@ module.exports = React.createClass
29
29
30
30
<h3 >Basic properties</h3 >
31
31
<Card title = " Default Card" />
32
+ <Card title = " Default Card loading" loading />
32
33
<Card title = " Default Card with text" text = {text} />
33
34
<Card title = " Default Card with legend" legend = {legend} />
34
35
<Card title = " Default Card with actions" actions = {actions} />
35
36
<Card title = " Defaulr Card with text & image" text = {text}
36
37
image = " http://cdn.tapquo.com/photos/soyjavi.jpg" />
37
38
<Card title = " Default Card with text, color & onClick event" text = {text}
38
39
color = " #e91e63" onClick = {@onClick } />
40
+ <Card title = " Default Card loading with text, color & onClick event"
41
+ text = {text} color = " #e91e63" onClick = {@onClick } loading />
42
+
39
43
40
44
<h3 >Sizes using type property</h3 >
41
45
<Card type = " small" title = " Small Card with text & onClick event"
You can’t perform that action at this time.
0 commit comments