Skip to content

Commit

Permalink
Merge pull request #83 from opherlabs/main
Browse files Browse the repository at this point in the history
fix quizComponent routing url
  • Loading branch information
mitch1009 authored Sep 19, 2024
2 parents 0dcb044 + f32c640 commit ae7ead6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@opherlabs/components",
"version": "1.0.15",
"version": "1.2.0-0",

"private": false,
"license": "MIT",
"description": "A collection of reusable NextJs Optimized components for building scalable user interfaces.",
Expand Down
2 changes: 1 addition & 1 deletion components/src/app/cards/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function CardsComponent() {
style={{ backgroundImage: 'url("/cards/flag.svg")' }}
>
<div className="rounded-lg w-full">
<QuizComponent files={files} />
<QuizComponent url="cards" files={files} />
</div>
</div>
);
Expand Down
5 changes: 3 additions & 2 deletions components/src/components/QuizCards/QuizComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ type FileItem = {

interface FileDetailProps {
files: FileItem[];
url: string;
}

export const QuizComponent: React.FC<FileDetailProps> = ({ files }) => {
export const QuizComponent: React.FC<FileDetailProps> = ({ files, url }) => {
const { id } = useParams<{ id: string }>();
const router = useRouter();
const file = files.find((item) => item.id === id);
Expand Down Expand Up @@ -90,7 +91,7 @@ export const QuizComponent: React.FC<FileDetailProps> = ({ files }) => {

const handleCloseModal = () => {
setIsModalOpen(false);
router.push("/cards");
router.push(`/${url}`);
};

return (
Expand Down

0 comments on commit ae7ead6

Please sign in to comment.