Skip to content

Commit

Permalink
update creator
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucieo committed May 6, 2020
1 parent db637ba commit 9b6f369
Showing 1 changed file with 36 additions and 30 deletions.
66 changes: 36 additions & 30 deletions src/components/PdfFormat/index.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,41 @@
import React from 'react';
import {useParams} from 'react-router-dom';
import {useQuery} from '@apollo/react-hooks';
import {GET_ALL_SKETCHBOOKS} from 'graphQL/queries';
import Loading from 'components/Loading';
import SketchbookDisplay from 'components/SketchbookDisplay';
import './PdfFormat.css'
import React from "react";
import { useParams } from "react-router-dom";
import { useQuery } from "@apollo/react-hooks";
import { GET_ALL_SKETCHBOOKS } from "graphQL/queries";
import Loading from "components/Loading";
import SketchbookDisplay from "components/SketchbookDisplay";
import "./PdfFormat.css";

export default function PdfFormat(){
const {gameId} = useParams();
const {data, loading, error} = useQuery(GET_ALL_SKETCHBOOKS, {
variables:{gameId}
})
export default function PdfFormat() {
const { gameId } = useParams();
const { data, loading, error } = useQuery(GET_ALL_SKETCHBOOKS, {
variables: { gameId },
});

if(loading) return <Loading/>
return(
if (loading) return <Loading />;
return (
<div className="pdf-format center container">
<h4>Une si belle partie!</h4>
<h5>avec la participation de {data && data.getAllSketchbooks.map((sketchbook, index)=><span key={index}> {sketchbook.pages[0].creator.name} </span>)}</h5>
<p>cliquez sur options/imprimer/version-pdf dans votre navigateur pour garder un souvenir</p>
{
data && data.getAllSketchbooks.map(
(sketchbook, index)=>{
return(
<div key={index} className="pdf-format__sketchbook">
<h4>carnet n°{index+1}</h4>
<SketchbookDisplay sketchbook={sketchbook}/>
</div>
)
}
)
}
<h5>
avec la participation de{" "}
{data &&
data.getAllSketchbooks.map((sketchbook, index) => (
<span key={index}> {sketchbook.creator?.name} </span>
))}
</h5>
<p>
cliquez sur options/imprimer/version-pdf dans votre navigateur
pour garder un souvenir
</p>
{data &&
data.getAllSketchbooks.map((sketchbook, index) => {
return (
<div key={index} className="pdf-format__sketchbook">
<h4>carnet n°{index + 1}</h4>
<SketchbookDisplay sketchbook={sketchbook} />
</div>
);
})}
</div>
)
}
);
}

0 comments on commit 9b6f369

Please sign in to comment.