1st push
This commit is contained in:
parent
501d8a8d8e
commit
3226975910
76 changed files with 48623 additions and 3401 deletions
39
components/menuitem.js
Normal file
39
components/menuitem.js
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import { Card, CardBody, CardFooter, CardHeader } from "@chakra-ui/react"
|
||||
|
||||
import { Heading, Image, Stack, Text } from "@chakra-ui/react"
|
||||
import { useRouter } from "next/router"
|
||||
import React, { useContext, useEffect, useState } from "react"
|
||||
|
||||
export default function MenuItem(props) {
|
||||
//define states here
|
||||
const [isloaded, setIsLoaded] = React.useState(false)
|
||||
|
||||
//router
|
||||
const router = useRouter()
|
||||
|
||||
useEffect(() => {
|
||||
if (!isloaded) {
|
||||
console.log("isloaded called")
|
||||
|
||||
setIsLoaded(true)
|
||||
}
|
||||
})
|
||||
|
||||
//function when clicked
|
||||
|
||||
const handleOnClick = (e) => {
|
||||
router.push(`/learningpath/${props.id}`)
|
||||
}
|
||||
|
||||
return (
|
||||
<Card onClick={handleOnClick}>
|
||||
<CardBody>
|
||||
<Image src={props.image_url} alt={props.image_desc} borderRadius="lg" />
|
||||
<Stack mt="6" spacing="3">
|
||||
<Heading size="md">{props.title}</Heading>
|
||||
<Text>{props.summary}</Text>
|
||||
</Stack>
|
||||
</CardBody>
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue