Merge pull request #201 from netlify/better-demo-login
Improvements to the demo experience
This commit is contained in:
commit
d24fb7e92a
@ -20,6 +20,11 @@
|
|||||||
color: #dd0000;
|
color: #dd0000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.message {
|
||||||
|
font-size: 1.1em;
|
||||||
|
margin: 20px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.button {
|
.button {
|
||||||
padding: .25em 1em;
|
padding: .25em 1em;
|
||||||
height: auto;
|
height: auto;
|
||||||
|
@ -17,14 +17,15 @@ export default class AuthenticationPage extends React.Component {
|
|||||||
this.props.onLogin(this.state);
|
this.props.onLogin(this.state);
|
||||||
};
|
};
|
||||||
|
|
||||||
handleEmailChange = (e) => {
|
handleEmailChange = (value) => {
|
||||||
this.setState({ email: e.target.value });
|
this.setState({ email: value });
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (<section className={styles.root}>
|
return (<section className={styles.root}>
|
||||||
<Card className={styles.card}>
|
<Card className={styles.card}>
|
||||||
<img src={logo} width={100} role="presentation" />
|
<img src={logo} width={100} role="presentation" />
|
||||||
|
<p className={styles.message}>This is a demo, enter your email to start</p>
|
||||||
<Input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
label="Email"
|
label="Email"
|
||||||
|
@ -9,6 +9,15 @@ function getFile(path) {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function nameFromEmail(email) {
|
||||||
|
return email
|
||||||
|
.split('@').shift().replace(/[.-_]/g, ' ')
|
||||||
|
.split(' ')
|
||||||
|
.filter(f => f)
|
||||||
|
.map(s => s.substr(0, 1).toUpperCase() + (s.substr(1) || ''))
|
||||||
|
.join(' ');
|
||||||
|
}
|
||||||
|
|
||||||
export default class TestRepo {
|
export default class TestRepo {
|
||||||
constructor(config) {
|
constructor(config) {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
@ -24,7 +33,7 @@ export default class TestRepo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
authenticate(state) {
|
authenticate(state) {
|
||||||
return Promise.resolve({ email: state.email });
|
return Promise.resolve({ email: state.email, name: nameFromEmail(state.email) });
|
||||||
}
|
}
|
||||||
|
|
||||||
entriesByFolder(collection) {
|
entriesByFolder(collection) {
|
||||||
@ -71,7 +80,6 @@ export default class TestRepo {
|
|||||||
} else {
|
} else {
|
||||||
window.repoFiles[folder][fileName].content = entry.raw;
|
window.repoFiles[folder][fileName].content = entry.raw;
|
||||||
}
|
}
|
||||||
mediaFiles.forEach(media => media.uploaded = true);
|
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user