You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.7 KiB

  1. import React from "react";
  2. import classNames from "classnames";
  3. import { makeStyles } from "@material-ui/core/styles";
  4. import Header from "components/Header/Header.js";
  5. import HeaderLinks from "components/Header/HeaderLinks.js";
  6. import Footer from "components/Footer/Footer.js";
  7. import YamalubeDetail from "pages-sections/product/yamalube_details.js";
  8. import Parallax from "components/Parallax/Parallax.js";
  9. import styles from "assets/jss/nextjs-material-kit/pages/components.js";
  10. import GetDetailYamalube from "../../api/product/accessories.js"
  11. const useStyles = makeStyles(styles);
  12. const YamalubeDetails = function ({ backend, detailyamalube, ...props }) {
  13. const classes = useStyles();
  14. const { ...rest } = props;
  15. return (
  16. <div>
  17. <Header
  18. rightLinks={<HeaderLinks/>}
  19. fixed
  20. color="info"
  21. changeColorOnScroll={{
  22. height: 400,
  23. color: "white"
  24. }}
  25. {...rest}
  26. />
  27. <Parallax image={require("assets/img/yamalube.jpg")} width="200px"/>
  28. <div className={classNames(classes.main, classes.mainRaised)}>
  29. <YamalubeDetail detailyamalube={detailyamalube} backend={backend}/>
  30. </div>
  31. <Footer />
  32. </div>
  33. );
  34. }
  35. export default YamalubeDetails;
  36. export async function getServerSideProps(context) {
  37. var {query} = context;
  38. var detailyamalube = [];
  39. const backend = process.env.BACKEND_SERVER_URI;
  40. var res = await GetDetailYamalube.GetDetailAccessories(query.s||0);
  41. if (res["STATUS"] === 1) {
  42. detailyamalube = res["DATA"]["accessories"];
  43. }
  44. console.log(detailyamalube);
  45. return {
  46. props: { detailyamalube, backend }, // will be passed to the page component as props
  47. };
  48. }