Skip to content

Commit b4577ed

Browse files
authored
Merge pull request #1115 from FaheemOnHub/add/typeLevel/learningCard
add: Clipboard copy for org_id && add: level and type into learningCard
2 parents 07e3a60 + f6aab17 commit b4577ed

File tree

2 files changed

+30
-6
lines changed

2 files changed

+30
-6
lines changed

src/custom/LearningCard/LearningCard.tsx

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import React, { useState } from 'react';
2-
import { Typography } from '../../base';
2+
import { Grid2, Typography } from '../../base';
33
import { ExternalLinkIcon } from '../../icons';
44
import { Modal, ModalBody, ModalButtonPrimary, ModalButtonSecondary, ModalFooter } from '../Modal';
5+
import { CopyToClipboard } from '../ResourceDetailFormatters/Component';
56
import {
67
Card2,
78
CardActive,
@@ -24,6 +25,8 @@ interface Tutorial {
2425
description: string;
2526
status?: boolean;
2627
cardImage: string;
28+
type?: string;
29+
level?: string;
2730
};
2831
}
2932

@@ -129,12 +132,16 @@ const LearningCard: React.FC<Props> = ({
129132
<CardActive>
130133
<CardParent style={{ borderTop: `5px solid ${tutorial.frontmatter.themeColor}` }}>
131134
<div>
132-
<CardHead>
133-
<h3>
135+
<CardHead style={{ flexDirection: 'column' }}>
136+
<Typography variant="body1" color="textSecondary">
137+
{tutorial.frontmatter.type}
138+
</Typography>
139+
<h3 style={{ margin: '0.2rem 0.1rem' }}>
134140
{tutorial.frontmatter.title
135141
? tutorial.frontmatter.title
136142
: tutorial.frontmatter.courseTitle}
137143
</h3>
144+
138145
{tutorial.frontmatter.status ? (
139146
<p>
140147
<span>New</span>
@@ -150,6 +157,13 @@ const LearningCard: React.FC<Props> = ({
150157
{courseCount} {courseType}
151158
{courseCount > 1 ? 's' : ''}
152159
</p>
160+
<p>
161+
Level:{' '}
162+
{tutorial?.frontmatter?.level
163+
? tutorial.frontmatter.level.charAt(0).toUpperCase() +
164+
tutorial.frontmatter.level.slice(1)
165+
: ''}
166+
</p>
153167
</CardSubdata>
154168
)}
155169
<CardImage>
@@ -172,9 +186,16 @@ const LearningCard: React.FC<Props> = ({
172186
<ModalBody>
173187
<Typography variant="body1">{modalContent}</Typography>
174188
{orgId && (
175-
<Typography variant="body1" color="textSecondary">
176-
Your Organization ID: {orgId}
177-
</Typography>
189+
<Grid2 container direction="row" alignItems="center" spacing={1}>
190+
<Grid2>
191+
<Typography variant="body1" color="textSecondary">
192+
Your Organization ID: {orgId}
193+
</Typography>
194+
</Grid2>
195+
<Grid2>
196+
<CopyToClipboard data={orgId} />
197+
</Grid2>
198+
</Grid2>
178199
)}
179200
</ModalBody>
180201
<ModalFooter variant="filled">

src/custom/LearningCard/style.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { styled } from '@mui/material/styles';
22
import { BLACK, ONYX_BLACK, SILVER_GRAY, WHITE } from '../../theme';
33

44
const CardWrapper = styled('div')({
5+
width: '100%',
56
maxWidth: '28rem',
67
minWidth: '10rem',
78
height: '16rem',
@@ -102,6 +103,8 @@ const CardDesc = styled('div')(({ theme }) => ({
102103
const CardSubdata = styled('div')(({ theme }) => ({
103104
padding: '0 1rem',
104105
position: 'absolute',
106+
display: 'flex',
107+
gap: '0.4rem',
105108
bottom: '0rem',
106109
p: {
107110
fontSize: '1rem',

0 commit comments

Comments
 (0)