Skip to content

Commit

Permalink
fix top breadcrumb
Browse files Browse the repository at this point in the history
  • Loading branch information
holtzy committed Aug 8, 2024
1 parent b96da40 commit acd143f
Show file tree
Hide file tree
Showing 19 changed files with 166 additions and 25 deletions.
68 changes: 43 additions & 25 deletions component/TocBreadcrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { moduleList } from '@/util/moduleList';
import { Lesson, lessonList } from '@/util/lessonList';
import { Circle } from 'lucide-react';
import { LessonBadge } from './LessonBadge';
import Link from 'next/link';

type TocBreadcrumbProps = {
selectedLesson: Lesson;
Expand All @@ -41,6 +42,7 @@ export const TocBreadcrumb = ({ selectedLesson }: TocBreadcrumbProps) => {
return (
<Breadcrumb>
<BreadcrumbList>
{/* ////////////// Most left = back to course home page */}
<BreadcrumbItem>
<BreadcrumbLink
href="/react-d3-dataviz-course"
Expand All @@ -56,6 +58,7 @@ export const TocBreadcrumb = ({ selectedLesson }: TocBreadcrumbProps) => {

<BreadcrumbSeparator />

{/* ////////////// Middle = list of modules */}
<BreadcrumbItem>
<DropdownMenu>
<DropdownMenuTrigger asChild>
Expand Down Expand Up @@ -86,17 +89,24 @@ export const TocBreadcrumb = ({ selectedLesson }: TocBreadcrumbProps) => {
.filter((lesson) => lesson.moduleId === module.id)
.map((lesson, i) => {
return (
<DropdownMenuItem key={i}>
<Circle
fill="black"
size={8}
className="mr-2"
opacity={
lesson.name === selectedLesson.name ? 1 : 0
}
/>
<span>{lesson.name}</span>
</DropdownMenuItem>
<Link
className="no-underline text-black"
href={lesson.link}
>
<DropdownMenuItem key={i}>
<Circle
fill="black"
size={8}
className="mr-2"
opacity={
lesson.name === selectedLesson.name
? 1
: 0
}
/>
<span>{lesson.name}</span>
</DropdownMenuItem>
</Link>
);
})}
</DropdownMenuSubContent>
Expand All @@ -110,6 +120,7 @@ export const TocBreadcrumb = ({ selectedLesson }: TocBreadcrumbProps) => {

<BreadcrumbSeparator />

{/* ////////////// Right = list of lessons */}
<BreadcrumbItem>
<DropdownMenu>
<DropdownMenuTrigger asChild>
Expand All @@ -126,21 +137,28 @@ export const TocBreadcrumb = ({ selectedLesson }: TocBreadcrumbProps) => {
.filter((lesson) => lesson.moduleId === selectedModuleId)
.map((lesson, i) => {
return (
<DropdownMenuItem
key={i}
className="flex justify-between gap-4"
<Link
className="no-underline text-black"
href={lesson.link}
>
<div className="flex items-center">
<Circle
fill="black"
size={8}
className="mr-2"
opacity={lesson.name === selectedLesson.name ? 1 : 0}
/>
{lesson.name}
</div>
<LessonBadge lessonStatus={lesson.status} />
</DropdownMenuItem>
<DropdownMenuItem
key={i}
className="flex justify-between gap-4"
>
<div className="flex items-center">
<Circle
fill="black"
size={8}
className="mr-2"
opacity={
lesson.name === selectedLesson.name ? 1 : 0
}
/>
{lesson.name}
</div>
<LessonBadge lessonStatus={lesson.status} />
</DropdownMenuItem>
</Link>
);
})}
</DropdownMenuContent>
Expand Down
9 changes: 9 additions & 0 deletions exercise/SvgLinePractice/SvgLine.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const SvgLine = () => {
return (
<svg width={500} height={300}>
<text x="50" y="50" fill="black">
Draw a line here!
</text>
</svg>
);
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions exercise/SvgLineSolution/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// File used to render something in codesandbox only
import ReactDOM from 'react-dom';
import { SvgLine } from './SvgLine';

const rootElement = document.getElementById('root');
ReactDOM.render(<SvgLine />, rootElement);
File renamed without changes.
9 changes: 9 additions & 0 deletions exercise/SvgRectanglePractice/SvgRectangle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const SvgRectangle = () => {
return (
<svg width={500} height={300}>
<text x="50" y="50" fill="black">
Draw a rect here!
</text>
</svg>
);
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions exercise/SvgRectangleSolution/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// File used to render something in codesandbox only
import ReactDOM from 'react-dom';
import { SvgRectangle } from './SvgRectangle';

const rootElement = document.getElementById('root');
ReactDOM.render(<SvgRectangle />, rootElement);
28 changes: 28 additions & 0 deletions exercise/SvgRectangleSolution/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "pie-chart-basic",
"version": "1.0.0",
"description": "",
"keywords": [],
"main": "index.js",
"dependencies": {
"react": "17.0.2",
"react-dom": "17.0.2",
"react-scripts": "4.0.0"
},
"devDependencies": {
"@babel/runtime": "7.13.8",
"typescript": "4.1.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
3 changes: 3 additions & 0 deletions exercise/SvgTextPractice/SvgText.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const SvgText = () => {
return <svg width={500} height={300}></svg>;
};
File renamed without changes.
28 changes: 28 additions & 0 deletions exercise/SvgTextPractice/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "pie-chart-basic",
"version": "1.0.0",
"description": "",
"keywords": [],
"main": "index.js",
"dependencies": {
"react": "17.0.2",
"react-dom": "17.0.2",
"react-scripts": "4.0.0"
},
"devDependencies": {
"@babel/runtime": "7.13.8",
"typescript": "4.1.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
File renamed without changes.
6 changes: 6 additions & 0 deletions exercise/SvgTextSolution/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// File used to render something in codesandbox only
import ReactDOM from 'react-dom';
import { SvgText } from './SvgText';

const rootElement = document.getElementById('root');
ReactDOM.render(<SvgText />, rootElement);
28 changes: 28 additions & 0 deletions exercise/SvgTextSolution/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "pie-chart-basic",
"version": "1.0.0",
"description": "",
"keywords": [],
"main": "index.js",
"dependencies": {
"react": "17.0.2",
"react-dom": "17.0.2",
"react-scripts": "4.0.0"
},
"devDependencies": {
"@babel/runtime": "7.13.8",
"typescript": "4.1.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}

0 comments on commit acd143f

Please sign in to comment.