|
1 | | -import { FormattedMessage } from '@edx/frontend-platform/i18n'; |
2 | | -import { Button, Card, Icon } from '@openedx/paragon'; |
| 1 | +import { FormattedMessage, useIntl } from '@edx/frontend-platform/i18n'; |
3 | 2 | import { |
| 3 | + Button, |
| 4 | + Card, |
| 5 | + Icon, |
| 6 | +} from '@openedx/paragon'; |
| 7 | +import { |
| 8 | + ArrowForwardIos, |
4 | 9 | Check, |
5 | 10 | Error, |
6 | 11 | Folder, |
@@ -48,34 +53,46 @@ const StateIcon = ({ state }: { state: CourseImport['state'] }) => ( |
48 | 53 | ); |
49 | 54 |
|
50 | 55 | export const ImportedCourseCard = ({ courseImport }: ImportedCourseCardProps) => { |
| 56 | + const intl = useIntl(); |
51 | 57 | const { navigateTo } = useLibraryRoutes(); |
52 | 58 |
|
53 | 59 | return ( |
54 | 60 | <Card className={BORDER_CLASS[courseImport.state]}> |
55 | | - <Card.Section> |
56 | | - <Link to={`/course/${courseImport.source.key}`}> |
57 | | - <h4>{courseImport.source.displayName}</h4> |
58 | | - </Link> |
59 | | - <div className="d-inline-flex small align-items-center"> |
60 | | - <StateIcon state={courseImport.state} /> |
61 | | - {courseImport.state === 'Failed' ? ( |
62 | | - <FormattedMessage {...messages.courseImportTextFailed} /> |
63 | | - ) : ( |
64 | | - <> |
65 | | - {Math.round(courseImport.progress * 100)} |
66 | | - <FormattedMessage {...messages.courseImportTextProgress} /> |
67 | | - </> |
68 | | - )} |
69 | | - {courseImport.targetCollection && ( |
70 | | - <Button |
71 | | - iconBefore={Folder} |
72 | | - variant="link" |
73 | | - className="ml-4" |
74 | | - onClick={() => navigateTo({ collectionId: courseImport.targetCollection!.key })} |
75 | | - > |
76 | | - {courseImport.targetCollection.title} |
77 | | - </Button> |
78 | | - )} |
| 61 | + <Card.Section className="d-flex flex-row"> |
| 62 | + <div> |
| 63 | + <Link to={`/course/${courseImport.source.key}`}> |
| 64 | + <h4>{courseImport.source.displayName}</h4> |
| 65 | + </Link> |
| 66 | + <div className="d-inline-flex small align-items-center"> |
| 67 | + <StateIcon state={courseImport.state} /> |
| 68 | + {courseImport.state === 'Failed' ? ( |
| 69 | + <FormattedMessage {...messages.courseImportTextFailed} /> |
| 70 | + ) : ( |
| 71 | + <> |
| 72 | + {Math.round(courseImport.progress * 100)} |
| 73 | + <FormattedMessage {...messages.courseImportTextProgress} /> |
| 74 | + </> |
| 75 | + )} |
| 76 | + {courseImport.targetCollection && ( |
| 77 | + <Button |
| 78 | + iconBefore={Folder} |
| 79 | + variant="link" |
| 80 | + className="ml-4 text-black text-decoration-underline" |
| 81 | + onClick={() => navigateTo({ collectionId: courseImport.targetCollection!.key })} |
| 82 | + > |
| 83 | + {courseImport.targetCollection.title} |
| 84 | + </Button> |
| 85 | + )} |
| 86 | + </div> |
| 87 | + </div> |
| 88 | + <div className="d-flex align-items-center ml-auto"> |
| 89 | + <Link |
| 90 | + to={`/course/${courseImport.source.key}`} |
| 91 | + aria-label={intl.formatMessage(messages.courseImportNavigateAlt)} |
| 92 | + className="text-primary-500" |
| 93 | + > |
| 94 | + <Icon src={ArrowForwardIos} /> |
| 95 | + </Link> |
79 | 96 | </div> |
80 | 97 | </Card.Section> |
81 | 98 | </Card> |
|
0 commit comments