Improve sidebar of course

feat/course
Kamran Ahmed 2 months ago
parent 13212c2f50
commit b21db4c641
  1. 5
      src/components/Course/Chapter.tsx
  2. 8
      src/components/Course/CircularProgress.tsx

@ -89,15 +89,16 @@ export function Chapter(props: ChapterProps) {
<div> <div>
<button <button
className={cn( className={cn(
'relative z-10 flex w-full flex-row items-center gap-2 border-b px-2 py-4 text-base', 'relative z-10 flex w-full flex-row items-center gap-2 border-b px-2 py-4 text-base text-gray-600',
{ {
'text-black': true, 'text-black': isActive,
}, },
)} )}
onClick={onChapterClick} onClick={onChapterClick}
> >
<CircularProgress <CircularProgress
isVisible={!isChapterCompleted} isVisible={!isChapterCompleted}
isActive={isActive}
percentage={Number(completedPercentage) || 5} percentage={Number(completedPercentage) || 5}
> >
<div <div

@ -1,11 +1,15 @@
import { cn } from '../../lib/classname';
export function CircularProgress({ export function CircularProgress({
percentage, percentage,
children, children,
isVisible = true, isVisible = true,
isActive = false,
}: { }: {
percentage: number; percentage: number;
children: React.ReactNode; children: React.ReactNode;
isVisible?: boolean; isVisible?: boolean;
isActive?: boolean;
}) { }) {
const circumference = 2 * Math.PI * 13; const circumference = 2 * Math.PI * 13;
const strokeDasharray = `${circumference}`; const strokeDasharray = `${circumference}`;
@ -22,7 +26,9 @@ export function CircularProgress({
stroke="currentColor" stroke="currentColor"
strokeWidth="1.75" strokeWidth="1.75"
fill="none" fill="none"
className="text-green-600" className={cn('text-gray-400/70', {
'text-black': isActive,
})}
style={{ style={{
strokeDasharray, strokeDasharray,
strokeDashoffset, strokeDashoffset,

Loading…
Cancel
Save