From 7ba4e66bfdc021e46d300c275a0ff1a24a5bc93f Mon Sep 17 00:00:00 2001 From: Yan Zhylavy Date: Fri, 1 Nov 2024 12:39:13 +0200 Subject: [PATCH] Add link to all companies to the NewCompanies, css adjustments --- .../CompanyCard/CompanyCard.module.css | 17 +++++---- .../pages/LandingPage/Companies/Companies.jsx | 23 +++++++++++- .../Companies/Companies.module.css | 36 ++++++++++++------- 3 files changed, 57 insertions(+), 19 deletions(-) diff --git a/FrontEnd/src/components/CompanyCard/CompanyCard.module.css b/FrontEnd/src/components/CompanyCard/CompanyCard.module.css index 907c0d1c..2ad86d8a 100644 --- a/FrontEnd/src/components/CompanyCard/CompanyCard.module.css +++ b/FrontEnd/src/components/CompanyCard/CompanyCard.module.css @@ -7,6 +7,7 @@ border-radius: 11px; transition: transform 0.2s ease; position: relative; + margin: auto; } .company-card:hover { @@ -50,11 +51,10 @@ .company-card__text-block { width: 302px; height: 177px; - padding: 16px; display: flex; flex-direction: column; align-items: flex-start; - gap: 16px; + justify-content: space-between; border-radius: 0 0 12px 12px; background: var(--company-card-color); } @@ -69,24 +69,26 @@ .company-card__category-text { color: var(--companies-card-lover-text); text-align: center; - font-family: var(--font-main); + font-family: var(--font-logo); font-size: 16px; font-style: normal; font-weight: 700; line-height: 120%; text-align: left; + padding-left: 16px; } .company-card__name-text { height: 48px; color: var(--companies-card-text-color); - font-family: var(--font-main); + font-family: var(--font-logo); font-size: 20px; font-style: normal; font-weight: 700; line-height: 120%; text-transform: uppercase; text-align: left; + padding-left: 16px; } .company-card__name-text_link { @@ -102,13 +104,14 @@ height: 20px; color: var(--companies-card-address); font-feature-settings: 'calt' off; - font-family: var(--font-main); + font-family: var(--font-logo); font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px; letter-spacing: -0.14px; text-align: left; + padding-left: 16px; } .company-card__footer_content { @@ -116,10 +119,12 @@ flex-direction: row; justify-content: space-between; width: 302px; + padding-left: 13px; + padding-bottom: 2px; } .company-card__badges_block { - height: 24px; + height: 25px; display: inline-block; overflow: hidden; } diff --git a/FrontEnd/src/pages/LandingPage/Companies/Companies.jsx b/FrontEnd/src/pages/LandingPage/Companies/Companies.jsx index 5d980907..437c4756 100644 --- a/FrontEnd/src/pages/LandingPage/Companies/Companies.jsx +++ b/FrontEnd/src/pages/LandingPage/Companies/Companies.jsx @@ -1,5 +1,6 @@ import axios from 'axios'; import { useState, useEffect } from 'react'; +import { Link } from 'react-router-dom'; import styles from './Companies.module.css'; import CompanyCard from '../../../components/CompanyCard/CompanyCard'; import PropTypes from 'prop-types'; @@ -10,6 +11,17 @@ const MainCompanies = ({ isAuthorized }) => { const baseUrl = process.env.REACT_APP_BASE_API_URL; const [searchResults, setSearchResults] = useState([]); const [newMembers, setNewMembers] = useState(true); + const [windowWidth, setWindowWidth] = useState(window.innerWidth); + + useEffect(() => { + const handleResize = () => { + setWindowWidth(window.innerWidth); + }; + window.addEventListener('resize', handleResize); + return () => { + window.removeEventListener('resize', handleResize); + }; + }, []); const fetcher = async (url) => { const data = await axios.get(url); @@ -38,6 +50,7 @@ const MainCompanies = ({ isAuthorized }) => { } }, [newMembers, companylist, searchResults]); const companyDataList = searchResults; + const linkText = windowWidth>500 ? 'Всі підприємства' : 'Всі'; return (
@@ -45,9 +58,17 @@ const MainCompanies = ({ isAuthorized }) => {

Нові учасники

+
+ +

{linkText} + + +

+ +
- + {companyDataList.map((result, resultIndex) => (