Structure

This commit is contained in:
Belen Curcio
2016-11-28 14:25:30 -03:00
parent 4d916be170
commit 5bb386e16a
20 changed files with 217 additions and 40 deletions
@@ -21,6 +21,7 @@ import PermalinkButton from '../../coral-plugin-permalinks/PermalinkButton';
import SignInContainer from '../../coral-sign-in/containers/SignInContainer';
import UserBox from '../../coral-sign-in/components/UserBox';
import {TabBar, Tab, ContentBox} from '../../coral-ui';
import SettingsContainer from '../../coral-settings/containers/SettingsContainer';
const {addItem, updateItem, postItem, getStream, postAction, deleteAction, appendItemArray} = itemActions;
const {addNotification, clearNotification} = notificationActions;
@@ -232,7 +233,7 @@ class CommentStream extends Component {
/>
</ContentBox>
<ContentBox>
Bio!
<SettingsContainer/>
</ContentBox>
</div>
: 'Loading'
@@ -1,3 +1,4 @@
import {base, handleResp, getInit} from '../helpers/response';
import * as actions from '../constants/embedStream';
export const changeTab = view => dispatch =>
@@ -5,3 +6,17 @@ export const changeTab = view => dispatch =>
type: actions.CHANGE_TAB,
view
});
const userBioRequest = () => ({type: actions.FETCH_USER_BIO_REQUEST});
const userBioSuccess = userBio => ({type: actions.FETCH_USER_BIO_SUCCESS, userBio});
const userBioFailure = error => ({type: actions.FETCH_USER_BIO_FAILURE, error});
export const fetchUserBio = () => dispatch => {
dispatch(userBioRequest());
fetch(`${base}/bio`, getInit('GET'))
.then(handleResp)
.then(({bio}) => {
dispatch(userBioSuccess(bio));
})
.catch(() => dispatch(userBioFailure()));
};
+21
View File
@@ -0,0 +1,21 @@
.bio textarea {
width: 100%;
box-sizing: border-box;
border-radius: 2px;
min-height: 100px;
margin: 10px 0;
border: solid 1px #d8d8d8;
}
.bio h1 {
font-size: 16px;
margin: 3px 0;
}
.bio p {
margin: 3px 0;
}
.actions {
text-align: right;
}
+16
View File
@@ -0,0 +1,16 @@
import React from 'react';
import styles from './Bio.css';
import {Button} from '../../coral-ui';
export default () => (
<div className={styles.bio}>
<h1>Bio</h1>
<p>Tell the community about yourself</p>
<textarea />
<div className={styles.actions}>
<Button cStyle='cancel' raised>Cancel</Button>
<Button cStyle='success'>Save Changes</Button>
</div>
</div>
);
@@ -0,0 +1,8 @@
.header h1 {
margin: 4px 0;
}
.header h2 {
font-size: 13px;
}
@@ -0,0 +1,10 @@
import React from 'react';
import styles from './SettingsHeader.css';
export default () => (
<div className={styles.header}>
<h1>Jackson</h1>
<h2>jackson_persona@gmail.com</h2>
</div>
);
@@ -0,0 +1,45 @@
import React, {Component} from 'react';
import {connect} from 'react-redux';
import {} from '../../coral-framework/actions/embedStream';
import {TabBar, Tab} from '../../coral-ui';
import Bio from '../components/Bio';
import SettingsHeader from '../components/SettingsHeader';
class SignInContainer extends Component {
componentWillMount () {
// Get Bio
// Fetch commentHistory
}
render() {
//const {embedStream} = this.props;
return (
<div>
<SettingsHeader />
<TabBar cStyle='material'>
<Tab>All Comments (120)</Tab>
<Tab>Profile Settings</Tab>
</TabBar>
<Bio {...this.props}/>
</div>
);
}
}
const mapStateToProps = state => ({
embedStream: state.embedStream.toJS()
});
const mapDispatchToProps = dispatch => ({
getBio: () => dispatch(),
getHistory: () => dispatch(),
handleSaveChanges: () => dispatch(),
handleCancel: () => dispatch()
});
export default connect(
mapStateToProps,
mapDispatchToProps
)(SignInContainer);
View File
@@ -34,7 +34,7 @@ class ForgotContent extends React.Component {
id="email"
name="email" />
</div>
<Button type="submit" cStyle="black" className={styles.signInButton}>
<Button type="submit" cStyle="black" className={styles.signInButton} full>
{lang.t('signIn.recoverPassword')}
</Button>
{
@@ -16,7 +16,7 @@ const SignInContent = ({handleChange, formData, ...props}) => (
</h1>
</div>
<div className={styles.socialConnections}>
<Button cStyle="facebook" onClick={props.fetchSignInFacebook}>
<Button cStyle="facebook" onClick={props.fetchSignInFacebook} full>
{lang.t('signIn.facebookSignIn')}
</Button>
</div>
@@ -44,7 +44,7 @@ const SignInContent = ({handleChange, formData, ...props}) => (
<div className={styles.action}>
{
!props.auth.isLoading ?
<Button type="submit" cStyle="black" className={styles.signInButton}>
<Button type="submit" cStyle="black" className={styles.signInButton} full>
{lang.t('signIn.signIn')}
</Button>
:
@@ -17,7 +17,7 @@ const SignUpContent = ({handleChange, formData, ...props}) => (
</h1>
</div>
<div className={styles.socialConnections}>
<Button cStyle="facebook" onClick={props.fetchSignInFacebook}>
<Button cStyle="facebook" onClick={props.fetchSignInFacebook} full>
{lang.t('signIn.facebookSignUp')}
</Button>
</div>
@@ -69,7 +69,7 @@ const SignUpContent = ({handleChange, formData, ...props}) => (
/>
<div className={styles.action}>
{ !props.auth.isLoading && !props.auth.successSignUp && (
<Button type="submit" cStyle="black" className={styles.signInButton}>
<Button type="submit" cStyle="black" className={styles.signInButton} full>
{lang.t('signIn.signUp')}
</Button>
)}
@@ -132,7 +132,7 @@ class SignInContainer extends Component {
const {auth, showSignInDialog} = this.props;
return (
<div>
<Button onClick={showSignInDialog}>
<Button onClick={showSignInDialog} full>
Sign in to comment
</Button>
<SignDialog
+32 -3
View File
@@ -23,8 +23,7 @@
text-align: center;
line-height: 36px;
vertical-align: middle;
width: 100%;
margin: 0;
margin: 2px;
}
.type--black {
@@ -46,4 +45,34 @@
.type--facebook:hover {
background-color: #365899;
border-color: #365899;
}
}
.type--success {
color: white;
background: #2376d8;
}
.type--success:hover {
color: white;
background: #2782ee;
}
.type--cancel {
color: white;
background: #2E343B;
}
.type--cancel:hover {
color: white;
background: #4f5c67;
}
.full {
width: 100%;
margin: 0;
}
.raised {
background: rgba(158,158,158,.2);
box-shadow: 0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.2),0 1px 5px 0 rgba(0,0,0,.12);
}
+8 -2
View File
@@ -1,9 +1,15 @@
import React from 'react';
import styles from './Button.css';
const Button = ({cStyle = 'local', children, className, ...props}) => (
const Button = ({cStyle = 'local', children, className, raised, full, ...props}) => (
<button
className={`${styles.button} ${styles[`type--${cStyle}`]} ${className}`}
className={`
${styles.button}
${styles[`type--${cStyle}`]}
${className}
${full && styles.full}
${raised && styles.button}
`}
{...props}
>
{children}
+4 -16
View File
@@ -1,20 +1,8 @@
.active {
background: #F0F0F0;
}
.base {
color: #4E5259;
border: solid 1px #D8D8D8;
li.base--active {
background: white;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
display: inline-block;
border-bottom: none;
padding: 8px 10px;
margin-right: -1px;
}
.base:hover {
background: #f3f3f3;
cursor: pointer;
li.material--active {
font-weight: bold;
border-bottom: solid 2px black;
}
+2 -2
View File
@@ -1,10 +1,10 @@
import React from 'react';
import styles from './Tab.css';
export default ({children, tabId, active, onTabClick}) => (
export default ({children, tabId, active, onTabClick, cStyle = 'base'}) => (
<li
key={tabId}
className={`${styles.base} ${active && styles.active}`}
className={active ? styles[`${cStyle}--active`] : ''}
onClick={onTabClick}
>
{children}
+37
View File
@@ -3,3 +3,40 @@
border-bottom: solid 1px #D8D8D8;
padding: 0;
}
.base li {
color: #4E5259;
border: solid 1px #D8D8D8;
background: #F0F0F0;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
display: inline-block;
border-bottom: none;
padding: 8px 10px;
margin-right: -1px;
}
.base li:hover {
background: #f3f3f3;
cursor: pointer;
}
.material {
list-style: none;
border: none;
padding: 0;
}
.material li {
color: black;
border: none;
border-bottom: solid 2px white;
background: white;
padding: 8px 0;
margin-right: 40px;
}
.material li:hover {
background: white;
border-bottom: solid 2px grey;
}
+10 -10
View File
@@ -12,18 +12,18 @@ export class TabBar extends React.Component {
}
render() {
const {children, activeTab = 0} = this.props;
const {children, activeTab = 0, cStyle = 'base'} = this.props;
return (
<div>
<ul className={styles.base}>
{React.Children.map(children, (child, tabId) =>
React.cloneElement(child, {
tabId,
active: tabId === activeTab,
onTabClick: this.handleClickTab,
})
)}
<ul className={`${styles.base} ${cStyle ? styles[cStyle] : ''}`}>
{React.Children.map(children, (child, tabId) =>
React.cloneElement(child, {
tabId,
active: tabId === activeTab,
onTabClick: this.handleClickTab,
cStyle
})
)}
</ul>
</div>
);
+1
View File
@@ -4,3 +4,4 @@ export {default as FabButton} from './components/FabButton';
export {default as TabBar} from './components/TabBar';
export {default as Tab} from './components/Tab';
export {default as ContentBox} from './components/ContentBox';
export {default as Button} from './components/Button';