Skip to content
Snippets Groups Projects
Commit 25577990 authored by Johann Ruiz's avatar Johann Ruiz
Browse files

Adding stars with subscriptions

parent ce643939
No related branches found
No related tags found
1 merge request!2Subscribing
Pipeline #10795 failed
This commit is part of merge request !2. Comments created here will be created in the context of that merge request.
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
border: solid 1px var(--default-text-color); border: solid 1px var(--default-text-color);
border-radius: 0.25em; border-radius: 0.25em;
width: 300px; width: 300px;
padding-top: 1.3em;
} }
.lab-name { .lab-name {
...@@ -46,3 +47,15 @@ h1, h2, h3, h4 { ...@@ -46,3 +47,15 @@ h1, h2, h3, h4 {
margin: 0; margin: 0;
} }
.star-icon-container {
position: absolute;
top: 10px;
right: 10px;
}
.star-icon {
color: gold;
font-size: 1em;
}
\ No newline at end of file
...@@ -2,17 +2,30 @@ import { useState } from 'react'; ...@@ -2,17 +2,30 @@ import { useState } from 'react';
import './LabsListItem.css'; import './LabsListItem.css';
import LabPopup from './LabPopup'; import LabPopup from './LabPopup';
import { ResearchLabItem } from "../types.ts"; import { ResearchLabItem } from "../types.ts";
import { useStudentUserContext } from "../contexts/StudentUserContext.tsx";
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faStar, faStar as faStarRegular } from '@fortawesome/free-solid-svg-icons';
export default function LabsListItem(props: { researchLabItem: ResearchLabItem }) { export default function LabsListItem(props: { researchLabItem: ResearchLabItem }) {
const [showPopup, setShowPopup] = useState(false); const [showPopup, setShowPopup] = useState(false);
const { student } = useStudentUserContext();
const togglePopup = () => { const togglePopup = () => {
setShowPopup(!showPopup); setShowPopup(!showPopup);
}; };
const isSubscribed = student?.subscriptions.includes(props.researchLabItem.name) || false;
return ( return (
<> <>
<li key={props.researchLabItem.id} className="lab-box"> <li key={props.researchLabItem.id} className="lab-box">
<div className="star-icon-container">
{isSubscribed && (
<FontAwesomeIcon icon={faStar} className="star-icon" />
)}
</div>
<h1 className="lab-name" title={props.researchLabItem.name} onClick={togglePopup}> <h1 className="lab-name" title={props.researchLabItem.name} onClick={togglePopup}>
{props.researchLabItem.name} {props.researchLabItem.name}
</h1> </h1>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment