Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tp): fix career partner banner UI on tablet and mobile #993

Merged
merged 3 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions apps/redi-talent-pool/src/components/molecules/TpMainNavItem.scss
Original file line number Diff line number Diff line change
@@ -1,20 +1,43 @@
@import '~bulma/sass/utilities/_all';
@import '_variables.scss';

.tp-main-nav-item {
display: flex;
align-items: center;
justify-content: space-between;
justify-content: center;
height: 80px;
position: relative;

/* Active bar for desktop layout */
&__active-bar {
position: absolute;
right: 0;
top: 0;
height: 100%;
width: 5px;
background-color: #2cb0c7;
@include touch() {
background-color: $redi-blue-dark;

@media screen and (max-width: 1191px) {
display: none;
}
}

/* Active bar for tablet and mobile layouts */
&__active-bar--horizontal {
display: none;

@media screen and (max-width: 1191px) {
display: block;
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 5px;
background-color: $redi-blue-dark;
}
}
katamatata marked this conversation as resolved.
Show resolved Hide resolved

&__icon {
width: 40px;
height: 40px;
Expand Down
10 changes: 6 additions & 4 deletions apps/redi-talent-pool/src/components/molecules/TpMainNavItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,17 @@ export function TpMainNavItem({
)}
onClick={onClick}
>
<div></div>
{isActive && (
<>
<div className="tp-main-nav-item__active-bar"></div>
<div className="tp-main-nav-item__active-bar--horizontal"></div>
</>
)}
<TpMainNavItemIcon
page={page}
isDisabled={isDisabled}
pageName={pageName}
/>
<div
className={classnames({ 'tp-main-nav-item__active-bar': isActive })}
></div>
</Link>
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,60 +1,72 @@
@import '~bulma/sass/utilities/_all';

.career-partner-banner {
display: flex;
flex-direction: column;

justify-content: space-between;

margin: 48px 0;
padding: 24px;

@media (max-width: 768px) {
margin: 32px 0;
padding: 12px;
}

border-radius: 8px;
background: var(--grey-ultra-light, #f5f5f5);
@include mobile() {
margin: 32px auto;
padding: 12px;
max-width: 550px;
}

&-top {
display: flex;
justify-content: space-between;

align-items: center;
padding-bottom: 16px;
border-bottom: 1px solid black;

> * {
&__separator {
width: 1px;
height: 2rem;
border-left: 1px solid black;
margin: 0 24px;
@include mobile() {
margin: 0 16px;
}
}

&__badge {
display: flex;
justify-content: center;
align-items: center;

&:not(:last-child) {
border-right: 1px solid black;
padding-left: 24px;
@include mobile() {
padding-left: 0;
}

.career-partner-badge-icon {
&-icon {
margin-right: 16px;

@media (max-width: 768px) {
margin-right: 12px;
@include mobile() {
margin-right: 8px;
}
}
}

.career-partner-since,
.career-partner-jobs-posted {
padding: 0 48px;
@media (max-width: 768px) {
padding: 0 24px;
&-text {
word-break: unset;
}
}

&__since,
&__jobs-posted {
text-transform: uppercase;
font-feature-settings: 'clig' off, 'liga' off;
font-size: 10px;
font-style: normal;
font-weight: 700;
line-height: 20px; /* 200% */
letter-spacing: 2px;
text-align: center;

&:last-child {
padding-right: 24px;
@include mobile() {
padding-right: 16px;
}
}
}
}

Expand All @@ -64,7 +76,7 @@
font-size: 16px;
line-height: 25px; /* 156.25% */

@media (max-width: 768px) {
@include mobile() {
font-size: 13.5px;
line-height: 20px; /* 148.148% */
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,32 @@ const CareerPartnerBanner: React.FC<CareerPartnerBannerProps> = ({
return (
<div className="career-partner-banner">
<div className="career-partner-banner-top">
<div>
<div className="career-partner-banner-top__badge">
<Icon
icon="careerPartnerBadge"
size="large"
className="career-partner-badge-icon"
className="career-partner-banner-top__badge-icon"
/>
<Heading size="smaller">Career Partner</Heading>
<Heading
size="smaller"
className="career-partner-banner-top__badge-text"
>
Career
<br />
Partner
</Heading>
</div>
Comment on lines +17 to 31
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider improving heading accessibility for screen readers.

While the visual layout with <br /> tags works well, screen readers might pause awkwardly between "Career" and "Partner". Consider using CSS for visual formatting while maintaining semantic meaning.

-          <Heading
-            size="smaller"
-            className="career-partner-banner-top__badge-text"
-          >
-            Career
-            <br />
-            Partner
-          </Heading>
+          <Heading
+            size="smaller"
+            className="career-partner-banner-top__badge-text"
+            aria-label="Career Partner"
+          >
+            <span className="career-partner-banner-top__badge-text-line">Career</span>
+            <span className="career-partner-banner-top__badge-text-line">Partner</span>
+          </Heading>

Add to your SCSS:

.career-partner-banner-top__badge-text-line {
  display: block;
}

<span className="career-partner-since">
Since {new Date(partnerSince).getFullYear()}
<span className="career-partner-banner-top__separator" />
<span className="career-partner-banner-top__since">
Since
<br />
{new Date(partnerSince).getFullYear()}
</span>
<span className="career-partner-jobs-posted">
{jobsPosted} Jobs Posted
<span className="career-partner-banner-top__separator" />
<span className="career-partner-banner-top__jobs-posted">
{jobsPosted} Jobs
<br />
Posted
</span>
katamatata marked this conversation as resolved.
Show resolved Hide resolved
</div>
<div className="career-partner-banner-bottom">
Expand Down
24 changes: 18 additions & 6 deletions apps/redi-talent-pool/src/components/templates/LoggedIn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,24 @@ const LoggedIn = ({ children, hideNavigation }: Props) => {
{hideNavigation ? null : (
<>
<div className="tp-side-menu">
<TpMainNavItem
page="profile-page"
pageName="My profile"
to="/app/me"
isActive={location.pathname === '/app/me'}
/>
{tpJobseekerDirectoryEntry ? (
<TpMainNavItem
page="profile-page"
pageName="My profile"
to={`/app/jobseeker-profile/${tpJobseekerDirectoryEntry.id}`}
isActive={
location.pathname ===
`/app/jobseeker-profile/${tpJobseekerDirectoryEntry.id}`
}
/>
) : (
<TpMainNavItem
page="profile-page"
pageName="My profile"
to="/app/me"
isActive={location.pathname === '/app/me'}
/>
)}
{companyProfile?.state ===
CompanyTalentPoolState.ProfileApproved ||
tpJobseekerDirectoryEntry?.state ===
Expand Down
Loading