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 = (

DEV is where programmers share ideas and help each other grow. 🤓

Ask questions, leave helpful comments, encourage others, and have fun! 🙌

A few {' '} quick questions {' '} for you before you get started...

); const variants = [ , We have a few quick questions to fill out your profile

} />, The more you get involved in community, the better developer you will be.

)} style={{ textAlign: 'center', fontSize: '0.9em' }} />, You just made a great choice for your dev career.

} style={{ textAlign: 'center', fontSize: '1.1em' }} />, ]; return variants[variantId - 1] || this.defaultVariant; } render() { const { prev, variant } = this.props; const onboardingBody = this.selectVariant(variant); return (

Welcome to the DEV community!

{onboardingBody}
); } } IntroSlide.propTypes = { prev: PropTypes.func.isRequired, next: PropTypes.string.isRequired, variant: PropTypes.string.isRequired, }; export default IntroSlide;