Skip to content

Commit

Permalink
style: truncate class/course title with an ellipsis at the end
Browse files Browse the repository at this point in the history
  • Loading branch information
sergivalero20 committed Oct 22, 2024
1 parent 87d41e6 commit 31a9ca2
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/features/Dashboard/DashboardPage/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
min-height: 426px;
}

.truncated-text {
width: 200px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

.schedule-section {
margin-bottom: 2rem;
}
Expand Down
27 changes: 25 additions & 2 deletions src/features/Dashboard/InstructorAssignSection/ClassCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useHistory } from 'react-router-dom';
import PropTypes from 'prop-types';

import { Button } from 'react-paragon-topaz';
import { Tooltip, OverlayTrigger } from '@edx/paragon';

import { formatDateRange } from 'helpers';
import { useInstitutionIdQueryParam } from 'hooks';
Expand All @@ -19,8 +20,30 @@ const ClassCard = ({ data }) => {

return (
<div className="class-card-container">
<h4>{data?.className}</h4>
<p className="course-name">{data?.masterCourseName}</p>
<OverlayTrigger
placement="top"
overlay={
(
<Tooltip>
{data?.className}
</Tooltip>
)
}
>
<h4 className="truncated-text">{data?.className}</h4>
</OverlayTrigger>
<OverlayTrigger
placement="left"
overlay={
(
<Tooltip>
{data?.masterCourseName}
</Tooltip>
)
}
>
<p className="course-name truncated-text">{data?.masterCourseName}</p>
</OverlayTrigger>
<p className="date"><i className="fa-sharp fa-regular fa-calendar-day" />{formatDateRange(data.startDate, data?.endDate)}</p>
<Button variant="outline-primary" size="sm" onClick={handleManageButton}>
<i className="fa-regular fa-chalkboard-user" />
Expand Down

0 comments on commit 31a9ca2

Please sign in to comment.