Advertisement
xcage88

DaftarCard

May 21st, 2023
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, { useEffect, useState } from 'react'
  2. import { Button } from 'react-bootstrap'
  3. import style from './style.module.css'
  4. import { useNavigate } from 'react-router-dom'
  5. import { useParams } from 'react-router-dom'
  6. import { useDispatch, useSelector } from 'react-redux'
  7. import { fetchProduct } from '../../../manage/action'
  8.  
  9. // import { cardArray } from '../../../utils/cardArray'
  10.  
  11. function DaftarCard() {
  12.  
  13.     const {id} = useParams()
  14.     const navigate = useNavigate()
  15.     const dispatch = useDispatch()
  16.     const {entity} = useSelector((state) => state.bootcamp)
  17.  
  18.     const fetchData = async(bootcampId) => {
  19.         dispatch(fetchProduct(bootcampId))
  20.     }
  21.  
  22.     useEffect(() => {
  23.         fetchData(id)
  24.     },[])
  25.  
  26.     const goToCheckOut = (bootcampId) => {
  27.         navigate(`/checkout/${bootcampId}`)
  28.     }
  29.     return (
  30.         <>
  31.             <div className={style['container']}>
  32.                 <div className={style['card-header']}>
  33.                     <div className={style['materi']}>
  34.                         <h5>Materi</h5>
  35.                     </div>
  36.                     <div className={style['fasilitas']}>
  37.                         <h5>Fasilitas</h5>
  38.                     </div>
  39.                 </div>
  40.                 <div className={style['card-body']}>
  41.                     <p className={style['normal']}>Rp. 125.000</p>
  42.                     <p>Rp. 99.000</p>
  43.                 </div>
  44.                 <Button variant='warning' style={{color: '#fff'}} onClick={() => goToCheckOut(entity.id)}>Daftar Kelas</Button>
  45.             </div>
  46.         </>
  47.     )
  48. }
  49.  
  50. export default DaftarCard
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement