Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DOJO exercises nav card #2265

Merged
merged 14 commits into from
Sep 11, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions pages/exercises/[lessonSlug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Error, { StatusCode } from '../../components/Error'
import LoadingSpinner from '../../components/LoadingSpinner'
import GET_APP from '../../graphql/queries/getApp'
import AlertsDisplay from '../../components/AlertsDisplay'
import NavLink from '../../components/NavLink'

const Exercises: React.FC<QueryDataProps<GetAppQuery>> = ({ queryData }) => {
const { lessons, alerts } = queryData
Expand All @@ -25,12 +26,45 @@ const Exercises: React.FC<QueryDataProps<GetAppQuery>> = ({ queryData }) => {

return (
<Layout title={currentLesson.title}>
<ExercisesNavCard lessonDocUrl={currentLesson.docUrl} lessonSlug={slug} />
<h1>{currentLesson.title}</h1>
{alerts && <AlertsDisplay alerts={alerts} />}
</Layout>
)
}

type ExercisesNavCardProps = {
lessonDocUrl: string | null | undefined
bryanjenningz marked this conversation as resolved.
Show resolved Hide resolved
lessonSlug: string
}

const ExercisesNavCard = ({
lessonDocUrl,
lessonSlug
}: ExercisesNavCardProps) => {
return (
<div className="card shadow-sm d-inline-flex flex-row p-2 mb-4">
{lessonDocUrl && (
<NavLink
path={lessonDocUrl}
className="py-2 px-3 mx-1 fw-bold text-primary"
>
LESSONS
</NavLink>
)}
<NavLink
path={`/curriculum/${lessonSlug}`}
className="py-2 px-3 mx-1 fw-bold text-primary"
>
CHALLENGES
</NavLink>
<div className="py-2 px-3 mx-1 fw-bold bg-primary text-white rounded">
EXERCISES
</div>
bryanjenningz marked this conversation as resolved.
Show resolved Hide resolved
</div>
)
}
bryanjenningz marked this conversation as resolved.
Show resolved Hide resolved

export default withQueryLoader<GetAppQuery>(
{
query: GET_APP
Expand Down