Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 

55 linhas
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 HeaderHonda from "components/Header/HeaderHonda.js";
  6. import FooterHonda from "components/Footer/FooterHonda.js";
  7. import Parallax from "components/Parallax/Parallax.js";
  8. import styles from "assets/jss/nextjs-material-kit/pages/components.js";
  9. import GetLatestNews from "api/latest_news/news.js"
  10. import DataSnackbarContent from "pages-sections/suzuki/snackbar.js";
  11. import DataLatestNews from "pages-sections/honda/latest_news/news.js";
  12. const useStyles = makeStyles(styles);
  13. const LatestNews = function ({ backend, news, ...props }) {
  14. const classes = useStyles();
  15. const { ...rest } = props;
  16. <DataLatestNews news={props.news}/>
  17. return (
  18. <div>
  19. <Header
  20. rightLinks={<HeaderHonda />}
  21. fixed
  22. color="info"
  23. changeColorOnScroll={{
  24. height: 400,
  25. color: "white"
  26. }}
  27. {...rest}
  28. />
  29. <Parallax image={require("assets/img/honda.jpg")} width="200px"/>
  30. <div className={classNames(classes.main, classes.mainRaised)}>
  31. <DataLatestNews news={news} backend={backend}/>
  32. </div>
  33. <FooterHonda />
  34. </div>
  35. );
  36. }
  37. export default LatestNews;
  38. export async function getServerSideProps(context) {
  39. var news = [];
  40. const backend = process.env.BACKEND_SERVER_URI;
  41. var res = await GetLatestNews.GetNewsHonda();
  42. if (res["STATUS"] === 1) {
  43. news = res["DATA"]["latestNews"];
  44. }
  45. return {
  46. props: { news, backend }, // will be passed to the page component as props
  47. };
  48. }