Skip to content

Commit

Permalink
Feature/contact card (#70)
Browse files Browse the repository at this point in the history
* Adding new police color for text

Named it grey-police, based on S+1 on figma

* Adding LinkedIn icon

* Adding ContactCard components

Structure made, still need to link it to fake data

* Adding mockoon file

* Adding siteId props to ContactCard

* Linking with mocked data

- importing services : api, apiInterface, errors
- implementing useEffect and useState hooks
- fetching data from mockoon

* Adding new icons for ContactCard

- adding standardized icons for facebook, instagram, linkedIn and X

* Fixing data transmission + Adding new social icons

- No need for fetch anymore, been done on MapSite just passing the
correct props

* Styling contact card

* Changing the prop passed to ContactCard

- from siteId to contact

* Merging main to feature/ContactCard branch

* Merging (again) main to feature/ContactCard branch

* Adding fake link to social media (FB, IG, X, .. )

- Display of social icons depending on their existence, so I added fake
links to mockoon file.

* Fixing display of social icons

* Adjusting size of edit button

* Fixing card styling

* Armonizing contact card style

* Fixing and harmonizing styling issue

---------

Co-authored-by: Théo Auffeuvre <[email protected]>
  • Loading branch information
lucie-pl and theo-auffeuvre authored Mar 27, 2024
1 parent edf74a6 commit 778eb90
Show file tree
Hide file tree
Showing 12 changed files with 216 additions and 20 deletions.
6 changes: 3 additions & 3 deletions canopeum_frontend/canopeum-mockoon.json
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@
"responses": [
{
"uuid": "2d298812-02ea-4391-93fc-0dd874d3f57a",
"body": "{\n \"name\": \"{{lorem (int 1 3)}}\",\n \"type\": {\n \"id\": {{int 1 9999}},\n \"en\": \"{{lorem (int 1 3)}}\",\n \"fr\": \"{{lorem (int 1 3)}}\"\n },\n \"description\": \"{{lorem (int 1 150)}}\",\n \"sponsors\": {{{someOf (array (lorem 2) (lorem 2) (lorem 2) (lorem 2) (lorem 2)) 0 5 true}}},\n \"announcement\": {\n \"id\": {{int 1 9999}},\n \"body\": \"{{lorem (int 1 150)}}\",\n \"link\": \"https://{{domain}}/\"\n },\n \"contact\": {\n \"id\": {{int 1 9999}},\n \"address\": \"{{street}}, {{city}}, {{countryCode}} {{postcode}}\",\n \"email\": \"{{email}}\",\n \"phone\": \"{{phone}}\",\n \"facebookLink\": \"\",\n \"xLink\": \"\",\n \"instagramLink\": \"\",\n \"linkedInLink\": \"\"\n },\n \"widgets\": [\n {{#repeat 0 (int 0 2) comma=true}}\n {\n \"id\": {{int 1 9999}},\n \"title\": \"{{lorem (int 1 5)}}\",\n \"body\": \"{{lorem (int 1 150)}}\"\n }\n {{/repeat}}\n ],\n \"image\": \"\"\n}",
"body": "{\n \"name\": \"{{lorem (int 1 3)}}\",\n \"type\": {\n \"id\": {{int 1 9999}},\n \"en\": \"{{lorem (int 1 3)}}\",\n \"fr\": \"{{lorem (int 1 3)}}\"\n },\n \"description\": \"{{lorem (int 1 150)}}\",\n \"sponsors\": {{{someOf (array (lorem 2) (lorem 2) (lorem 2) (lorem 2) (lorem 2)) 0 5 true}}},\n \"announcement\": {\n \"id\": {{int 1 9999}},\n \"body\": \"{{lorem (int 1 150)}}\",\n \"link\": \"https://{{domain}}/\"\n },\n \"contact\": {\n \"id\": {{int 1 9999}},\n \"address\": \"{{street}}, {{city}}, {{countryCode}} {{postcode}}\",\n \"email\": \"{{email}}\",\n \"phone\": \"{{phone}}\",\n \"facebookLink\": \"https://beslogic.com\",\n \"xLink\": \"https://beslogic.com\",\n \"instagramLink\": \"https://beslogic.com\",\n \"linkedInLink\": \"https://beslogic.com\"\n },\n \"widgets\": [\n {{#repeat 0 (int 0 2) comma=true}}\n {\n \"id\": {{int 1 9999}},\n \"title\": \"{{lorem (int 1 5)}}\",\n \"body\": \"{{lorem (int 1 150)}}\"\n }\n {{/repeat}}\n ],\n \"image\": \"\"\n}",
"latency": 0,
"statusCode": 200,
"label": "",
Expand Down Expand Up @@ -1503,7 +1503,7 @@
"id": "m32b",
"name": "Site",
"documentation": "",
"value": "{\n \"name\": \"{{lorem (int 1 3)}}\",\n \"contact\": {\n \"address\": \"{{street}}, {{city}}, {{countryCode}} {{postcode}}\",\n \"email\": \"{{email}}\",\n \"phone\": \"{{phone}}\",\n \"facebookLink\": \"\",\n \"xLink\": \"\",\n \"instagramLink\": \"\",\n \"linkedInLink\": \"\"\n },\n \n}"
"value": "{\n \"name\": \"{{lorem (int 1 3)}}\",\n \"contact\": {\n \"address\": \"{{street}}, {{city}}, {{countryCode}} {{postcode}}\",\n \"email\": \"{{email}}\",\n \"phone\": \"{{phone}}\",\n \"facebookLink\": \"https://beslogic.com\",\n \"xLink\": \"https://beslogic.com\",\n \"instagramLink\": \"https://beslogic.com\",\n \"linkedInLink\": \"https://beslogic.com\"\n },\n \n}"
},
{
"uuid": "c6fae7ec-3df3-465d-9a91-8a677aead682",
Expand Down Expand Up @@ -1531,7 +1531,7 @@
"id": "r9jy",
"name": "Contact",
"documentation": "",
"value": "{\n \"address\": \"{{street}}, {{city}}, {{countryCode}} {{postcode}}\",\n \"email\": \"{{email}}\",\n \"phone\": \"{{phone}}\",\n \"facebookLink\": \"\",\n \"xLink\": \"\",\n \"instagramLink\": \"\",\n \"linkedInLink\": \"\"\n}"
"value": "{\n \"address\": \"{{street}}, {{city}}, {{countryCode}} {{postcode}}\",\n \"email\": \"{{email}}\",\n \"phone\": \"{{phone}}\",\n \"facebookLink\": \"https://beslogic.com\",\n \"xLink\": \"https://beslogic.com\",\n \"instagramLink\": \"https://beslogic.com\",\n \"linkedInLink\": \"https://beslogic.com\"\n}"
}
],
"callbacks": []
Expand Down
24 changes: 12 additions & 12 deletions canopeum_frontend/src/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@

@import "bootstrap/scss/bootstrap";

// ::-webkit-scrollbar {
// width: 10px;
// }

// ::-webkit-scrollbar-track {
// background-color: transparent;
// }

// ::-webkit-scrollbar-thumb {
// background-color: #f8f9fa;
// border-radius: 5px;
// }
::-webkit-scrollbar {
width: 10px;
}

::-webkit-scrollbar-track {
background-color: transparent;
}

::-webkit-scrollbar-thumb {
background-color: #f8f9fa;
border-radius: 5px;
}

body {
background-image: url('@assets/images/TreeBackground.png');
Expand Down
23 changes: 23 additions & 0 deletions canopeum_frontend/src/assets/icons/facebook-contact-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions canopeum_frontend/src/assets/icons/instagram-contact-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions canopeum_frontend/src/assets/icons/linkedin-contact-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions canopeum_frontend/src/assets/icons/linkedin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions canopeum_frontend/src/assets/icons/x-contact-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion canopeum_frontend/src/assets/styles/theme-variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ $green: #28a745;
$teal: #20c997;
$cyan: #17a2b8;
$white: #fff;
$grey-police: #433A2E;
$gray-100: #f8f9fa;
$gray-200: #e9ecef;
$gray-300: #dee2e6;
Expand All @@ -38,6 +39,7 @@ $grays: (
$theme-colors: (
primary: #007E51,
secondary: #F18200,
secondary_1: $grey-police,
success: $green,
info: $cyan,
warning: $yellow,
Expand All @@ -60,7 +62,7 @@ $colors: (
white: $white,
gray: $gray-600,
gray-dark: $gray-800,
cream: $cream,
cream: $cream
);
$theme-color-interval: 8%;
$table-variants: (
Expand Down
62 changes: 62 additions & 0 deletions canopeum_frontend/src/components/ContactCard/ContactCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import '../ContactCard/contact-card.scss';
import '../../pages/Utilities';

import facebookLogo from '@assets/icons/facebook-contact-logo.svg';
import instagramLogo from '@assets/icons/instagram-contact-logo.svg';
import linkedinLogo from '@assets/icons/linkedin-contact-logo.svg';
import xLogo from '@assets/icons/x-contact-logo.svg';
import { Link } from 'react-router-dom';

import type { Contact } from '../../services/api'

const ContactCard = ({ contact }:{readonly contact: Contact}) => {

const renderContactCard = () => (
<div className='card rounded px-3 py-2'>
<div className='card-body'>
<div className='d-flex justify-content-between align-items-center pb-3'>
<h2 className='card-title'>Contact</h2>
<span className='material-symbols-outlined text-primary fs-2'>edit_square</span>
</div>
<div className='info-section d-flex flex-column'>
<div className='card-text adress d-flex align-items-center pb-3'>
<span className='material-symbols-outlined fs-4'>home_work</span>
<p className='mb-0'>{contact.address}</p>
</div>
<div className='email d-flex align-items-center pb-3'>
<span className='material-symbols-outlined fs-4'>mail</span>
<p className='mb-0'>{contact.email}</p>
</div>
<div className='phone d-flex align-items-center pb-3'>
<span className='material-symbols-outlined fs-4'>perm_phone_msg</span>
<p className='mb-0'>{contact.phone}</p>
</div>
</div>
<div className='social-icons d-flex flex-row-reverse pt-3'>
{contact.linkedInLink && <Link target='_blank' to={contact.linkedInLink} >
<img alt='linkedin-logo' className="px-2" src={linkedinLogo} />
</Link>}
{contact.instagramLink && <Link target='_blank' to={contact.instagramLink}>
<img alt="instagram-logo" className="px-2" src={instagramLogo} />
</Link>}
{contact.xLink && <Link target='_blank' to={contact.xLink}>
<img alt="x-logo" className="px-2" src={xLogo} />
</Link>}
{contact.facebookLink && <Link target='_blank' to={contact.facebookLink}>
<img alt='facebook-logo' className="px-2" src={facebookLogo}/>
</Link>}
</div>
</div>


</div>
)

return (
<div>
{renderContactCard()}
</div>
)
}

export default ContactCard
23 changes: 23 additions & 0 deletions canopeum_frontend/src/components/ContactCard/contact-card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@import '@assets/styles/theme-variables.scss';

.card {
padding: 20px;
background-color: $white;
}

.card-title {
font-family: $font-family-sans-serif;
font-size: $h2-font-size;
}

.card-text {
font-family: $font-family-monospace;
color: $grey-police;
}


.material-symbols-outlined {
color: $grey-police;
padding-right: 16px;

}
1 change: 1 addition & 0 deletions canopeum_frontend/src/components/site/SiteSummaryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,5 @@ const SiteSummaryCard = ({ site, viewMode }: Props) => {
</div>
)
}

export default SiteSummaryCard
19 changes: 15 additions & 4 deletions canopeum_frontend/src/pages/MapSite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ import PostWidget from '../components/PostWidget'
import AnnouncementCard from '../components/AnnouncementCard/AnnouncementCard';


import ContactCard from '../components/ContactCard/ContactCard';
import SiteSummaryCard from '../components/site/SiteSummaryCard'
import type { SiteSocial } from '../services/api'
import api from '../services/apiInterface'

const fetchSite = async (siteId: number, setSite: (site: SiteSocial) => void) => {
try {
const site = await api().social.site(siteId)
setSite(site)
} catch (error) {
console.error(error)
}
}

const MapSite = () => {
const { siteId } = useParams()
const { currentUser } = useContext(AuthenticationContext)
Expand Down Expand Up @@ -53,15 +67,12 @@ const MapSite = () => {
</div>
)
: (site && <SiteSummaryCard site={site} viewMode={viewMode} />)}

<div className='container px-0'>
<div className='row'>
<div className='col-4'>
<div className='d-flex flex-column gap-2'>
<div className='bg-white rounded-2 2 py-2'>
<h1>Left</h1>
</div>
{ site?.announcement && <AnnouncementCard announcement={site.announcement} />}
{ site?.contact && <ContactCard contact={site.contact} />}
</div>
</div>
<div className='col-8'>
Expand Down

0 comments on commit 778eb90

Please sign in to comment.