-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Components: Adds LoggedOutForm component #1521
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
LoggedOutForm | ||
============= | ||
This component is meant to be used when creating form for logged out users. You can find this component in use within the signup framework at `client/signup` and within the invite acceptance section within `client/my-sites/invite-accept`. | ||
|
||
## Usage | ||
|
||
```js | ||
import LoggedOutForm from 'components/logged-out-form'; | ||
import LoggedOutFormFooter from 'components/logged-out-form-footer'; | ||
import LoggedOutFormLinks from 'components/logged-out-form/links'; | ||
import LoggedOutFormLinkItem from 'components/logged-out-form/link-item'; | ||
|
||
import config from 'config'; | ||
import Button from 'components/button'; | ||
import FormTextInput from 'components/forms/form-text-input'; | ||
|
||
const MyLoggedOutForm = React.createClass( { | ||
handleSubmit( event ) { | ||
event.preventDefault(); | ||
|
||
// Handle form submit | ||
} | ||
|
||
render() { | ||
return ( | ||
<LoggedOutForm onSubmit={ this.handleSubmit }> | ||
<FormTextInput placeholder="I am an input"/> | ||
|
||
<LoggedOutFormFooter> | ||
<Button primary>Submit</Button> | ||
</LoggedOutFormFooter> | ||
</LoggedOutForm> | ||
|
||
<LoggedOutFormLinks> | ||
<LoggedOutFormLinkItem href={ config( 'login_url' ) }> | ||
Sign in as a different user | ||
</LoggedOutFormLinkItem> | ||
</LoggedOutFormLinks> | ||
); | ||
} | ||
} ); | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import React from 'react'; | ||
import classnames from 'classnames'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import Card from 'components/card'; | ||
|
||
export default React.createClass( { | ||
displayName: 'LoggedOutFormFooter', | ||
|
||
propTypes: { | ||
children: React.PropTypes.node.isRequired, | ||
className: React.PropTypes.string | ||
}, | ||
|
||
render() { | ||
return ( | ||
<Card className={ classnames( 'logged-out-form__footer', this.props.className ) } > | ||
{ this.props.children } | ||
</Card> | ||
); | ||
} | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import React from 'react'; | ||
import classnames from 'classnames'; | ||
import omit from 'lodash/object/omit'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import Card from 'components/card'; | ||
|
||
export default React.createClass( { | ||
displayName: 'LoggedOutForm', | ||
|
||
propTypes: { | ||
children: React.PropTypes.node.isRequired, | ||
className: React.PropTypes.string | ||
}, | ||
|
||
render() { | ||
return ( | ||
<Card className={ classnames( 'logged-out-form', this.props.className ) } > | ||
<form { ...omit( this.props, 'className' ) }> | ||
{ this.props.children } | ||
</form> | ||
</Card> | ||
); | ||
} | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import React from 'react'; | ||
import classnames from 'classnames'; | ||
import omit from 'lodash/object/omit'; | ||
|
||
export default React.createClass( { | ||
displayName: 'LoggedOutFormLinkItem', | ||
|
||
propTypes: { | ||
className: React.PropTypes.string | ||
}, | ||
|
||
render() { | ||
return ( | ||
<a | ||
{ ...omit( this.props, 'classNames' ) } | ||
className={ classnames( 'logged-out-form__link-item', this.props.className ) } | ||
> | ||
{ this.props.children } | ||
</a> | ||
); | ||
} | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import React from 'react'; | ||
import classnames from 'classnames'; | ||
import omit from 'lodash/object/omit'; | ||
|
||
export default React.createClass( { | ||
displayName: 'LoggedOutFormLinks', | ||
|
||
propTypes: { | ||
children: React.PropTypes.node.isRequired, | ||
className: React.PropTypes.string | ||
}, | ||
|
||
render() { | ||
return ( | ||
<div | ||
{ ...omit( this.props, 'classNames' ) } | ||
className={ classnames( 'logged-out-form__links', this.props.className ) } | ||
> | ||
{ this.props.children } | ||
</div> | ||
); | ||
} | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
.logged-out-form, | ||
.logged-out-form__links { | ||
margin: 0 auto; | ||
max-width: 400px; | ||
} | ||
|
||
.logged-out-form__footer { | ||
background: lighten( $gray, 34% ); | ||
border-top: 1px solid lighten( $gray, 30% ); | ||
box-shadow: none; | ||
margin: 0 -16px -16px -16px; | ||
padding: 16px; | ||
|
||
@include breakpoint( ">480px" ) { | ||
margin: 0 -24px -24px -24px; | ||
padding: 24px; | ||
} | ||
|
||
.button.is-primary { | ||
float: none; | ||
margin: 0; | ||
width: 100%; | ||
} | ||
} | ||
|
||
.logged-out-form__link-item { | ||
border-bottom: 1px solid lighten( $gray, 20% ); | ||
color: $gray; | ||
display: block; | ||
font-family: $sans; | ||
font-size: 14px; | ||
line-height: 21px; | ||
padding: 16px 0 16px 16px; | ||
|
||
@include breakpoint( ">480px" ) { | ||
padding-left: 24px; | ||
} | ||
|
||
&:last-child { | ||
border-bottom: none; | ||
} | ||
|
||
&:visited { | ||
color: $gray; | ||
} | ||
|
||
&:hover { | ||
color: $blue-medium; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing propTypes: {} The same is true for the rest of the new components.