diff --git a/src/welcome/WelcomePage.jsx b/src/welcome/WelcomePage.jsx index ee97c2db..7c772512 100644 --- a/src/welcome/WelcomePage.jsx +++ b/src/welcome/WelcomePage.jsx @@ -12,7 +12,9 @@ import { Form, StatefulButton, Hyperlink, + Icon, } from '@edx/paragon'; +import { ExpandMore } from '@edx/paragon/icons'; import messages from './messages'; @@ -23,7 +25,7 @@ import { DEFAULT_REDIRECT_URL } from '../data/constants'; const WelcomePage = (props) => { const { intl } = props; const [registrationResult, setRegistrationResult] = useState({}); - const [values, setValues] = useState({}); + const [values, setValues] = useState({ levelOfEducation: '', yearOfBirth: '', gender: '' }); const [ready, setReady] = useState(false); const DASHBOARD_URL = getConfig().LMS_BASE_URL.concat(DEFAULT_REDIRECT_URL); @@ -51,20 +53,27 @@ const WelcomePage = (props) => { return null; } - const getOptions = () => ({ - yearOfBirthOptions: [{ - value: '', - label: intl.formatMessage(messages['registration.year.of.birth.label']), - }].concat(YEAR_OF_BIRTH_OPTIONS), - educationLevelOptions: EDUCATION_LEVELS.map(key => ({ - value: key, - label: intl.formatMessage(messages[`registration.field.education.levels.${key || 'label'}`]), - })), - genderOptions: GENDER_OPTIONS.map(key => ({ - value: key, - label: intl.formatMessage(messages[`registration.field.gender.options.${key || 'label'}`]), - })), - }); + const getOptions = (fieldName) => { + const options = { + yearOfBirth: [{ + value: '', + label: intl.formatMessage(messages['registration.year.of.birth.label']), + }].concat(YEAR_OF_BIRTH_OPTIONS), + levelOfEducation: EDUCATION_LEVELS.map(key => ({ + value: key, + label: intl.formatMessage(messages[`registration.field.education.levels.${key || 'label'}`]), + })), + gender: GENDER_OPTIONS.map(key => ({ + value: key, + label: intl.formatMessage(messages[`registration.field.gender.options.${key || 'label'}`]), + })), + }; + + return [ + options[fieldName].map(({ value, label }) => ( + )), + ]; + }; const fireOptimizelyEvent = () => { window.optimizely = window.optimizely || []; @@ -118,40 +127,40 @@ const WelcomePage = (props) => {