Sha256: a33a7497acbc928a007988786e8c99dbe510c0f7fb7ad553cc027800be1b06b4

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

class Skr.Components.CreditCardForm extends Lanes.React.Component

    dataObjects:
        card: 'props'

    setField: (ev) ->
        @card[ev.target.name] = ev.target.value

    componentDidMount: ->
        @cardPreview ||= new Skr.Vendor.Card({
            form: _.dom(@, 'form').el, container: _.dom(@, '.preview').el
        })

    render: ->
        fieldProps =
            onChange: @setField
            type: 'text'

        <div className="credit-card-form section">
            <div className='preview'></div>

            <form  className="credit-card section">
                <input {...fieldProps}
                    value={@card.number || ''}
                    placeholder="Card number" name="number" />
                <input {...fieldProps} value={@card.name || ''}
                    placeholder="Full name" name="name" />
                <div className="row">
                    <input {...fieldProps}
                        value={@card.expiry} placeholder="MM/YY" name="expiry" />
                    <input {...fieldProps}
                        value={@card.cvc} placeholder="CVC" name="cvc" />
                </div>
            </form>
        </div>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stockor-0.4.0 client/skr/components/CreditCardForm.cjsx