Skip to content

Commit

Permalink
New method and property "loading"
Browse files Browse the repository at this point in the history
  • Loading branch information
soyjavi committed Jul 23, 2015
1 parent ae1cab3 commit 91ee458
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
10 changes: 10 additions & 0 deletions components/card/card.md
Expand Up @@ -23,6 +23,16 @@ var Card = require('react-toolbox/components/card');
| **image** | String | | Sets a background image url.|
| **text** | String | | Sets a complementary text.|
| **legend** | String | | Sets a legend text.|
| **loading** | Boolean | | If true, component will be disabled and show a loading animation.|
| **onClick** | Function | | Callback function that is fired when the components's is clicked.|
| **title** | String | "text" | Sets the title of the component.|
| **type** | String | "text" | Type of the component, overwrite this property if you need set a different stylesheet.|

## Methods

#### loading
If true, component will be disabled and show a loading animation.

```
card_instance.loading(true);
```
6 changes: 6 additions & 0 deletions components/card/index.cjsx
Expand Up @@ -11,6 +11,7 @@ module.exports = React.createClass
image : React.PropTypes.string
text : React.PropTypes.string
legend : React.PropTypes.string
loading : React.PropTypes.bool
onClick : React.PropTypes.func
title : React.PropTypes.string
type : React.PropTypes.string
Expand Down Expand Up @@ -43,6 +44,7 @@ module.exports = React.createClass
className += " touch" if @props.onClick?
className += " image" if @props.image?
className += " color" if @props.color?
className += " loading" if @state.loading?
style = {}
style.backgroundImage = "url(#{@props.image})" if @props.image?
style.backgroundColor = @props.color if @props.color
Expand All @@ -60,3 +62,7 @@ module.exports = React.createClass
{ <Navigation actions={@props.actions} /> if @props.actions }
{ <Ripple origin={@state.ripple} loading={@state.loading} /> }
</div>

# -- Extends
loading: (value) ->
@setState loading: value
8 changes: 8 additions & 0 deletions components/card/style.styl
Expand Up @@ -51,6 +51,14 @@ OFFSET = (SPACE / 1.25)
&.image, &.color
> figure
color : WHITE
&.loading
cursor : none
-webkit-filter : grayscale(100%)
&, &:hover
box-shadow : 0 0 0 1px DIVIDER
> [data-component-ripple]
width : SIZE = (SIZE * 2)
height : SIZE

// -- Extends
[data-component-card="small"]
Expand Down
4 changes: 4 additions & 0 deletions spec/components/card.cjsx
Expand Up @@ -29,13 +29,17 @@ module.exports = React.createClass

<h3>Basic properties</h3>
<Card title="Default Card" />
<Card title="Default Card loading" loading />
<Card title="Default Card with text" text={text} />
<Card title="Default Card with legend" legend={legend} />
<Card title="Default Card with actions" actions={actions} />
<Card title="Defaulr Card with text & image" text={text}
image="http://cdn.tapquo.com/photos/soyjavi.jpg" />
<Card title="Default Card with text, color & onClick event" text={text}
color="#e91e63" onClick={@onClick} />
<Card title="Default Card loading with text, color & onClick event"
text={text} color="#e91e63" onClick={@onClick} loading />


<h3>Sizes using type property</h3>
<Card type="small" title="Small Card with text & onClick event"
Expand Down

0 comments on commit 91ee458

Please sign in to comment.