* Fix some eslint complaints * Fix some basic a11y issues in onboarding - Missing a main element - TODO to enable zooming - Rename a duplicate ID attribute I may need some context on the zooming thing, why did we decided to disable that in the first place? It is a pretty bad a11y issue, we will need to fix whatever that is a workaround for instead of making it difficult for some people to use our onboarding. * Update screenshots
119 lines
3.2 KiB
JavaScript
119 lines
3.2 KiB
JavaScript
import { h, Component } from 'preact';
|
|
import PropTypes from 'prop-types';
|
|
|
|
import Navigation from './Navigation';
|
|
import SlideContent from './SlideContent';
|
|
import { getContentOfToken } from '../utilities';
|
|
|
|
class IntroSlide extends Component {
|
|
constructor(props) {
|
|
super(props);
|
|
|
|
this.onSubmit = this.onSubmit.bind(this);
|
|
}
|
|
|
|
componentDidMount() {
|
|
const csrfToken = getContentOfToken('csrf-token');
|
|
fetch('/onboarding_update', {
|
|
method: 'PATCH',
|
|
headers: {
|
|
'X-CSRF-Token': csrfToken,
|
|
'Content-Type': 'application/json',
|
|
},
|
|
body: JSON.stringify({ user: { last_onboarding_page: 'intro slide' } }),
|
|
credentials: 'same-origin',
|
|
});
|
|
}
|
|
|
|
onSubmit() {
|
|
const { next } = this.props;
|
|
next();
|
|
}
|
|
|
|
selectVariant(variantId) {
|
|
this.defaultVariant = (
|
|
<div>
|
|
<p>
|
|
DEV is where programmers share ideas and help each other grow.
|
|
<span role="img" aria-label="Nerd Face">
|
|
🤓
|
|
</span>
|
|
</p>
|
|
<p>
|
|
Ask questions, leave helpful comments, encourage others, and have fun!
|
|
<span role="img" aria-label="Raising Hands">
|
|
🙌
|
|
</span>
|
|
</p>
|
|
<p>
|
|
A few
|
|
{' '}
|
|
<strong>quick questions</strong>
|
|
{' '}
|
|
for you before you get
|
|
started...
|
|
</p>
|
|
</div>
|
|
);
|
|
const variants = [
|
|
<SlideContent
|
|
imageSource="https://media.giphy.com/media/ICOgUNjpvO0PC/giphy.gif"
|
|
imageAlt="hello cat"
|
|
/>,
|
|
<SlideContent
|
|
imageSource="https://media.giphy.com/media/ICOgUNjpvO0PC/giphy.gif"
|
|
imageAlt="hello cat"
|
|
content={<p>We have a few quick questions to fill out your profile</p>}
|
|
/>,
|
|
<SlideContent
|
|
imageSource="https://media.giphy.com/media/aWRWTF27ilPzy/giphy.gif"
|
|
imageAlt="hello"
|
|
content={(
|
|
<p>
|
|
The more you get involved in community, the better developer you
|
|
will be.
|
|
</p>
|
|
)}
|
|
style={{ textAlign: 'center', fontSize: '0.9em' }}
|
|
/>,
|
|
<SlideContent
|
|
imageSource="https://media.giphy.com/media/aWRWTF27ilPzy/giphy.gif"
|
|
imageAlt="hello"
|
|
content={<p>You just made a great choice for your dev career.</p>}
|
|
style={{ textAlign: 'center', fontSize: '1.1em' }}
|
|
/>,
|
|
];
|
|
return variants[variantId - 1] || this.defaultVariant;
|
|
}
|
|
|
|
render() {
|
|
const { prev, variant } = this.props;
|
|
const onboardingBody = this.selectVariant(variant);
|
|
|
|
return (
|
|
<div className="onboarding-main">
|
|
<div className="onboarding-content">
|
|
<h1>
|
|
<span>Welcome to the </span>
|
|
<img
|
|
src="/assets/purple-dev-logo.png"
|
|
className="sticker-logo"
|
|
alt="DEV"
|
|
/>
|
|
<span>community!</span>
|
|
</h1>
|
|
{onboardingBody}
|
|
</div>
|
|
<Navigation prev={prev} next={this.onSubmit} hidePrev />
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
IntroSlide.propTypes = {
|
|
prev: PropTypes.func.isRequired,
|
|
next: PropTypes.string.isRequired,
|
|
variant: PropTypes.string.isRequired,
|
|
};
|
|
|
|
export default IntroSlide;
|