From 98c5bd6d810a5297fc0d0fc100625e0b288e72ef Mon Sep 17 00:00:00 2001 From: Kongzibapt <53861741+Kongzibapt@users.noreply.github.com> Date: Mon, 1 Feb 2021 12:09:50 +0100 Subject: [PATCH] Mise en forme tri categorie --- src/css/Components/articlesbycategory.css | 21 ++++++++++++++++++ src/js/Components/ArticlesByCategory.js | 26 ++++++++++++++++------- src/js/Components/Sort.js | 1 - src/js/Views/Stock.js | 10 ++++++--- 4 files changed, 46 insertions(+), 12 deletions(-) create mode 100644 src/css/Components/articlesbycategory.css diff --git a/src/css/Components/articlesbycategory.css b/src/css/Components/articlesbycategory.css new file mode 100644 index 0000000..a458dfc --- /dev/null +++ b/src/css/Components/articlesbycategory.css @@ -0,0 +1,21 @@ +#categoryName{ + color : white; + text-align: left; + font-family: 'Wellfleet', cursive; + font-size:max(2.5vw,30px); +} + +#categoryBlock{ + width:60vw; + margin-bottom:5vh; +} + +#bulles{ + display:flex; +} + +#underlinment{ + background-color: white; + width:30%; + height:0.3vh; +} \ No newline at end of file diff --git a/src/js/Components/ArticlesByCategory.js b/src/js/Components/ArticlesByCategory.js index 9a60d14..567d82d 100644 --- a/src/js/Components/ArticlesByCategory.js +++ b/src/js/Components/ArticlesByCategory.js @@ -1,5 +1,5 @@ import React from 'react'; -import '../../css/Components/articles.css' +import '../../css/Components/articlesbycategory.css' import ArticleDetails from './ArticleDetails' class ArticlesByCategory extends React.Component { @@ -12,10 +12,16 @@ class ArticlesByCategory extends React.Component { } componentDidMount(){ - console.log(this.props.articles) this.splitArticlesCategories() } + componentDidUpdate(){ + + if (this.props.onSearch){ + // implémenter une fonction de recherche en React sur articles + } + } + splitArticlesCategories = () => { let counterTab = 0; let divided = []; @@ -36,17 +42,21 @@ class ArticlesByCategory extends React.Component { render() { + console.log(this.state.articles) return (
{divided[0].category.name}
- {divided.map((article) => -{divided[0].category.name}
+ +