Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.35 KB | None | 0 0
  1. //@ts-nocheck
  2.  
  3. import React from 'react';
  4. import { SliderContainer, SliderDotContainer, Arrow } from './slider.style';
  5. import { SliderItem } from './item/sliderItem.component';
  6. import About from '../../assets/ONasHero.png';
  7. import Finansowanie from '../../assets/FinansowanieHero.png';
  8. import { Dot } from './dots/dot.component';
  9. import ArrowLeft from '../../assets/StrzalkaBialaLewo.png';
  10. import ArrowRight from '../../assets/StrzalkaBialaPrawo.png';
  11. import Ubezpieczenia from '../../assets/Ubezpieczenia.png';
  12. import Opytmalizacja from '../../assets/Optymalizacja.png';
  13. import Inwestycje from '../../assets/Inwestycje.png';
  14. import Wsparcie from '../../assets/Wsparcie.png';
  15. import Odnawialne from '../../assets/Odnawialne.png';
  16. import { PageComponent } from './pages/page.component';
  17.  
  18. interface State {
  19. list: [
  20. {
  21. img: string;
  22. alt: string;
  23. quote: string;
  24. index: number;
  25. title: string;
  26. subtitle: string;
  27. special: boolean;
  28. opacity: number;
  29. }
  30. ];
  31. }
  32.  
  33. export class Slider extends React.Component<{}, State> {
  34. constructor() {
  35. super({});
  36.  
  37. this.state = {
  38. //@ts-ignore
  39. list: [
  40. {
  41. img: About,
  42. alt:
  43. 'www.financeroom.pl - Zdjęcie wyróźniające sekcje o nas',
  44. quote:
  45. '„Jeżeli ludzie w kraju rozumieliby naszą bankowość i system monetarny, wierzę, że przed jutrzejszym rankiem wybuchłaby rewolucja.” – Henry Ford',
  46. index: 1,
  47. title: '',
  48. subtitle: 'więcej o nas',
  49. special: true,
  50. opacity: 1,
  51. },
  52. {
  53. img: Finansowanie,
  54. alt:
  55. 'www.financeroom.pl - Zdjęcie wyróźniające sekcje finansowanie',
  56. quote:
  57. 'Poznaj produkty finansowe dla klientów indywidualnych jak i dla firm.',
  58. index: 0,
  59. title: 'Ubezpieczenia',
  60. subtitle: 'więcej o ubezpieczenia',
  61. special: false,
  62. opacity: 0,
  63. },
  64. {
  65. img: Ubezpieczenia,
  66. alt:
  67. 'www.financeroom.pl - Zdjęcie wyróźniające sekcje ubezpieczenia',
  68. quote:
  69. 'Poznaj produkty ubezpieczeniowe dla klientów indywidualnych jak i dla firm.',
  70. index: 0,
  71. title: 'Finansowanie',
  72. subtitle: 'więcej o finansowianiu',
  73. special: false,
  74. opacity: 0,
  75. },
  76. {
  77. img: Opytmalizacja,
  78. alt:
  79. 'www.financeroom.pl - Zdjęcie wyróźniające sekcje optymalizacje podatkową i doradctwo finansowe',
  80. quote:
  81. 'Optymalizacja podatkowa i doradztwo finansowe? Chętnie wspomożemy Państwa naszą profesjonalną wiedzą.',
  82. index: 0,
  83. title: 'Optymalizacja podatkowa i doradctwo finansowe',
  84. subtitle: 'więcej o optymalizacji',
  85. special: false,
  86. opacity: 0,
  87. },
  88. {
  89. img: Inwestycje,
  90. alt:
  91. 'www.financeroom.pl - Zdjęcie wyróźniające sekcje inwestycje',
  92. quote:
  93. 'Poznaj produkty inwestycyjne dla klientów indywidualnych jak i dla firm.',
  94. index: 0,
  95. title: 'Inwestycje',
  96. subtitle: 'więcej o inwestycje',
  97. special: false,
  98. opacity: 0,
  99. },
  100. {
  101. img: Wsparcie,
  102. alt:
  103. 'www.financeroom.pl - Zdjęcie wyróźniające sekcje wsparcie',
  104. quote:
  105. 'Poznaj produkty wsparcia dla klientów indywidualnych jak i dla firm.',
  106. index: 0,
  107. title: 'Wsparcie',
  108. subtitle: 'więcej o wsparciu',
  109. special: false,
  110. opacity: 0,
  111. },
  112. {
  113. img: Odnawialne,
  114. alt:
  115. 'www.financeroom.pl - Zdjęcie wyróźniające sekcje Odnawialne źródła energii',
  116. quote:
  117. 'Poznaj produkty odnawialnych żródł energi dla klientów indywidualnych jak i dla firm.',
  118. index: 0,
  119. title: 'Odnawialne źródła energii',
  120. subtitle: 'więcej o odnawialnych źródłach energii',
  121. special: false,
  122. opacity: 0,
  123. },
  124. ],
  125. };
  126. }
  127.  
  128. _onLeftClick = () => {
  129. const newArray = [...this.state.list];
  130. const lastItem = newArray.pop();
  131. console.log('last item', lastItem);
  132. newArray.unshift(lastItem);
  133. console.log('newArry', newArray);
  134.  
  135. this.setState((state) => {
  136. // const list = newArray;
  137. // return {
  138. // list,
  139. // };
  140. });
  141. // this.setState({ list: newArray });
  142.  
  143. console.log('state', this.state);
  144. };
  145.  
  146. _onRigthClick = () => {
  147. console.log('rigth');
  148. };
  149.  
  150. _slide = () => {};
  151.  
  152. render() {
  153. return (
  154. <div>
  155. <SliderContainer>
  156. {this.state.list.map((value, key) => {
  157. return (
  158. <SliderItem
  159. key={key}
  160. img={value.img}
  161. alt={value.alt}
  162. quote={value.quote}
  163. index={value.index}
  164. title={value.title}
  165. subtitle={value.subtitle}
  166. special={value.special}
  167. opacity={value.opacity}
  168. />
  169. );
  170. })}
  171. <SliderDotContainer>
  172. <Arrow onClick={this._onLeftClick}>
  173. <img
  174. src={ArrowLeft}
  175. alt='financeroom.pl - slider finance'
  176. />
  177. </Arrow>
  178. {this.state.list.map((value, key) => {
  179. return <Dot key={key} />;
  180. })}
  181. <Arrow onClick={this._onRigthClick}>
  182. <img
  183. src={ArrowRight}
  184. alt='financeroom.pl - slider finance'
  185. />
  186. </Arrow>
  187. </SliderDotContainer>
  188. </SliderContainer>
  189. <PageComponent></PageComponent>
  190. </div>
  191. );
  192. }
  193. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement