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/components/ProductCard.js | 6 ++-- 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 +++++----- src/styles/globals.css | 67 ++++++++++++++++++++++------------------ 7 files changed, 73 insertions(+), 62 deletions(-) (limited to 'src') diff --git a/src/components/ProductCard.js b/src/components/ProductCard.js index 0fe47196..64624d70 100644 --- a/src/components/ProductCard.js +++ b/src/components/ProductCard.js @@ -29,13 +29,13 @@ export default function ProductCard({ data }) {
{product.lowest_price.discount_percentage > 0 ? ( -
+
{product.lowest_price.discount_percentage}% -

{currencyFormat(product.lowest_price.price)}

+

{currencyFormat(product.lowest_price.price)}

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

+

{currencyFormat(product.lowest_price.price_discount)}

) : ( 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)} />
diff --git a/src/styles/globals.css b/src/styles/globals.css index 5033a220..d9f33913 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -7,25 +7,31 @@ html, body { @apply w-screen - text-base - text-gray-900 - bg-gray-50 + text-body + text-gray_r-12 + bg-gray_r-1 ; } @layer base { h1, .h1 { @apply - text-lg + text-h6 + font-semibold + ; + } + + h2, .h2 { + @apply + text-body font-semibold - text-gray-900 ; } a { @apply font-medium - text-yellow-900 + text-yellow_r-11 ; } } @@ -37,9 +43,10 @@ html, body { .badge-green { @apply text-xs + leading-none font-medium px-1 - py-0.5 + py-1 rounded w-fit ; @@ -47,36 +54,35 @@ html, body { .badge-red { @apply - bg-red-300 - text-red-900 + bg-red_r-6 + text-red_r-11 ; } .badge-gray { @apply - bg-gray-200 - text-gray-700 + bg-gray_r-6 + text-gray_r-11 ; } .badge-yellow { @apply - bg-yellow-300 - text-yellow-900 + bg-yellow_r-6 + text-yellow_r-11 ; } .badge-green { @apply - bg-green-200 - text-green-700 + bg-green-100 + text-green-800 ; } .form-label { @apply - text-sm - mb-1 + font-medium block ; } @@ -86,13 +92,14 @@ html, body { p-3 rounded border - border-gray-300 + text-gray_r-11 + border-gray_r-7 bg-transparent w-full leading-none focus:outline-none focus:ring-1 - focus:ring-yellow-900 + focus:ring-yellow_r-9 ; } @@ -101,15 +108,14 @@ html, body { block w-fit p-3 - bg-yellow-900 - border-yellow-900 + bg-yellow_r-9 + border-yellow_r-9 rounded border - text-gray-900 text-center - disabled:text-gray-700 - disabled:bg-yellow-700 - disabled:border-yellow-700 + disabled:text-gray_r-10 + disabled:bg-yellow_r-7 + disabled:border-yellow_r-7 ease-linear duration-150 ; @@ -134,7 +140,8 @@ html, body { w-full h-full border - border-gray-300 + border-gray_r-6 + bg-gray_r-2 rounded relative flex @@ -164,13 +171,13 @@ html, body { .product-card__title { @apply - text-sm - text-gray-900 + text-caption-p + text-gray_r-12 ; } .product-card__brand { - @apply text-sm; + @apply text-caption-p; } } @@ -339,7 +346,7 @@ html, body { rounded ease-linear bg-gray-100 - text-sm + text-caption ; } -- cgit v1.2.3