暫無描述

Biography.tsx 3.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import {
  2. IonPage,
  3. IonContent,
  4. IonHeader,
  5. IonToolbar,
  6. IonFooter,
  7. IonImg,
  8. IonGrid,
  9. IonRow,
  10. IonCol,
  11. IonButtons,
  12. IonBackButton,
  13. useIonViewWillEnter,
  14. IonItem,
  15. IonIcon
  16. } from '@ionic/react';
  17. import { useParams } from 'react-router';
  18. import React, { useState } from 'react';
  19. import { BioInfo, getMessage } from '../data/BioInfo';
  20. import './Biography.css';
  21. import EnciclopediaPR from '../assets/EnciclopediaPR.png';
  22. import { clipboardOutline } from 'ionicons/icons';
  23. const Biography: React.FC = () => {
  24. const [bioinfo, setMessage] = useState<BioInfo>();
  25. const params = useParams<{ id: string }>();
  26. useIonViewWillEnter(() => {
  27. const msg = getMessage(parseInt(params.id, 10));
  28. setMessage(msg);
  29. });
  30. return (
  31. <IonPage>
  32. <IonHeader>
  33. <IonToolbar className="Header-Color">
  34. <IonGrid fixed={true}>
  35. <IonRow>
  36. <IonCol></IonCol>
  37. <IonCol>
  38. <IonImg style={{ height: 50, width: 100 }} src={EnciclopediaPR} alt='Logo'></IonImg>
  39. </IonCol>
  40. <IonCol></IonCol>
  41. </IonRow>
  42. </IonGrid>
  43. </IonToolbar>
  44. </IonHeader>
  45. <IonContent fullscreen className="ion-padding">
  46. {bioinfo ? (
  47. <>
  48. <IonItem>
  49. <IonImg style={{ height: 300, width: 600 }} src={bioinfo.photo} alt='Logo'></IonImg>
  50. <p>
  51. <h1>{bioinfo.title}</h1>
  52. {bioinfo.tags}
  53. <p>{bioinfo.birth}</p>
  54. <p>{bioinfo.place}</p>
  55. <p>{bioinfo.death}</p>
  56. </p>
  57. </IonItem>
  58. <p dangerouslySetInnerHTML={{ __html: bioinfo.Text }}></p>
  59. <p>{bioinfo.continue}</p>
  60. <a href={bioinfo.url} target="_blank" rel="noreferrer">For more information press here</a>
  61. <p> </p>
  62. <IonItem routerLink={`/Question/${bioinfo.id}`} detail={true}>
  63. <IonIcon icon={clipboardOutline} />Tomar quiz
  64. </IonItem>
  65. </>
  66. ) : (
  67. <div>Biography not found</div>
  68. )}
  69. </IonContent>
  70. <IonFooter>
  71. <IonToolbar className="Footer-Color">
  72. <div className='Item-Center'>
  73. <IonButtons slot="start">
  74. <IonBackButton defaultHref="/home"></IonBackButton>
  75. </IonButtons>
  76. </div>
  77. </IonToolbar>
  78. </IonFooter>
  79. </IonPage>
  80. );
  81. };
  82. export default Biography;