Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 

104 rader
3.9 KiB

  1. import React from 'react';
  2. import { Link as LinkScroll } from 'react-scroll'
  3. import Link from 'next/link';
  4. import dynamic from 'next/dynamic';
  5. const MainBanner = ({company,main_banner,link_to,banner,className}) => {
  6. var defaultValue;
  7. if(company == 'thamrin'){
  8. defaultValue = {
  9. Title:"Selamat Datang di Thamrin Group",
  10. Description:"Thamrin Group adalah perusahaan terkemuka di Sumatera Selatan & Bengkulu dengan fokus bisnis pada sektor otomotif dan properti.",
  11. Image:'/images/bigdata-analytics/main-banner.jpg'
  12. }
  13. }
  14. else if(company == 'yamaha'){
  15. defaultValue = {
  16. Title:"Exclusif Motor Untuk Anda",
  17. Description:"PT.Thamrin Brother's Yamaha merupakan sebuah bisnis company dari Thamrin Group yang bergerak dalam bidang penjualan produk Motor dan Sparepart Yamaha.",
  18. Image:'/images/Yamaha/banner.jpg'
  19. }
  20. }
  21. else{
  22. defaultValue = {
  23. Title:"Exclusif Motor Untuk Anda",
  24. Description:"",
  25. Image:'/images/Yamaha/banner.jpg'
  26. }
  27. }
  28. const Main_Banner = (main_banner && main_banner.length > 0 && main_banner[0].attributes.Contents.data&&main_banner[0].attributes.Contents.data.length>0)?(
  29. <div className="bigdata-analytics-banner" style={{
  30. 'backgroundImage' : `url('/api/util?img=${encodeURIComponent(main_banner[0].attributes.Contents.data[0].attributes.Image.data.attributes.url)}')`,
  31. }}>
  32. <div className="bigdata-analytics-content" >
  33. <h1>{main_banner[0].attributes.Contents.data[0].attributes.Title}</h1>
  34. <p>{main_banner[0].attributes.Contents.data[0].attributes.Description}</p>
  35. {(main_banner[0].attributes.Contents.data[0].attributes.Link)
  36. ?(<Link href={`./${main_banner[0].attributes.Contents.data[0].attributes.Link}`}>
  37. <a className="btn btn-primary">Get Started</a>
  38. </Link>)
  39. :(<LinkScroll offset={-100} to={link_to} spy={true} smooth={true}>
  40. <a className="btn btn-primary">Get Started</a>
  41. </LinkScroll>)
  42. }
  43. </div>
  44. </div>
  45. ):(
  46. <div className="bigdata-analytics-banner" style={{
  47. 'backgroundImage' : `url('${defaultValue.Image}')`,
  48. }}>
  49. <div className="bigdata-analytics-content" >
  50. <h1>{defaultValue.Title}</h1>
  51. <p>{defaultValue.Description}</p>
  52. <LinkScroll offset={-100} to="business_partner" spy={true} smooth={true}>
  53. <a className="btn btn-primary">Get Started</a>
  54. </LinkScroll>
  55. </div>
  56. </div>
  57. );
  58. const Banners = (banner && banner.length >0)?banner.map((data,idx)=>{
  59. return (
  60. // <Link href={`/news/${data.id}`}>
  61. <div key={idx} className="bigdata-analytics-banner" style={{
  62. 'backgroundImage' : `url('/api/util?img=${encodeURIComponent(data.attributes.url)}')`,
  63. }}>
  64. {/* <div className="bigdata-analytics-content newsTitle" >
  65. <h1>{data.attributes.Title}</h1>
  66. </div> */}
  67. </div>
  68. // </Link>
  69. );
  70. }):"";
  71. const OwlCarousel = dynamic(import('react-owl-carousel3'));
  72. const options = {
  73. center:false,
  74. loop: false,
  75. nav: false,
  76. dots: true,
  77. autoplay: true,
  78. smartSpeed: 1000,
  79. margin: 0,
  80. autoplayTimeout: 5000,
  81. autoWidth:false,
  82. responsive: {
  83. 0:{
  84. items: 1,
  85. },
  86. },
  87. }
  88. return (
  89. <div id="home" className={className}>
  90. <OwlCarousel className="ml-projects-slides owl-carousel fullw owl-theme"
  91. {...options}>
  92. {Main_Banner}
  93. {Banners}
  94. </OwlCarousel>
  95. </div>
  96. )
  97. }
  98. export default MainBanner;