-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c0e0db7
commit cb7ef98
Showing
3 changed files
with
11 additions
and
68 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,25 @@ | ||
import { Button } from '@uzh-bf/design-system' | ||
import { RefObject } from 'react' | ||
import Link from 'next/link' | ||
|
||
interface NewProposalButtonProps { | ||
isSupervisor: boolean | ||
displayMode: string | ||
setDisplayMode: (displayMode: string) => void | ||
setSelectedProposal: (proposalId: string | null) => void | ||
buttonRef: RefObject<HTMLButtonElement> | ||
} | ||
|
||
export default function NewProposalButton({ | ||
isSupervisor, | ||
displayMode, | ||
setDisplayMode, | ||
setSelectedProposal, | ||
buttonRef, | ||
}: NewProposalButtonProps) { | ||
const handleButtonClick = () => { | ||
setSelectedProposal(null) | ||
isSupervisor | ||
? setDisplayMode('createSupervisor') | ||
: setDisplayMode('createStudent') | ||
buttonRef?.current?.scrollIntoView({ | ||
behavior: 'smooth', | ||
}) | ||
} | ||
|
||
return ( | ||
<div> | ||
<Button | ||
active={ | ||
displayMode === 'createSupervisor' || displayMode === 'createStudent' | ||
<Link | ||
target="_blank" | ||
href={ | ||
isSupervisor | ||
? (process.env.NEXT_PUBLIC_FORMS_URL_PUBLISH as string) | ||
: (process.env.NEXT_PUBLIC_FORMS_URL_SUBMIT as string) | ||
} | ||
onClick={handleButtonClick} | ||
> | ||
New Proposal | ||
</Button> | ||
<Button>New Proposal</Button> | ||
</Link> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters