Skip to content

Commit

Permalink
[ADD] notation in components
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromebueno committed Jul 19, 2019
1 parent a3c82d2 commit deb4709
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 16 deletions.
4 changes: 2 additions & 2 deletions api/provider/injectData.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 41,8 @@ function inject (data){
{'name': stats2,'main': false},
],
'notation': {
'note': 4,
'numberOfReviews' : 120
'note': null,
'numberOfReviews' : null
}
});
book.save();
Expand Down
4 changes: 1 addition & 3 deletions client/src/components/Advice/PersonnalAdviceCard.js
Original file line number Diff line number Diff line change
@@ -1,4 1,4 @@
import React,{useRef,useEffect, useContext} from 'react';
import React,{useEffect, useContext} from 'react';
import BookNotation from '../Book/Attribute/BookNotation'
import styled from 'styled-components';
import BookContext from '../../context/BookContext'
Expand All @@ -7,13 7,11 @@ const userImg = require("../../img/user.png");

export default function PersonnalAdviceCard(props) {
let advice = props.advice === undefined ? null : props.advice;
let ref = useRef();
let context = useContext(BookContext)


useEffect(() => { // ComponentDidMount
context.findBook(advice.bookId);
ref.current = true;
}, []);

const notation = {
Expand Down
2 changes: 2 additions & 0 deletions client/src/components/Book/Attribute/BookNotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 23,8 @@ export default function BookNotation(props) {
let rating = props.notation ? props.notation.note : score;
let reviews = props.notation ? props.notation.numberOfReviews == null ? "" : props.notation.numberOfReviews ' avis' : "";

if (props.notation && props.notation.note == null && props.notation.note == null) return <div>Aucun avis</div>

return (
<>
<Div style={{marginTop: 12, float: "left"}}>
Expand Down
4 changes: 3 additions & 1 deletion client/src/components/Book/Book.js
Original file line number Diff line number Diff line change
@@ -1,4 1,4 @@
import React,{useContext,useEffect,useRef} from 'react';
import React,{useContext,useEffect} from 'react';
import BookContext from '../../context/BookContext'
import BookCard from './BookCard';
import styled from 'styled-components';
Expand All @@ -14,6 14,8 @@ export default function Book({ match }) {

if(context.book.book === undefined) return <div></div>

console.log(context.book)

return (
<Container style={{marginTop: 32}} className="column col-12 col-mx-auto">
<div className="columns" style={{width: "100%"}}>
Expand Down
1 change: 0 additions & 1 deletion client/src/components/Book/BookList.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 8,6 @@ const Container = styled.div`
`

export default function BookList(props) {
console.log(props)
return (
<Container>
<div className="container">
Expand Down
10 changes: 1 addition & 9 deletions client/src/components/Utils/SearchBar.js
Original file line number Diff line number Diff line change
@@ -1,4 1,4 @@
import React, {useContext, useEffect, useState} from 'react';
import React from 'react';
import styles from 'styled-components';

const Container = styles.div`
Expand All @@ -8,14 8,6 @@ const Container = styles.div`
export default function SearchBar() {
return (
<Container>
<div class="wrap">
<div class="search">
<input type="text" class="searchTerm" placeholder="What are you looking for?"/>
<button type="submit" class="searchButton">
<i class="fa fa-search"></i>
</button>
</div>
</div>
</Container>
);
}
Expand Down

0 comments on commit deb4709

Please sign in to comment.