fix: Logistration tabs behavior (#331)

Logistration Tabs behavior and styles fix by using Paragon Tab component.

Fixes: VAN-554
This commit is contained in:
Mubbshar Anwar
2021-06-11 15:25:43 +05:00
committed by Waheed Ahmed
parent 549feaf84c
commit a68fb310ed
2 changed files with 11 additions and 21 deletions

View File

@@ -35,22 +35,12 @@ $accent-a-light: #c9f2f5;
.nav-tabs {
a {
color: $primary !important;
background: transparent !important;
:hover {
color: $primary !important;
}
}
.nav-link.active {
border-bottom: 0.175rem solid $primary;
border-top: none;
border-left: none;
border-right: none;
}
:hover {
border: none;
}
}
.sr-only {

View File

@@ -1,10 +1,10 @@
import React, { useState } from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import { Redirect } from 'react-router-dom';
import { sendPageEvent, sendTrackEvent } from '@edx/frontend-platform/analytics';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import { Button } from '@edx/paragon';
import { Button, Tabs, Tab } from '@edx/paragon';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faChevronLeft } from '@fortawesome/free-solid-svg-icons';
@@ -18,6 +18,7 @@ const Logistration = (props) => {
const { intl, selectedPage } = props;
const tpa = getTpaHint();
const [institutionLogin, setInstitutionLogin] = useState(false);
const [key, setKey] = useState('');
const handleInstitutionLogin = (e) => {
sendTrackEvent('edx.bi.institution_login_form.toggled', { category: 'user-engagement' });
@@ -47,17 +48,16 @@ const Logistration = (props) => {
: (
<>
{!tpa && (
<span className="nav nav-tabs">
<Link className={`nav-item nav-link ${selectedPage === REGISTER_PAGE ? 'active' : ''}`} to={updatePathWithQueryParams(REGISTER_PAGE)}>
{intl.formatMessage(messages['logistration.register'])}
</Link>
<Link className={`nav-item nav-link ${selectedPage === LOGIN_PAGE ? 'active' : ''}`} to={updatePathWithQueryParams(LOGIN_PAGE)}>
{intl.formatMessage(messages['logistration.sign.in'])}
</Link>
</span>
<Tabs defaultActiveKey={selectedPage} id="controlled-tab-example" onSelect={(k) => setKey(k)}>
<Tab title={intl.formatMessage(messages['logistration.register'])} eventKey={REGISTER_PAGE} />
<Tab title={intl.formatMessage(messages['logistration.sign.in'])} eventKey={LOGIN_PAGE} />
</Tabs>
)}
</>
)}
{ key && (
<Redirect to={updatePathWithQueryParams(key)} />
)}
<div id="main-content" className="main-content">
{selectedPage === LOGIN_PAGE
? <LoginPage institutionLogin={institutionLogin} handleInstitutionLogin={handleInstitutionLogin} />