Skip to content

Commit

Permalink
Fix eslint issue and rename variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Wineshuga committed Dec 28, 2023
1 parent 0f28a84 commit b4219b3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/components/Mission.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { fetchMissions, joinMission, leaveMission } from '../redux/mission/missi
import '../styles/mission.css';

const Mission = () => {
const [isDesktop, setDesktop] = useState(window.innerWidth < 620);
const [isMobile, setMobile] = useState(window.innerWidth < 620);

const updateMedia = () => {
setDesktop(window.innerWidth < 620);
setMobile(window.innerWidth < 620);
};

useEffect(() => {
Expand All @@ -32,12 +32,16 @@ const Mission = () => {
};

const handleButtons = (id, reserved) => {
const leaveLabel = `Leave Mission ${id}`;
const joinLabel = `Join Mission ${id}`;

if (reserved) {
return (
<button
className="text-danger border-2 border-danger"
type="button"
onClick={() => dispatch(leaveMission({ id }))}
aria-label={leaveLabel}
>
Leave Mission
</button>
Expand All @@ -48,6 +52,7 @@ const Mission = () => {
className="text-secondary border-2"
type="button"
onClick={() => dispatch(joinMission({ id }))}
aria-label={joinLabel}
>
Join Mission
</button>
Expand All @@ -59,7 +64,7 @@ const Mission = () => {
<td className="fw-bold">{ item.name }</td>
<td className="mission-desc">
{
isDesktop ? (
isMobile ? (
<Link to="Mission-details">
<p>
{ item.desc }
Expand Down

0 comments on commit b4219b3

Please sign in to comment.