Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(SILVA-494): disabling home buttons #434

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions frontend/src/components/FavouriteCard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import React from 'react';
import { useNavigate } from 'react-router-dom';
import { Tile } from '@carbon/react';
import { ClickableTile } from '@carbon/react';
import * as Icons from '@carbon/icons-react';
import './styles.scss';

Expand All @@ -9,7 +7,8 @@ interface FavouriteCardProps {
title: string,
link: string,
icon: string,
description:String
description:string
disabled?: boolean
}

/**
Expand All @@ -28,16 +27,18 @@ function FavouriteCard ({
title,
link,
icon,
description
description,
disabled = false
}: FavouriteCardProps): JSX.Element {
const Icon = Icons[String(icon)];
const navigate = useNavigate();

return (
<Tile
<ClickableTile
id={`fav-card-${index}`}
className={'fav-card-main' }
tabIndex={index}
onClick={() => navigate(link)}
href={link}
disabled={disabled}
>
<div className="fav-card-header">
<Icon className="fav-card-icon" />
Expand All @@ -49,7 +50,7 @@ function FavouriteCard ({
<p className="fav-card-title-large">{title}</p>
<p className="fav-card-content-description">{description}</p>
</div>
</Tile>
</ClickableTile>
);
};

Expand Down
6 changes: 6 additions & 0 deletions frontend/src/components/FavouriteCard/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ p.fav-card-title-small {
display: none;
}

.bx--tile--clickable.bx--link--disabled, .bx--tile--clickable:hover.bx--link--disabled {
display: flex;
margin: 0.5rem;
padding: 1.25rem 1rem;
}

@media only screen and (max-width: 671px) {
.fav-card-main,
.fav-card-main-highlighted {
Expand Down
9 changes: 6 additions & 3 deletions frontend/src/screens/Opening/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,29 +53,32 @@ const Opening: React.FC = () => {
</div>
<div className="col-sm-6 col-md-6 col-lg-6 col-xl-6 col-xxl-3">
<FavouriteCard
index={1}
index={2}
title={'Create an opening'}
link="#"
icon={'MapBoundary'}
description={'Create different opening types to track silviculture activities, treatments and generate their identifier (ID)'}
disabled
/>
</div>
<div className="col-sm-6 col-md-6 col-lg-6 col-xl-6 col-xxl-3">
<FavouriteCard
index={1}
index={3}
title={'Reports'}
link="#"
icon={'ReportData'}
description={'Consult and manage opening reports'}
disabled
/>
</div>
<div className="col-sm-6 col-md-6 col-lg-6 col-xl-6 col-xxl-3">
<FavouriteCard
index={1}
index={4}
title={'Upcoming activities'}
link="#"
icon={'Activity'}
description={'Track opening activities and milestones'}
disabled
/>
</div>
</div>
Expand Down
Loading