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

remoção do link no header ao entrar nos detalhes/edição do abrigo #282

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
11 changes: 8 additions & 3 deletions src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const Header = React.forwardRef<HTMLDivElement, IHeader>((props, ref) => {
startAdornment,
title,
className = '',
to = '',
...rest
} = props;

Expand All @@ -24,9 +25,13 @@ const Header = React.forwardRef<HTMLDivElement, IHeader>((props, ref) => {
>
<div className="flex gap-1 items-center">
{startAdornment}
<Link className="font-medium text-white" to="/">
{title}
</Link>
{to ? (
<Link className="font-medium text-white" to={to}>
{title}
</Link>
) : (
<Link className="font-medium text-white" to="/">{title}</Link>
)}
Comment on lines +28 to +34
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aqui poderia ser uma condicional mais simples para melhorar a legibilidade:

Suggested change
{to ? (
<Link className="font-medium text-white" to={to}>
{title}
</Link>
) : (
<Link className="font-medium text-white" to="/">{title}</Link>
)}
<Link className="font-medium text-white" to={to || '/'}>
{title}
</Link>

</div>
<div className="flex items-center">
<div className="cursor-pointer ">{endAdornment}</div>
Expand Down
1 change: 1 addition & 0 deletions src/components/Header/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export interface IHeader extends React.ComponentPropsWithoutRef<'div'> {
title: string;
startAdornment?: React.ReactNode;
endAdornment?: React.ReactNode;
to?: string;
}
1 change: 1 addition & 0 deletions src/pages/EditShelterSupply/EditShelterSupply.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ const EditShelterSupply = () => {
<ChevronLeft size={20} />
</Button>
}
to={`/abrigo/${shelterId}`}
/>
<div className="p-4 flex flex-col max-w-5xl w-full gap-3 items-start">
<h6 className="text-2xl font-semibold">Editar itens do abrigo</h6>
Expand Down
1 change: 1 addition & 0 deletions src/pages/UpdateShelter/UpdateShelter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ const UpdateShelter = () => {
<ChevronLeft size={20} />
</Button>
}
to={`/abrigo/${shelterId}`}
/>
<div className="p-4 flex flex-col max-w-5xl w-full gap-3 items-start h-full">
<form className="contents" onSubmit={handleSubmit}>
Expand Down