Skip to content

Commit

Permalink
mergins sstern6 commits
Browse files Browse the repository at this point in the history
  • Loading branch information
Shay Stern committed Feb 13, 2016
1 parent 6e2764e commit e8317a3
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
3 changes: 2 additions & 1 deletion example/card-loader.cjsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
React = require 'react'
ReactDOM = require 'react-dom'
ReactCardFormContainer = require '../lib/card-react-form-container.js'

CardLoader = React.createClass
Expand Down Expand Up @@ -42,4 +43,4 @@ CardLoader = React.createClass
</div>


React.render <CardLoader />, document.getElementById 'demo-container'
ReactDOM.render <CardLoader />, document.getElementById 'demo-container'
11 changes: 8 additions & 3 deletions lib/card-react-component.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
(function() {
var ClassNames, Payment, React, ReactCard;
var dot,ccDots,cvcDots,expiryDots;
dot = String.fromCharCode(183);
ccDots = dot + dot + dot + dot;
cvcDots = dot + dot + dot;
expiryDots = dot + dot + "/" + dot + dot;

React = require('react');

Expand All @@ -17,9 +22,9 @@
},
baseWidth: 350,
defaultValues: {
number: '•••• •••• •••• ••••',
cvc: '•••',
expiry: '••/••',
number:ccDots + " " + ccDots + " " + ccDots + " " + ccDots,
cvc: cvcDots,
expiry:expiryDots,
name: 'Full Name'
}
};
Expand Down
10 changes: 6 additions & 4 deletions lib/card-react-form-container.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions src/components/card-react-form-container.cjsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
React = require 'react'
ReactDOM = require 'react-dom'
Payment = require 'payment'
ReactCard = require './card-react-component'

Expand Down Expand Up @@ -54,16 +55,16 @@ ReactCardFormContainer = React.createClass
# format the text inside the number, cvc and expiry inputs
formatInputs: ->
inputsNames = @props.formInputsNames
Payment.formatCardNumber React.findDOMNode(@refs[@inputsRefs[inputsNames["number"]]])
Payment.formatCardCVC React.findDOMNode(@refs[@inputsRefs[inputsNames["cvc"]]])
Payment.formatCardExpiry React.findDOMNode(@refs[@inputsRefs[inputsNames["expiry"]]])
Payment.formatCardNumber ReactDOM.findDOMNode(@refs[@inputsRefs[inputsNames["number"]]])
Payment.formatCardCVC ReactDOM.findDOMNode(@refs[@inputsRefs[inputsNames["cvc"]]])
Payment.formatCardExpiry ReactDOM.findDOMNode(@refs[@inputsRefs[inputsNames["expiry"]]])

# Render the card component into the DOM in the supplied this.cardContainer
# according to React docs: "If the ReactElement was previously rendered into container,
# this will perform an update on it and only mutate the DOM as necessary to reflect the latest React component."
renderCardComponent: ->
if @cardContainer
React.render <ReactCard
ReactDOM.render <ReactCard
{...@props}
cardFlipped={@cardFlipped}
focusedInput={@focusedInput}
Expand Down

0 comments on commit e8317a3

Please sign in to comment.