diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/auth/components/CompanyProfile.jsx | 2 | ||||
| -rw-r--r-- | src/lib/auth/components/PersonalProfile.jsx | 4 | ||||
| -rw-r--r-- | src/lib/flashSale/api/flashSaleApi.js | 8 | ||||
| -rw-r--r-- | src/lib/flashSale/components/FlashSale.jsx | 37 | ||||
| -rw-r--r-- | src/lib/home/components/PreferredBrand.jsx | 2 |
5 files changed, 49 insertions, 4 deletions
diff --git a/src/lib/auth/components/CompanyProfile.jsx b/src/lib/auth/components/CompanyProfile.jsx index 854aa246..13d4a194 100644 --- a/src/lib/auth/components/CompanyProfile.jsx +++ b/src/lib/auth/components/CompanyProfile.jsx @@ -76,7 +76,7 @@ const CompanyProfile = () => { Dibawah ini adalah data usaha yang anda masukkan, periksa kembali data usaha anda. </div> </div> - <div className='p-2 bg-gray_r-3 rounded'> + <div className='ml-2 p-2 bg-gray_r-3 rounded'> {!isOpen && <ChevronDownIcon className='w-6' />} {isOpen && <ChevronUpIcon className='w-6' />} </div> diff --git a/src/lib/auth/components/PersonalProfile.jsx b/src/lib/auth/components/PersonalProfile.jsx index 4a533ae9..bca54e24 100644 --- a/src/lib/auth/components/PersonalProfile.jsx +++ b/src/lib/auth/components/PersonalProfile.jsx @@ -9,7 +9,7 @@ import editPersonalProfileApi from '../api/editPersonalProfileApi' const PersonalProfile = () => { const auth = useAuth() - const [isOpen, setIsOpen] = useState(false) + const [isOpen, setIsOpen] = useState(true) const toggle = () => setIsOpen(!isOpen) const { register, setValue, handleSubmit } = useForm({ defaultValues: { @@ -54,7 +54,7 @@ const PersonalProfile = () => { Dibawah ini adalah data diri yang anda masukan, periksa kembali data diri anda </div> </div> - <div className='p-2 bg-gray_r-3 rounded'> + <div className='ml-2 p-2 bg-gray_r-3 rounded'> {!isOpen && <ChevronDownIcon className='w-6' />} {isOpen && <ChevronUpIcon className='w-6' />} </div> diff --git a/src/lib/flashSale/api/flashSaleApi.js b/src/lib/flashSale/api/flashSaleApi.js new file mode 100644 index 00000000..115b07dc --- /dev/null +++ b/src/lib/flashSale/api/flashSaleApi.js @@ -0,0 +1,8 @@ +import odooApi from '@/core/api/odooApi' + +const flashSaleApi = async () => { + const flashSale = await odooApi('GET', '/api/v1/flashsale/header') + return flashSale +} + +export default flashSaleApi diff --git a/src/lib/flashSale/components/FlashSale.jsx b/src/lib/flashSale/components/FlashSale.jsx new file mode 100644 index 00000000..0167dc57 --- /dev/null +++ b/src/lib/flashSale/components/FlashSale.jsx @@ -0,0 +1,37 @@ +import { useEffect, useState } from 'react' +import flashSaleApi from '../api/flashSaleApi' +import Image from '@/core/components/elements/Image/Image' +import CountDown from '@/core/components/elements/CountDown/CountDown' + +const FlashSale = () => { + const [flashSales, setFlashSales] = useState(null) + + useEffect(() => { + const loadFlashSales = async () => { + const dataFlashSales = await flashSaleApi() + setFlashSales(dataFlashSales) + } + loadFlashSales() + }, []) + + return flashSales?.length > 0 && ( + <div className='px-4 sm:px-0'> + + {flashSales.map((flashSale, index) => ( + <div key={index}> + <div className='font-medium sm:text-h-lg mb-4'>{flashSale.name}</div> + + <div className='relative'> + <div className='absolute top-0 left-0 p-4'> + <CountDown initialTime={flashSale.duration} /> + </div> + <Image src={flashSale.banner} alt={flashSale.name} className='w-full rounded' /> + </div> + + </div> + ))} + </div> + ) +} + +export default FlashSale diff --git a/src/lib/home/components/PreferredBrand.jsx b/src/lib/home/components/PreferredBrand.jsx index f97943cb..34c50220 100644 --- a/src/lib/home/components/PreferredBrand.jsx +++ b/src/lib/home/components/PreferredBrand.jsx @@ -14,7 +14,7 @@ const PreferredBrand = () => { <div className='flex justify-between items-center mb-4'> <div className='font-medium sm:text-h-lg'>Brand Pilihan</div> {isDesktop && ( - <Link href='/' className='btn-yellow !text-gray_r-12'> + <Link href='/shop/brands' className='btn-yellow !text-gray_r-12'> Lihat Semua </Link> )} |
