From c0f523bf49a160f74158fe61b6f5916fa6176322 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Tue, 13 Dec 2022 18:02:44 +0700 Subject: Merapihkan tampilan --- src/pages/index.js | 21 ++++++++++----------- src/pages/login.js | 10 ++++++---- src/pages/register.js | 13 ++++++++----- src/pages/shop/brands/[slug].js | 2 +- src/pages/shop/product/[slug].js | 16 ++++++++-------- 5 files changed, 33 insertions(+), 29 deletions(-) (limited to 'src/pages') diff --git a/src/pages/index.js b/src/pages/index.js index ee746519..d110e7de 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -13,19 +13,18 @@ import Layout from "../components/Layout"; import axios from "axios"; import ManufactureCard from "../components/ManufactureCard"; -export default function Home() { - const [heroBanners, setHeroBanners] = useState(null); +export async function getServerSideProps() { + const heroBanners = await apiOdoo('GET', `/api/v1/banner?type=index-a-1`); + + return { props: { heroBanners } }; +} + +export default function Home({ heroBanners }) { const [manufactures, setManufactures] = useState(null); const [readyStockProducts, setReadyStockProducts] = useState(null); const [popularProducts, setPopularProducts] = useState(null); useEffect(() => { - const getHeroBanners = async () => { - const dataHeroBanners = await apiOdoo('GET', `/api/v1/banner?type=index-a-1`); - setHeroBanners(dataHeroBanners); - } - getHeroBanners(); - const getManufactures = async () => { const dataManufactures = await apiOdoo('GET', `/api/v1/manufacture?level=prioritas`); setManufactures(dataManufactures); @@ -59,7 +58,7 @@ export default function Home() { }
-

Brand Pilihan

+

Brand Pilihan

{ manufactures?.manufactures?.map((manufacture, index) => ( @@ -71,11 +70,11 @@ export default function Home() {
-

Produk Populer

+

Produk Populer

-

Produk Ready Stock

+

Produk Ready Stock

diff --git a/src/pages/login.js b/src/pages/login.js index cb299afa..b67564d2 100644 --- a/src/pages/login.js +++ b/src/pages/login.js @@ -57,22 +57,24 @@ export default function Login() { Logo Indoteknik -

Mulai Belanja Sekarang

-

Masuk ke akun kamu untuk belanja

+

Mulai Belanja Sekarang

+

Masuk ke akun kamu untuk belanja

{alert ? ( {alert.component} ) : ''}
+ setEmail(e.target.value)} /> + setPassword(e.target.value)} diff --git a/src/pages/register.js b/src/pages/register.js index 41bd7c75..6b366387 100644 --- a/src/pages/register.js +++ b/src/pages/register.js @@ -55,29 +55,32 @@ export default function Login() { Logo Indoteknik -

Mudahkan Pembelian dengan Indoteknik

-

Daftar untuk melanjutkan

+

Mudahkan Pembelian dengan Indoteknik

+

Daftar untuk melanjutkan

{alert ? ( {alert.component} ) : ''} + setEmail(e.target.value)} /> + setName(e.target.value)} /> + setPassword(e.target.value)} diff --git a/src/pages/shop/brands/[slug].js b/src/pages/shop/brands/[slug].js index c0524207..320c4454 100644 --- a/src/pages/shop/brands/[slug].js +++ b/src/pages/shop/brands/[slug].js @@ -89,7 +89,7 @@ export default function BrandDetail({ Filter

Produk

-
+
{productFound > 0 ? ( <> Menampilkan  diff --git a/src/pages/shop/product/[slug].js b/src/pages/shop/product/[slug].js index 1ef693c0..c0119c8f 100644 --- a/src/pages/shop/product/[slug].js +++ b/src/pages/shop/product/[slug].js @@ -82,33 +82,33 @@ export default function ProductDetail({ product }) { <>
- +
{product.manufacture.name ?? '-'} -

{product.name}{activeVariant.attributes ? ' - ' + activeVariant.attributes : ''}

+

{product.name}{activeVariant.attributes ? ' - ' + activeVariant.attributes : ''}

{product.variant_total > 1 && !selectedVariant ? (

Harga mulai dari:

) : ''} {product.lowest_price.discount_percentage > 0 ? ( -
+
{activeVariant.price.discount_percentage}% -

{currencyFormat(activeVariant.price.price)}

+

{currencyFormat(activeVariant.price.price)}

) : ''} {product.lowest_price.price > 0 ? ( -

{currencyFormat(activeVariant.price.price_discount)}

+

{currencyFormat(activeVariant.price.price_discount)}

) : ( -

Dapatkan harga terbaik, hubungi kami.

+

Dapatkan harga terbaik, hubungi kami.

)}
- +
- + setQuantity(e.target.value)} />
-- cgit v1.2.3