@@ -3,16 +3,19 @@ const withImages = require("next-images"); | |||
const withSass = require("@zeit/next-sass"); | |||
const webpack = require("webpack"); | |||
const path = require("path"); | |||
const withCSS = require('@zeit/next-css'); | |||
// const withCSS = require("@zeit/next-css"); | |||
// require("dotenv").config(); | |||
module.exports = withPlugins([[withSass], [withImages], [withCSS]], { | |||
module.exports = withPlugins([[withSass], [withImages]], { | |||
// env: { | |||
// API_URL: process.env.API_URL, | |||
// }, | |||
trailingSlash: true, | |||
webpack(config, options) { | |||
webpack(config, { dev }) { | |||
if (dev) { | |||
config.devtool = "cheap-module-source-map"; | |||
} | |||
config.resolve.modules.push(path.resolve("./")); | |||
return config; | |||
}, | |||
@@ -24,8 +24,8 @@ import Router from "next/router"; | |||
import PageChange from "components/PageChange/PageChange.js"; | |||
import "assets/scss/nextjs-material-kit.scss?v=1.1.0"; | |||
Router.events.on("routeChangeStart", url => { | |||
// import styles from "assets/jss/nextjs-material-kit/pages/components.js"; | |||
Router.events.on("routeChangeStart", (url) => { | |||
console.log(`Loading: ${url}`); | |||
document.body.classList.add("body-page-transition"); | |||
ReactDOM.render( | |||
@@ -43,26 +43,6 @@ Router.events.on("routeChangeError", () => { | |||
}); | |||
export default class MyApp extends App { | |||
componentDidMount() { | |||
let comment = document.createComment(` | |||
========================================================= | |||
* NextJS Material Kit v1.1.0 based on Material Kit Free - v2.0.2 (Bootstrap 4.0.0 Final Edition) and Material Kit React v1.8.0 | |||
========================================================= | |||
* Product Page: https://www.creative-tim.com/product/nextjs-material-kit | |||
* Copyright 2020 Creative Tim (https://www.creative-tim.com) | |||
* Licensed under MIT (https://github.com/creativetimofficial/nextjs-material-kit/blob/master/LICENSE.md) | |||
* Coded by Creative Tim | |||
========================================================= | |||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |||
`); | |||
document.insertBefore(comment, document.documentElement); | |||
} | |||
static async getInitialProps({ Component, router, ctx }) { | |||
let pageProps = {}; | |||
@@ -16,35 +16,44 @@ import Parallax from "components/Parallax/Parallax.js"; | |||
import styles from "assets/jss/nextjs-material-kit/pages/components.js"; | |||
import Button from "components/CustomButtons/Button.js"; | |||
import GetbusinessPartners from "../api/home/businessPartner.js" | |||
import Getservices from "../api/home/service.js" | |||
import Getcarousels from "../api/home/carousel.js" | |||
import GetbusinessPartners from "../api/home/businessPartner.js"; | |||
import Getservices from "../api/home/service.js"; | |||
import Getcarousels from "../api/home/carousel.js"; | |||
import DataSnackbarContent from "../pages-sections/snackbar.js"; | |||
import DataCarousel from "../pages-sections/home/carousel.js"; | |||
import DataService from "../pages-sections/home/service.js"; | |||
import DataBusinessPartner from "../pages-sections/home/business_partner.js"; | |||
import CoreValue from "../pages-sections/home/core_value.js" | |||
import CoreValue from "../pages-sections/home/core_value.js"; | |||
const useStyles = makeStyles(styles); | |||
const Home = function ({ backend, businessPartners, service, carousel, ...props }) { | |||
const Home = function ({ | |||
backend, | |||
businessPartners, | |||
service, | |||
carousel, | |||
...props | |||
}) { | |||
const classes = useStyles(); | |||
const { ...rest } = props; | |||
<DataService service={props.service}/> | |||
<DataService service={props.service} />; | |||
return ( | |||
<div> | |||
<Header | |||
rightLinks={<HeaderLinks/>} | |||
rightLinks={<HeaderLinks />} | |||
fixed | |||
color="info" | |||
changeColorOnScroll={{ | |||
height: 400, | |||
color: "white" | |||
color: "white", | |||
}} | |||
{...rest} | |||
/> | |||
<Parallax image={require("assets/img/welcome.png")} styles={{marginTop: "50px"}}> | |||
<Parallax | |||
image={require("assets/img/welcome.png")} | |||
styles={{ marginTop: "50px" }} | |||
> | |||
<div className={classes.container}> | |||
<GridContainer> | |||
{/* <GridItem> | |||
@@ -69,39 +78,42 @@ const Home = function ({ backend, businessPartners, service, carousel, ...props | |||
<div className={classNames(classes.main, classes.mainRaised)}> | |||
<DataSnackbarContent /> | |||
<CoreValue /> | |||
<DataCarousel carousel={carousel} backend={backend}/> | |||
<DataService service={service} backend={backend}/> | |||
<DataBusinessPartner businessPartners={businessPartners} backend={backend}/> | |||
<DataCarousel carousel={carousel} backend={backend} /> | |||
<DataService service={service} backend={backend} /> | |||
<DataBusinessPartner | |||
businessPartners={businessPartners} | |||
backend={backend} | |||
/> | |||
</div> | |||
<Footer /> | |||
</div> | |||
); | |||
} | |||
}; | |||
export async function getServerSideProps(context) { | |||
var businessPartners = []; | |||
var service = []; | |||
var businessPartners = []; | |||
var service = []; | |||
var carousel = []; | |||
const backend = process.env.BACKEND_SERVER_URI; | |||
var res = await GetbusinessPartners.GetbusinessPartners(); | |||
if (res["STATUS"] === 1) { | |||
businessPartners = res["DATA"]["businessPartners"]; | |||
} | |||
var res = await GetbusinessPartners.GetbusinessPartners(); | |||
if (res["STATUS"] === 1) { | |||
businessPartners = res["DATA"]["businessPartners"]; | |||
} | |||
var res = await Getservices.Getservices(); | |||
if (res["STATUS"] === 1) { | |||
service = res["DATA"]["services"]; | |||
} | |||
var res = await Getservices.Getservices(); | |||
if (res["STATUS"] === 1) { | |||
service = res["DATA"]["services"]; | |||
} | |||
var res = await Getcarousels.GetCarousels(); | |||
if (res["STATUS"] === 1) { | |||
carousel = res["DATA"]["carousels"]; | |||
} | |||
if (res["STATUS"] === 1) { | |||
carousel = res["DATA"]["carousels"]; | |||
} | |||
return { | |||
props: { businessPartners, service, carousel, backend }, // will be passed to the page component as props | |||
}; | |||
return { | |||
props: { businessPartners, service, carousel, backend }, // will be passed to the page component as props | |||
}; | |||
} | |||
export default Home; | |||
export default Home; |
@@ -16,22 +16,33 @@ import DataProduct from "pages-sections/product/product.js"; | |||
import Parallax from "components/Parallax/Parallax.js"; | |||
import styles from "assets/jss/nextjs-material-kit/pages/components.js"; | |||
import Getproduct from "../api/product/product.js" | |||
import Getproduct from "../api/product/product.js"; | |||
const useStyles = makeStyles(styles); | |||
const Product = function ({ backend, yamaha, suzuki, honda, hino, mercedes, bpr, emilia, homes, ...props }) { | |||
const Product = function ({ | |||
backend, | |||
yamaha, | |||
suzuki, | |||
honda, | |||
hino, | |||
mercedes, | |||
bpr, | |||
emilia, | |||
homes, | |||
...props | |||
}) { | |||
const classes = useStyles(); | |||
const { ...rest } = props; | |||
return ( | |||
<div> | |||
<Header | |||
rightLinks={<HeaderLinks/>} | |||
rightLinks={<HeaderLinks />} | |||
fixed | |||
color="info" | |||
changeColorOnScroll={{ | |||
height: 400, | |||
color: "white" | |||
color: "white", | |||
}} | |||
{...rest} | |||
/> | |||
@@ -50,12 +61,22 @@ const Product = function ({ backend, yamaha, suzuki, honda, hino, mercedes, bpr, | |||
</div> | |||
</Parallax> | |||
<div className={classNames(classes.main, classes.mainRaised)}> | |||
<DataProduct yamaha={yamaha} suzuki={suzuki} honda={honda} hino={hino} mercedes={mercedes} bpr={bpr} emilia={emilia} homes={homes} backend={backend}/> | |||
<DataProduct | |||
yamaha={yamaha} | |||
suzuki={suzuki} | |||
honda={honda} | |||
hino={hino} | |||
mercedes={mercedes} | |||
bpr={bpr} | |||
emilia={emilia} | |||
homes={homes} | |||
backend={backend} | |||
/> | |||
</div> | |||
<Footer /> | |||
</div> | |||
); | |||
} | |||
}; | |||
export default Product; | |||
@@ -70,47 +91,57 @@ export async function getServerSideProps(context) { | |||
var homes = []; | |||
const backend = process.env.BACKEND_SERVER_URI; | |||
var res = await Getproduct.GetProductYamaha(); | |||
if (res["STATUS"] === 1) { | |||
yamaha = res["DATA"]["products"]; | |||
} | |||
var res = await Getproduct.GetProductYamaha(); | |||
if (res["STATUS"] === 1) { | |||
yamaha = res["DATA"]["products"]; | |||
} | |||
var res = await Getproduct.GetProductSuzuki(); | |||
if (res["STATUS"] === 1) { | |||
suzuki = res["DATA"]["products"]; | |||
} | |||
if (res["STATUS"] === 1) { | |||
suzuki = res["DATA"]["products"]; | |||
} | |||
var res = await Getproduct.GetProductHonda(); | |||
if (res["STATUS"] === 1) { | |||
honda = res["DATA"]["products"]; | |||
} | |||
if (res["STATUS"] === 1) { | |||
honda = res["DATA"]["products"]; | |||
} | |||
var res = await Getproduct.GetProductHino(); | |||
if (res["STATUS"] === 1) { | |||
hino = res["DATA"]["products"]; | |||
} | |||
if (res["STATUS"] === 1) { | |||
hino = res["DATA"]["products"]; | |||
} | |||
var res = await Getproduct.GetProductMercedes(); | |||
if (res["STATUS"] === 1) { | |||
mercedes = res["DATA"]["products"]; | |||
} | |||
if (res["STATUS"] === 1) { | |||
mercedes = res["DATA"]["products"]; | |||
} | |||
var res = await Getproduct.GetProductBPR(); | |||
if (res["STATUS"] === 1) { | |||
bpr = res["DATA"]["products"]; | |||
} | |||
if (res["STATUS"] === 1) { | |||
bpr = res["DATA"]["products"]; | |||
} | |||
var res = await Getproduct.GetProductEmilia(); | |||
if (res["STATUS"] === 1) { | |||
emilia = res["DATA"]["products"]; | |||
} | |||
if (res["STATUS"] === 1) { | |||
emilia = res["DATA"]["products"]; | |||
} | |||
var res = await Getproduct.GetProductHomes(); | |||
if (res["STATUS"] === 1) { | |||
homes = res["DATA"]["products"]; | |||
} | |||
if (res["STATUS"] === 1) { | |||
homes = res["DATA"]["products"]; | |||
} | |||
return { | |||
props: { yamaha, suzuki, honda, hino, mercedes, bpr, emilia, homes, backend }, // will be passed to the page component as props | |||
}; | |||
} | |||
return { | |||
props: { | |||
yamaha, | |||
suzuki, | |||
honda, | |||
hino, | |||
mercedes, | |||
bpr, | |||
emilia, | |||
homes, | |||
backend, | |||
}, // will be passed to the page component as props | |||
}; | |||
} |